#include #include int main() /*use Windows Hyper Terminal*/ { int quit=0; int x=1, y=2,x2=1,y2=6; uchar c2,c[2]={0,0}; InitLib(); InitLCD(); SetComPortBufferSize_1(160,160); SetComPortBufferSize_2(160,160); RestoreCom1(); InstallCom1(19200, 8,0,1); LcdSetCursorOn(); /* Display cursor */ TextOutAt(1, 1, "---Q for quit---"); TextOutAt(1, 5, "----Receive-----"); ClearCom_1(); while(!quit) { SetCursorAt(x, y); if(Kbhit()) { c[0]=Getch(); ToCom1((int)c[0]); LcdPrintfAt(x, y, c); x++; if (x>16) { y++;x=1; TextOutAt(x, y, " "); ToCom1('\r'); ToCom1('\n'); } if (y>4) { TextOutAt(1, 2, " "); TextOutAt(1, 5, "----Receive-----"); x=1;y=2; } if (c[0]=='q' || c[0]=='Q') quit=1; } if (IsCom_1()) { c2=ReadCom1(); ToCom1(c2); TextOutAt(x2, y2, (char *)&c2); x2++; if (x2>16) { y2++;x2=1; TextOutAt(x2,y2, " "); ToCom1('\r'); ToCom1('\n'); } if (y2>8) {TextOutAt(1, 6, " ");x2=1;y2=6;} if (c2=='q' || c2=='Q') quit=1; } } CloseLCD(); return 0; }