/* 7K87K.c: This demo program is for 7K and 87K module general function. 1. User must use DCON Utility to set Address, Baudrate,CheckSum before running the demo. 2. If user uses Com2 in the 8410,8411,8810 and 8811, user will must to add AddCom2Fun(). Compiler: BC++ 3.1, Turbo C ++ 1.01(3.01) (free from http://community.borland.com/museum) MSC 6.0, MSVC 1.52. Compile mode: large Project: 87K_demo.c ..\Lib\(7188xa/b/c.lib,8000.Lib, 8000E.lib) Hardware: 7188/8000 <== COM port ==> 7K or 87K modelue [24 May,2005] by Bill */ #include"..\..\lib\vh2k.h" /* === English comments ========================================== This demo program is for all functions of 7k and 87K I/O modules . Users can refer the demo to excute every commands list in 7k and 87K I/O module's document. For example: $AAM, #AA, @AA, @AA6... etc. If users wants to use AI,AO,DI,DO,DIO, we have prepared several demos. Uers can copy the code from these demos then paste to their own program. === Chinese comments ========================================== 硂絛ㄒ琌皐癸 87K I/O 家舱场 ㄏノ把σ絛ㄒㄓㄏノ– 87K I/O 家舱㏑もい ㄒ $AAM, #AA, @AA, @AA6... 单单 安ㄏノ璶ㄏノ AI, AO, DI, DO, DIO 硂ㄇи竒非称 计瞷Θ絛ㄒ祘Α盢硂ㄇ祘Α絏钡狡籹祘Αいㄓㄏノ */ void main() { unsigned char InBuf[20]; int iRet; //Step 1: InitLib(); //if user uses Com2 in the 8410,8411,8810 and 8811, //user will must to add AddCom2Fun(). //AddCom2Fun(); InstallCom(2,115200,8,0,1); //(Baudrate,Data bit,Parity bit,Stop bit) //Step 2: SendCmdTo7000(2,"$05M",0); /* COM2, Command="$AAM" which AA=01,Checksum=disabled For example: command="$01M" ===> Gets module name at address 01. For detailed command sets,refer to CD:\Napdos\DCON\IO_Module\hw_dcon_on_87kUnit or CD:\Napdos\7000\Manual\ */ //Step 3: ReceiveResponseFrom7000_ms(2,InBuf,100,0); /* COM2, Put received data to InBuf Timeout=100 ms Checksum=disabled */ //Step 4: Print("InBuf=%s",InBuf); //Step 5: RestoreCom2(); }