iVIEW-100 Series user’s Manual, 2006, v2.0 ----- 142
SendCmdTo7000()
Func.: Send command to I-7000 series.
Syntax:
int SendCmdTo7000(int iPort, unsigned char *cCmd, int iChksum);
Header: #include ”iVIEW.h”
Description:
If checksum is ‘enable’
, the function will add 2 bytes checksum on the end of
command.
iPort: 0/1/2/3/4 for COM0/1/2/3/4.
cCmd: Command to be send out (
DON'T add '\
SendCmdTo7000() will add check sum(if needed) & '\
after cCmd .
).
iChecksum: 1 for enable checksum, 0 for disable checksum.
On success return NoError. On fail return Error code (refer to 7000 series).
Example:
(7000.c)
#include <iVIEW.H>
#include <mmi100.H>
void main()
{ int port=2,quit=0,x;
char k;
InitLib();
InitLCD();
InstallCom(port,115200L,8,0,1); /*install COM for I-7065D*/
ClearCom(port);
SendCmdTo7000(port, "@0100", 0); /*send cmd to Do, all off*/
if(ReceiveResponseFrom7000(port,"@0100",1500,0))
Print("I-7065D is not available\r\n");
while(!quit) /*control Do*/
{ Print("\n\r enter 1~5 to set [Do] on...'9' to quit\n\r");
k=Getch();
x=ascii_to_hex(k); /*change ASCII code to hex*/
ClearCom(port);
switch(x) { /*send command to set I-7065D Do1~5 light on*/
case 1: /*for detail command refer to “I-7000 DIO manual”*/
SendCmdTo7000(port, "@0101", 0);Print("[%x]=ON",x);break;
case 2:
SendCmdTo7000(port, "@0102", 0); Print("[%x]=ON",x);break;
case 3:
SendCmdTo7000(port, "@0104", 0); Print("[%x]=ON",x);break;
case 4:
SendCmdTo7000(port, "@0108", 0); Print("[%x]=ON",x);break;
case 5:
SendCmdTo7000(port, "@0110", 0); Print("[%x]=ON",x);break;
case 9:
quit=1; Print("*quit*");break;
}//end of switch
}//end of while loop
CloseLCD();
}