need help with a C code(RS 232 COM)

Thread Starter

indianhits

Joined Jul 25, 2009
86
Hello guys i need help in understand this code which i found in the web

Rich (BB code):
#include <bios.h>
        #include <conio.h>
        #define COM1               0
        #define DATA_READY          0x100 
         #define SETTINGS (          0x80 | 0x02          | 0x00 |         0x00)
        int main(void)
        {
   int in, out, status;
   bioscom(0, SETTINGS, COM1);         /*initialize the port*/
   cprintf("Data sent to you:  ");
   while (1)
   {
      status = bioscom(3,         0, COM1); /*wait           until get a data*/
      if (status &           DATA_READY)
           if ((out = bioscom(2,         0, COM1) & 0x7F)           != 0)  /*input  a          data*/
                       putch(out);
           if (kbhit())
           {
                      if ((in =  getch()) ==         27)   /*          ASCII of Esc*/
                         break;
                       bioscom(1, in,  COM1);           /*output a data*/
           }
   }
   return 0;
        }
i need help in this
Rich (BB code):
status = bioscom(3,          0, COM1); /*wait            until get a data*/
      if (status &           DATA_READY)
           if ((out = bioscom(2,         0, COM1) & 0x7F)           != 0)  /*input   a          data*/
                       putch(out);
what does these mean like what is the use of data ready 0X100
and 0X7F

please help me.Thanks!
 
Top