receive interrupt from keyboard

Hi,

I am simulating the enviornment like this. Two threads are running, one
is reading data from serial port while another one is receiving interrupt
from keyboard. During interrupt, the program will do some work else. After
finish,
one thread will continuously read data. I’m wondering how to write it,
specially how to write receive interrupt in one thread with
InterruptAttach(…) and
the part of event of interrupt handler. Can I get some examples on it?

Thanks,

Belinda

Hi Belinda

If you check the link for the on-line docs it shows an example of how to
write and interrupt handler

http://qdn.qnx.com/support/docs/neutrino_2.11_en/prog/inthandler.html

Hope this helps
Regards
Brenda

Belinda wrote:

Hi,

I am simulating the enviornment like this. Two threads are running, one
is reading data from serial port while another one is receiving interrupt
from keyboard. During interrupt, the program will do some work else. After
finish,
one thread will continuously read data. I’m wondering how to write it,
specially how to write receive interrupt in one thread with
InterruptAttach(…) and
the part of event of interrupt handler. Can I get some examples on it?

Thanks,

Belinda


\

Belinda wrote:

Hi,

I am simulating the enviornment like this. Two threads are running, one
is reading data from serial port while another one is receiving interrupt
from keyboard. During interrupt, the program will do some work else. After
finish,
one thread will continuously read data. I’m wondering how to write it,
specially how to write receive interrupt in one thread with
InterruptAttach(…) and
the part of event of interrupt handler. Can I get some examples on it?

I would recommend that you use InterruptAttachEvent, and InterruptWait
in the “keyboard” thread (I am assuming that your keyboard is custom and
edge triggered).

If your keyboard device generates level sensitive interrupts, then you
could attach a small handler (to clear the interrupt source), and return
a pulse which your “keyboard” thread would service (actually there is no
reason why you would need a dedicated “keyboard” thread if you do things
this way).

Rennie