read data from two ports of CIO-DIO24 at the same time

I’m doing the codes of reading data from CIO-DIO24. PORTA and PORT B is set
as input direction. I wanna implementation of reading data from two ports at
the same time. I don’t know to choose which way is better, to open two
processes, each of which is to read data from one port, or to open two
threads. Or could it be implemented in one thread?

Anyone could give me some suggestions.


Thanks,

Belinda

“Belinda” <yye@is2.dal.ca> wrote in message news:aa46vu$qs9$1@inn.qnx.com

I’m doing the codes of reading data from CIO-DIO24. PORTA and PORT B is
set
as input direction. I wanna implementation of reading data from two ports
at
the same time.

That’s impossible, unless you have two CPUS. Even if you would I still
think that’s impossible because the device can only handle one request
at a time.

I don’t know to choose which way is better, to open two
processes, each of which is to read data from one port, or to open two
threads. Or could it be implemented in one thread?

I would write it in a single thread/process. Reading the port is a single
instruction. Hence it’s extremely fast. There would be very little
benefinit from having multiple threads do this as the core of the code
“in8()” can’t run simultateously anyway.

Anyone could give me some suggestions.


Thanks,

Belinda

You can do a 16 bit ioread (in16)on the base address (PORT A) and you will
have two 8 bit values of PORT A & B in a 16bit word, effectively reading
both ports at the same time.

“Belinda” <yye@is2.dal.ca> wrote in message news:aa46vu$qs9$1@inn.qnx.com

I’m doing the codes of reading data from CIO-DIO24. PORTA and PORT B is
set
as input direction. I wanna implementation of reading data from two ports
at
the same time. I don’t know to choose which way is better, to open two
processes, each of which is to read data from one port, or to open two
threads. Or could it be implemented in one thread?

Anyone could give me some suggestions.


Thanks,

Belinda

Someone please correct me if I’m wrong here, but I thought ability to do 16
bit I/O was dependent on the I/O hardware. I’d be surprised if a CIO-DIO24
supports 16 bit I/O.

Marty Doane
Siemens Dematic

“Bob Bowler” <Bob.Bowler@RKBenterprises.com> wrote in message
news:aa7ih4$dkd$1@inn.qnx.com

You can do a 16 bit ioread (in16)on the base address (PORT A) and you will
have two 8 bit values of PORT A & B in a 16bit word, effectively reading
both ports at the same time.

“Belinda” <> yye@is2.dal.ca> > wrote in message
news:aa46vu$qs9$> 1@inn.qnx.com> …
I’m doing the codes of reading data from CIO-DIO24. PORTA and PORT B is
set
as input direction. I wanna implementation of reading data from two
ports
at
the same time. I don’t know to choose which way is better, to open two
processes, each of which is to read data from one port, or to open two
threads. Or could it be implemented in one thread?

Anyone could give me some suggestions.


Thanks,

Belinda
\

“Marty Doane” <marty.doane@rapistan.com> wrote in message
news:aa9a59$lso$1@inn.qnx.com

Someone please correct me if I’m wrong here, but I thought ability to do
16
bit I/O was dependent on the I/O hardware. I’d be surprised if a CIO-DIO24
supports 16 bit I/O.

If the two 8 bits registers are side by side, it would work. They would
however not be
read at the same time :wink: I beleive these chips have an 8 bits bus hence
the
cpu will in fact perform two consecutive 8 bit read.


Marty Doane
Siemens Dematic

“Bob Bowler” <> Bob.Bowler@RKBenterprises.com> > wrote in message
news:aa7ih4$dkd$> 1@inn.qnx.com> …
You can do a 16 bit ioread (in16)on the base address (PORT A) and you
will
have two 8 bit values of PORT A & B in a 16bit word, effectively
reading
both ports at the same time.

“Belinda” <> yye@is2.dal.ca> > wrote in message
news:aa46vu$qs9$> 1@inn.qnx.com> …
I’m doing the codes of reading data from CIO-DIO24. PORTA and PORT B
is
set
as input direction. I wanna implementation of reading data from two
ports
at
the same time. I don’t know to choose which way is better, to open two
processes, each of which is to read data from one port, or to open two
threads. Or could it be implemented in one thread?

