📄 command.c
字号:
/****************************************
* command.c *
* Designe by 刘俐训 *
* check and excute command from host *
* last update: 04-07-2007 *
****************************************/
void command(void)
{
unsigned char i;
unsigned int len; // 通讯报文长度
unsigned char buf[316]; // 通讯、操作用临时数据缓冲
unsigned int rsplen;
if((len = CommRead(buf, sizeof(buf)-1)) > 0)
{
switch(buf[0]) // buf[0]: cmd target
{
case IC_M1:
M1Command(buf+1, len-1);
break;
case IC_SAM1:
case IC_SAM2:
case IC_SAM3:
case IC_USER:
TcCommand(buf, len);
break;
case SYSTEM:
SysCommand(buf+1, len-1);
default:
}
}
}
void Connect(unsigned int time)
{
unsigned int starttime;
unsigned char ch;
int i;
unsigned char tar;
bit freading = 0;
starttime = GetTickCount();
while(GetTickCount() - starttime < time)
{
// check serial port
if(ComIBufBytesTell() > 0)
{
// restart timer
starttime = GetTickCount();
// read
ComRead(&ch, 1);
// if ch is a command, do it
// else write ch to tar
}
if(freading && // ch = read from tar > 0)
{
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -