home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_07_08 / v7n8056a.txt < prev    next >
Text File  |  1989-09-29  |  1KB  |  44 lines

  1.  
  2. /* BOARDX.H  This board has the following features.
  3. -no initialization required
  4. -busy if high bit of EOC_BYTE is set to 1
  5. -lower byte stores least significant 4 bits of the result in the
  6. upper nibble, and most significant 8 bits of result in the high
  7. byte.
  8. */
  9.  
  10. #include <dos.h>
  11. #define BASE 0x280
  12. #define EOC_BYTE ( BASE + 2 )
  13. #define HIGH_BYTE BASE
  14. #define LOW_BYTE ( BASE + 1 )
  15. #define CH_SELECT (BASE + 1)
  16. #define initialize()
  17. #define select(channel) outportb(CH_SELECT,channel)
  18. #define start(channel) outportb(CH_SELECT, 0x80 | channel)
  19. #define wait_for_eoc() while( inportb( EOC_BYTE ) & 0x80 )
  20. #define convert()  (inportb(HIGH_BYTE) * 16 + ( inportb(LOW_BYTE) >> 4 ))
  21.  
  22. ----------------------------------------------------------------------------
  23.  
  24. /* BOARDY.H  This board has the following features.
  25. -initialization required
  26. -busy if high bit of EOC_BYTE is set to 0
  27. -lower byte stores least significant 8 bits of the result,and
  28. high byte stores the most significant 4 bits of the result in
  29. lower nibble.
  30. */
  31.  
  32. #define BASE 0x714
  33. #define STATUS (BASE + 2)
  34. #define EOC_BYTE (BASE + 2)
  35. #define CH_SELECT (BASE + 1) 
  36. #define HIGH_BYTE ( BASE + 2 )
  37. #define LOW_BYTE ( BASE + 1 )
  38. #define initialize() outp( BASE, 0x80 )
  39. #define select(channel) outp( CH_SELECT,channel )
  40. #define start(channel) outp( 0x716, 1 )
  41. #define wait_for_eoc() while( !( inp( EOC_BYTE) & 0x80 ))
  42. #define convert()  ( inp(HIGH_BYTE) * 256 + inp(LOW_BYTE) )
  43.  
  44.