}
else {
oldch = getvect(intno);
setvect(intno,CH2_ISR);
}
/* set Interrupt Enable Register,only enable Receive Data Available
interrupt */
outportb(pa+IER,0x01);
/* set modem control register, only set OUT2 to enable interrupt */
outportb(pa+MCR,0x08);
/* unmask PC 8259 interrupt controller */
outportb(0x21, inportb(0x21)&mask);
enable();
}
/* send a byte */
void Write1_Com(int ch, unsigned char data)
{
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) outportb (pa+MCR,0x0a);
/* 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);
/* 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) ; */
}
/* sned a string of data */
void Write_Com(int ch, char *data, int wlen)
{
Application
AX10445 Module Series User's Manual
29
Need help?
Do you have a question about the AX10445 Series and is the answer not in the manual?
Questions and answers