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

bridged with qdn.public.qnxrtp.applications
Post Reply
Belinda

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

Post by Belinda » Tue Apr 23, 2002 6:00 pm

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

Mario Charest

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

Post by Mario Charest » Tue Apr 23, 2002 7:14 pm

"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

Bob Bowler

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

Post by Bob Bowler » Thu Apr 25, 2002 12:37 am

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

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

Post by Marty Doane » Thu Apr 25, 2002 4:26 pm

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



Mario Charest

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

Post by Mario Charest » Thu Apr 25, 2002 5:18 pm

"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 ;-) 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





David Gibbs

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

Post by David Gibbs » Thu Apr 25, 2002 5:27 pm

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.

Alex Cellarius

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

Post by Alex Cellarius » Thu Apr 25, 2002 7:09 pm

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.

QNX

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

Post by QNX » Thu Apr 25, 2002 7:44 pm

"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 ;-) 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







Mario Charest

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

Post by Mario Charest » Fri Apr 26, 2002 12:37 am

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 ;-)

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

Post Reply

Return to “qdn.public.qnxrtp.applications”