[C] 串行I/O通信 →→→→→进入此内容的聊天室

来自 , 2019-12-20, 写在 C, 查看 105 次.
URL http://www.code666.cn/view/5249ee8e
  1. #include <bios.h>
  2. #include <conio.h>
  3.  
  4. #define COM1       0
  5. #define DATA_READY 0x100
  6. #define TRUE       1
  7. #define FALSE      0
  8.  
  9. #define SETTINGS ( 0x80 | 0x02 | 0x00 | 0x00)
  10.  
  11. int main ( void )
  12. {
  13.         int in, out, status, DONE = FALSE;
  14.  
  15.         bioscom ( 0, SETTINGS, COM1 );
  16.         cprintf ( "... BIOSCOM [ESC] to exit ...\n" );
  17.         while ( !DONE )
  18.         {
  19.                 status = bioscom ( 3, 0, COM1 );
  20.                 if ( status & DATA_READY )
  21.                         if ( ( out = bioscom ( 2, 0, COM1 ) & 0x7F ) != 0 )
  22.                                 putch ( out );
  23.                 if ( kbhit() )
  24.                 {
  25.                         if ( ( in = getch() ) == '\x1B' )
  26.                                 DONE = TRUE;
  27.                         bioscom ( 1, in, COM1 );
  28.                 }
  29.         }
  30.         return 0;
  31. }

回复 "串行I/O通信"

这儿你可以回复上面这条便签

captcha