User manual

PCI-ICM422/2(4) and 485/2(4) Manual
Page 5-4
Manual MPCI-ICM4S.F1b
The handler would first read the Interrupt Identification Register at Base Address +2. If the interrupt
is for Received Data Available, the handler then reads the data. If no interrupt is pending, control
exits the routine. A sample handler, written in C, is as follows:
readback = inportb(BASEADDR +2);
if (readback & 4) /*Readback will be set to 4 if data are available*/
data[i++]=inportb(BASEADDR);
outportb(0x20,0x20); /*Write EOI to 8259 Interrupt Controller*/
return;
Transmission
RS485 transmission is simple to implement. The AUTO feature of the PCI-ICM422/485 card
automatically enables the transmitter when data are ready to send. No software enabling is required.
The following C code fragment demonstrates this process:
while(data[i]); /*While there is data to send*/
{
while(!(inportb(BASEADDR +5)&0x20)); /*Wait until transmitter is empty*/
outportb(BASEADDR,data[i]);
i++;
}