/* 87k_demo.c :This demo program is for 87K General Function in Com0. User must to know: 1.The com0's baudrate is 115200. User don't modify it. 2.User need to know the module's location in the MCU. 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\(8000.Lib, 8000E.lib) Hardware: 8000 [24 May,2005] by Bill */ #include "..\..\lib\vp2k.h" /* === English comments ========================================== This demo program is for all functions of 87K I/O modules . Users can refer the demo to excute every commands list in 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 InBufCom0[60]; InitLib(); //Step 1: InstallCom_0(115200L,8,0,0); //(Baudrate,Data bit,Parity bit,Stop bit) //Step 2: ChangeToSlot(7); //Step 3: SendCmdTo7000(0,"$00M",0); //Send command to COM0(Com port,command,Checksum=Disable) //For example: command="$00M" ===> Gets module name. //For detailed command sets,refer to //CD:\DCON\IO_Module\hw_dcon_on_87kUnit //Step 4: ReceiveResponseFrom7000_ms(0,InBufCom0,100,0); //COM port=0, //InBufCom0: Pointer of input buffer to receive response // from the 87K module, //Timeout=100ms, //Checksum=Disable //Step 5: Print("InBufCom0 = %s",InBufCom0); //Step 6: RestoreCom0(); }