Sensoray 518 User Manual

Page 16

Advertising
background image

15

/******************************** C DRIVERS ****************************/

/* ADSENDBYTE handshakes a command byte to the 518 command register */
void adSendByte ( short base_port, short cmd_byte )

{
while ( ( inp( base_port + 1 ) & 128 ) == 0 ) ;
/* wait for CRMT */
outp ( base_port, cmd_byte ) ;/* send the byte */
}
/* ADREADBYTE handshakes a data byte from the 518 data register */
short adReadByte ( short base_port )
{
while ( ( inp ( base_port + 1 ) & 64 ) == 0 ) ; /* wait for DAV */
return ( inp ( base_port ) ) ; /* read the byte */
}
/* ADSENDWORD handshakes a 16-bit value to the 518 */
void adSendByte ( short base_port, short cmd_word )
{
adSendByte ( base_port, cmd_word >> 8 ) ; /* send high byte */
adSendByte ( base_port, cmd_word ) ; /* send low byte */
}
/* ADREADWORD handshakes a data byte from the 518 */
short adReadWord ( short base_port )
{
short hiByte = adReadByte ( base_port ) << 8 ; /* read high byte */
return ( hiByte | adReadByte ( base_port ) ) ; /* read & concatenate low byte */
}


Advertising