AX10445 Module Series User's Manual
int i;
unsigned pa;
/* select port */
if (ch= =1) pa = CH1_PA;
else if (ch= =2) pa = CH2_PA;
else return;
/* is 485 turn on send driver */
if (Is_RS485) outporb(pa+MCR,0x0a);
/* loop to write string data */
i = 0;
while (i < wlen)
{
/* check Transmit Holding Register Empty, if ok then write data
* /
while ((inportb(pa+LSR) & 0x40) == 0);
/* wait a moment if needed */
/* write data to Data Register */
outportb(pa,data[i]);
i + + ;
}
/ * is 485 turn off send driver */
while ((inportb(pa+LSR) & 0x40) == 0) ;
if (Is_RS485) outportb(pa+MCR,0x08);
/* wait for Transmit Holding Register Empty if needed then return
while ((inportb(pa+LSR) & 0x40) == 0) ; */
}
/* interrupt service routine for channel 1 */
void interrupt far CH1_ISR()
{
register int int_id;
enable();
while (1)
{
int_id = inportb(CH1_PA+IIR);
if ((int_id&1) == 1)
{
outportb(0x20,0x20);
30
/* no interrupt pending */
/* send EOI */
Application
Need help?
Do you have a question about the AX10445 Series and is the answer not in the manual?
Questions and answers