help needed by novice on serial programming in qnx

hi,
I am a newbie to QNX. I want to know if someone knows of a routine where i can do the following. I am collecting data remotely from a AD/DA board attached to a QNX machine

  • read the serial port for incoming remote command.
  • compare it with given options
  • if the command is collect data, collect the latest numerical value stored in a memory location(buffer) and write it to the serail port.

The AD/DA code is already running. it will be storing values in a buffer. All I need is somehow transfer the value via serial port eerytime its asked to. the command to collect will be sent remotely every 1/2 second or 1 sec

thanks

Open the device, set it to raw mode and read/write it. Take a look at Stevens book “Advanced Programming in the UNIX Environment”.

what do u mean by raw mode?

A pupil is best taught by examples. Any exmaples u are aware of that I might look at
I do not know device programming at all in QNX

I also forgot to mention that the receiving side is always looking for incoming data. That is, I am looking for event driven or a polled solution.

the serial port is constantly looking for the data. when it receive data, it compares and if the collection request is made, it just write the latest value out the serial port

I can figure out the read and write parts, just need help with event driven part where the serial port is always looking for incoming

Not always, an example is very shallow, it doesn’t explain such concept as raw mode, what is raw mode, why it exists. In most cases it turns people into xerox machinem blindly cutting and pasting :wink:

Read a BOOK :wink:

That’s not QNX specific , this is generic UNIX stuff.