📄 main.cpp
字号:
#include <conio.h> ; // kbhit.
#include "serial.h";
//#define TRANSMIT // now defined in Options|Compiler|Code generation|Defines
//#define RECEIVE // - DITTO -
SERIAL_PORT com1;
char * text= "hello there!!!";
#ifdef TRANSMIT
// simple transmit.
int main()
{
com1.activate(1); // hooks to com1.
com1.set_up_port(9600,8,'N',1); // setup port.
while (*text) {
com1<< *text++;
}
while (com1.output_buff_len()); // normally, this is not neccessary.
return 0;
}
#endif /* TRANSMIT */
#ifdef RECEIVE
int main()
{
int i= 0;
BYTE t;
com1.activate(1); // hooks to com1.
com1.set_up_port(9600,8,'N',1); // setup port.
while (text[i]&& (!kbhit())) {
if (com1>> t) {
putch(t);
if (t== text[i])
i++;
else
i= 0;
}
}
return 0;
}
#endif /* RECEIVE */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -