home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 September / Simtel20_Sept92.cdr / msdos / turbo_c / com_int.arc / COMINT.DOC < prev    next >
Text File  |  1987-09-05  |  6KB  |  123 lines

  1.        ****************************************************************
  2.  
  3.                              COMMUNICATION INTERRUPTS
  4.  
  5.                                 September 5th, 1987
  6.  
  7.                                    By Dale Loftis
  8.  
  9.        ****************************************************************
  10.  
  11. This archive should contain the following files:
  12.  
  13.         COMINT.C                Test program and queue routines.
  14.         COMINT.PRJ              Turbo C project link list.
  15.         INT3.ASM                COM 2 interrupt assembly language routines.
  16.         INT4.ASM                COM 1 interrupt assembly language routines.
  17.  
  18.        ****************************************************************
  19.  
  20. After finding a need for RS232 interrupt routines and not being able to locate
  21. anything suitable on any BB's, I decided to write these routines and put them
  22. on the service for others.
  23.  
  24. The INT3 and INT4 routines are the real heart of the routines as they place
  25. the incoming and outgoing characters in the proper places.
  26.  
  27. I have succesfully run programs using these routines up to 9600 baud on a AT
  28. and had no problems with losing characters.
  29.  
  30. If you decide to alter these routines be aware that using INTerrupts to place
  31. the characters in queues like these routines do,  it is imperative that you
  32. act upon the characters by bumping the appropriate pointers depending on 
  33. whether your transmitting or receiving.
  34.  
  35.        ****************************************************************
  36.  
  37. com1_set_interrupt(parameters);  initializes port and sets interrupt vector
  38. com2_set_interrupt(parameters);  initializes port and sets interrupt vector
  39.  
  40. com1_restore_interrupt();   restores interrupt vector in disables interrupts
  41. com2_restore_interrupt();   restores interrupt vector in disables interrupts
  42.  
  43.        ****************************************************************
  44.  
  45. The com_status() routine displays the status of the program as it runs on the
  46. line 24 of the screen and is formatted as follows:
  47.  
  48.       aaaa - bbbb   cccc - dddd  ee  ff  gggg - hhhh  iiii - jjjj  kk  ll
  49.  
  50. where -
  51.                                  RECEIVE
  52.    aaaa =  *   COM 1 in  queue pointer   (count of characters received)
  53.    bbbb =  *   COM 1 out queue pointer   (count of received chars acted upon)
  54.  
  55.                                 TRANSMIT
  56.    cccc =  *   COM 1 in  queue pointer   (count of chars to be transmitted)
  57.    dddd =  *   COM 1 out queue pointer   (count of chars that were transmitted)
  58.  
  59.                                INT STATUS
  60.     ee  =      COM 1 last interrupt status
  61.                     00 = modem status interrupt
  62.                     01 = xmit holding register empty interrupt
  63.                     02 = data received interrupt
  64.                     03 = reception error interrupt
  65.  
  66.                                PORT STATUS
  67.     ff  =      COM 1 modem status register status
  68.                     bit 7   1 = "data carrier detect"
  69.                     bit 6   1 = "ring indicator"
  70.                     bit 5   1 = "data set ready"
  71.                     bit 4   1 = "clear to send"
  72.                     bit 3   1 = change in "data carrier detect"
  73.                     bit 2   1 = change in "ring indicator"
  74.                     bit 1   1 = change in "data set ready"
  75.                     bit 0   1 = change in "clear to send"
  76.  
  77.        ****************************************************************
  78.  
  79.                                 RECEIVE
  80.    gggg =  *   COM 2 in  queue pointer   (count of characters received)
  81.    hhhh =  *   COM 2 out queue pointer   (count of received chars acted upon)
  82.  
  83.                                 TRANSMIT
  84.    iiii =  *   COM 2 in  queue pointer   (count of chars to be transmitted)
  85.    jjjj =  *   COM 2 out queue pointer   (count of chars that were transmitted)
  86.  
  87.                                INT STATUS
  88.     kk  =      COM 2 last interrupt status
  89.                     00 = modem status interrupt
  90.                     01 = xmit holding register empty interrupt
  91.                     02 = data received interrupt
  92.                     03 = reception error interrupt
  93.  
  94.                                PORT STATUS
  95.     ll  =      COM 2 modem status register status
  96.                     bit 7   1 = "data carrier detect"
  97.                     bit 6   1 = "ring indicator"
  98.                     bit 5   1 = "data set ready"
  99.                     bit 4   1 = "clear to send"
  100.                     bit 3   1 = change in "data carrier detect"
  101.                     bit 2   1 = change in "ring indicator"
  102.                     bit 1   1 = change in "data set ready"
  103.                     bit 0   1 = change in "clear to send"
  104.  
  105.        ****************************************************************
  106.         Items marked with a "*" are the actual offsets into the xmit and 
  107.      receive queues and wrap back to zero when the queue sizes are reached.
  108.        ****************************************************************
  109.  
  110. The variables com1_rs232_error and com2_rs232_error contain the status from a
  111. reception error interrupt and is the line status register, formatted as:
  112.  
  113.                     bit 7   1 = time-out (off-line)
  114.                     bit 6   1 = xmit shift register empty
  115.                     bit 5   1 = xmit holding register empty
  116.                     bit 4   1 = break detect
  117.                     bit 3   1 = framing error (transmission is out of sync)
  118.                     bit 2   1 = parity error
  119.                     bit 1   1 = received data overrun (char not read in time)
  120.                     bit 0   1 = byte of data has been received
  121.  
  122.        ****************************************************************
  123.