📄 main.c
字号:
/* 本程序写于2004年9月23日凌晨2点
作者:孙尚新
联系方式: 2818709199 sunshangxin@hotmail.com */
#include <command.h>
main()
{
unsigned char ch;
long i;
unsigned char str[100],key;
int num_commands;
char command[MAX_CMD_LEN];
InitSerial();
InitSerialBuffer();
clrscr();
PrintStr("Crystal is ");
i = CRYSTAL;
for(ch = 0;ch<8;ch++)
{
str[7-ch] = ('0'+i%10);
i = i/10;
}
str[8] = (unsigned char)0;
PrintStr(str);
PrintStr("\r\n");
PrintStr("Serial is ");
i = SERBAUD;
for(ch = 0;ch<6;ch++)
{
str[5-ch] = ('0'+i%10);
i = i/10;
}
str[6] = (unsigned char)0;
PrintStr(str);
PrintStr("\n");
PrintStr("\r\n");
prompt();
i = 0;
for(;;)
{
while(!getch(&key));
if(key == BACK_KEY)
{
if(i>=1)
{
i -= i?1:0;
PrintChar(key);
PrintChar(' ');
PrintChar(key);
}
}
else if(key == ENTER_KEY)
{
command[i] = 0;
PrintChar('\r');
PrintChar('\n');
num_commands = ParseCmd(command, i);
if(num_commands<0)
{
PrintStr("Erroe Command......\r\n");
prompt();
}
else
{
prompt();
}
i = 0;
}
else
{
if(i<MAX_CMD_LEN-1)
{
command[i++] = key;
PrintChar(key);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -