RS422 Programming Query


I am a newbie to QNX programming. I am supposed to program using RS422 port on QNX-4.25 . Related to this I have a few queries :

  1. I am using a ISA card for RS422 port. Are ISA cards supported in QNX 4.25 ?? if yes, how do i setup the card ?

  2. The card i am using is a custom made one, so i dont have any drivers for it. Is there any method to determine the base address of the port so that i can use inp() and outp() functions for data transfer.

In DOS i am using 0x140 as the base address for communication that is i am reading and writing data on to that address. I have used the same address in QNX, i am able to write the data( i verified the written value of outp) but i am unable to read the data.

I am pasting the code of the program i have written below :

char get_char()
unsigned char c;
unsigned int status=0;

while(((status=inp(0x142)) & 0x80) != 0x80);
c = inp(0x140);
printf("\n char %c has received", c);

void send_char(char ch)
unsigned int status = 0;
unsigned int ret;
while((status=inp(0x142))&0x40 != 0x40);
ret = outp(0x140,ch);
printf("\n char : %c transferred\n, ret");

void Init_UART()
// 82c52(UART) intialisations
outp(0x142,0x3c); // UART control register;
outp(0x146,0xfC); // data(baud) rate to 921.6 KHz
outp(0x144,0x23); // Modem Control Register(23H) add = 144H,


void main()
int count;
unsigned char TxData, RxData;



printf("\nEnter any character:");
TxData = getch();
printf("\n %c has received.\n",RxData);


} // end while;

}// end main

The while loop in get_char() loops infinitely and never comes out of the loop to print the character if i comment it inp() reads a NULL character.

The same program with some modifications i used it in DOS and it works fine even and there is no problem with the hardware.

I even tried writing to the port from one program and reading from another program but no use.

Thanking you in advance

I assume you have compile/link with -T1 and run the program as root

Also I beleive you should do

while( ( (status=inp(0x142))&0x40) != 0x40);

(why use status since it`s not used?)

A busy look like this on an operation system like QNX is really bad, you should avoid busy loop.

Thanks for the reply.

I did use -T1 there is no use, still the problem persists.