Anyone could give me some suggestions.


Thanks,

Belinda


\

Bob Bowler <Bob.Bowler@rkbenterprises.com> wrote:

You can do a 16 bit ioread (in16)on the base address (PORT A) and you will
have two 8 bit values of PORT A & B in a 16bit word, effectively reading
both ports at the same time.

“Belinda” <> yye@is2.dal.ca> > wrote in message news:aa46vu$qs9$> 1@inn.qnx.com> …
I’m doing the codes of reading data from CIO-DIO24. PORTA and PORT B is
set
as input direction. I wanna implementation of reading data from two ports
at
the same time. I don’t know to choose which way is better, to open two
processes, each of which is to read data from one port, or to open two
threads. Or could it be implemented in one thread?

When you say two port, are you talking low level io-port, or are you
talking a higher-level source of incoming data type port?

And, when you say, at the same time, how simultaneous do you mean?

Unless you’re on SMP, you can’t do two things at the same time – you
can quickly alternate between them, or do them in quick succession, but
not at the same time.

Assuming we’re talking something like 2 data flows (analagous to
two serial ports), handling them both in the same process, and even
in a single-threaded process is probably quite acceptable.

But, without a better idea of what you really mean, it is hard to say
what is the best choice.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

On Thu, 25 Apr 2002 12:26:47 -0400, “Marty Doane” <marty.doane@rapistan.com> wrote:

Someone please correct me if I’m wrong here, but I thought ability to do 16
bit I/O was dependent on the I/O hardware. I’d be surprised if a CIO-DIO24
supports 16 bit I/O.

Agreed, and this is likely a 8255 compatible device, which only has 8 data bits.
In order to read two ports exactly at once, you will need some fancy
h/w to do this (something like 2 x 8255, with the one wired to the lower
8 data bits, and the other to the upper 8 data bits, and set to the
same addresses).

A better way would probably be to wire up your own latch to latch the
16 data bits on command, and then use the 8255 to read them at leasure.
Or wire up your own 16 bits h/w latch.

Anyway, based on the info available, this can’t be done in s/w.

“Mario Charest” <goto@nothingness.com> wrote in message
news:aa9d5u$nv6$1@inn.qnx.com

“Marty Doane” <> marty.doane@rapistan.com> > wrote in message
news:aa9a59$lso$> 1@inn.qnx.com> …
Someone please correct me if I’m wrong here, but I thought ability to do
16
bit I/O was dependent on the I/O hardware. I’d be surprised if a
CIO-DIO24
supports 16 bit I/O.

If the two 8 bits registers are side by side, it would work. They would
however not be
read at the same time > :wink: > I beleive these chips have an 8 bits bus hence
the
cpu will in fact perform two consecutive 8 bit read.

The registers on this card are side by side which is why the 16bit read
works, but you are absolutely correct in the fact that the cpu would perform
2 consecutive 8 bit reads. This is extremely fast but if not good enough for
the application then you would have to buy hardware with true 16 bit I/O.


Marty Doane
Siemens Dematic

“Bob Bowler” <> Bob.Bowler@RKBenterprises.com> > wrote in message
news:aa7ih4$dkd$> 1@inn.qnx.com> …
You can do a 16 bit ioread (in16)on the base address (PORT A) and you
will
have two 8 bit values of PORT A & B in a 16bit word, effectively
reading
both ports at the same time.

“Belinda” <> yye@is2.dal.ca> > wrote in message
news:aa46vu$qs9$> 1@inn.qnx.com> …
I’m doing the codes of reading data from CIO-DIO24. PORTA and PORT B
is
set
as input direction. I wanna implementation of reading data from two
ports
at
the same time. I don’t know to choose which way is better, to open
two
processes, each of which is to read data from one port, or to open
two
threads. Or could it be implemented in one thread?

Anyone could give me some suggestions.


Thanks,

Belinda




\

The registers on this card are side by side which is why the 16bit read
works, but you are absolutely correct in the fact that the cpu would
perform
2 consecutive 8 bit reads. This is extremely fast (

well on an ISA bus it’s not that fast :wink:


but if not good enough for
the application then you would have to buy hardware with true 16 bit I/O.