📄 com.c
字号:
/*******************************
* AdiOS Com Port Example *
* For use with an echo device *
* com.c *
* 21-10-2001 *
*******************************/
// Entry point and kernel API defined here
#include "..\kernapi.h"
void * appmain(__int32 param)
{
long x; // Data written/read count
unsigned char C; // The character we will output
char InBuf[2]; // Input buffer
C = 64; // Set the character ready to be incremented
// Print the name of the program
PrintCR("Com port echo example.");
// I like my infinite loops :)
while(1){
// Increment the letter, and if it is beyond Z, set it back to A
if (++C == 91) C = 65;
// Write the letter to the com port
x = WriteCom(&C, 1);
if (x == 1){
// If it was written ok, read it back
x = ReadCom(InBuf, 1);
if(x == 1){
// If data was read ok, fix the string with a null zero
InBuf[1] = 0;
// Print it to the console
Print(InBuf);
//WriteCom(InBuf, 1);
} else Print("_");
} else Print(" ");
}
return 0; // Just to keep the compiler happy
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -