Access PCI-COM422/4 Computer Hardware User Manual


 
PCI-COM422/4 Manual
Page 5-4
Manual MPCICOM422-4.E1b
Transmission
RS422 transmission is simple to implement. The AUTO feature of the PCI-COM422/4 card
automatically enables the transmitter when data is ready to send so no software enabling is required.
The following software example is for non-AUTO operation.
To transmit a string of data, the transmitter must first check Bit 5 of the Line Status Register at Base
Address +5. That bit is the transmitter-holding-register-empty flag. If it is high, the transmitter has
sent the data. The process of checking the bit until it goes high followed by a write is repeated until
no data remains.
The following C code fragment demonstrates this process:
outportb(BASEADDR +4, inportb(BASEADDR +4)|0x02);
/*Set RTS bit without altering states of other bits*/
while(data[i]); /*While there is data to send*/
{
while(!(inportb(BASEADDR +5)&0x20)); /*Wait until transmitter is empty*/
outportb(BASEADDR,data[i]);
i++;
}
outportb(BASEADDR +4, inportb(BASEADDR +4)&0xFD);
/*Reset RTS bit without altering states of other bits*/