Looping Com3 Question

Started by jxpicciri2000 April 13, 2005


I would like to sample several different
serial input pins with Com3. Each pin has
a constant stream of bytes, which usually
repeats every three or so bytes and occasional
changes to a new sequence.

For example
line 1 (A, Byte1A, Byte2A, A, Byte1A, Byte2A, ...
line 2 (B, Byte1B, Byte2B, B, ...
etc.

How do I Byte1A, Byte2A, Byte1B, etc ? Is there
a problem with the input buffer having bytes left over
from a previous input ? Do I have to flush it every
time I switch input pins ?

Thanks,

John-




I would solve the multiplexing switching problem with hardware.
A reference design link is here.
http://www.elecdesign.com/Articles/ArticleID/6227/6227.html

See the figure in the link. Modify the circuit as required.
Ignore the rts switching and use the BX i/o pins instead.
If you are only receiving then you can use one max232 to multiplex
4 lines.
Note: they are using open collector nand gates for switching.
You will have to look at a reference sheet for the number of gates
that can be WIRED-OR together.

In the code I would flush the buffer after reading each input line
then select serial stream via bx hardware switching.

RR
--- In basicx@basi..., "jxpicciri2000" <jpicciri@r...> wrote:
>
>
> I would like to sample several different
> serial input pins with Com3. Each pin has
> a constant stream of bytes, which usually
> repeats every three or so bytes and occasional
> changes to a new sequence.
>
> For example
> line 1 (A, Byte1A, Byte2A, A, Byte1A, Byte2A, ...
> line 2 (B, Byte1B, Byte2B, B, ...
> etc.
>
> How do I Byte1A, Byte2A, Byte1B, etc ? Is there
> a problem with the input buffer having bytes left over
> from a previous input ? Do I have to flush it every
> time I switch input pins ?
>
> Thanks,
>
> John-




Thanks, I'll look into that hardware option.

Can anyone else give me a BasicX solution ?

Once Com3 is opened how is it closed; or how can
one stop data from coming into the buffer ?

Thanks,

John- --- In basicx@basi..., "raunig2003" <raunig2003@y...> wrote:
>
> I would solve the multiplexing switching problem with hardware.
> A reference design link is here.
> http://www.elecdesign.com/Articles/ArticleID/6227/6227.html
>
> See the figure in the link. Modify the circuit as required.
> Ignore the rts switching and use the BX i/o pins instead.
> If you are only receiving then you can use one max232 to multiplex
> 4 lines.
> Note: they are using open collector nand gates for switching.
> You will have to look at a reference sheet for the number of gates
> that can be WIRED-OR together.
>
> In the code I would flush the buffer after reading each input line
> then select serial stream via bx hardware switching.
>
> RR
> --- In basicx@basi..., "jxpicciri2000" <jpicciri@r...> wrote:
> >
> >
> > I would like to sample several different
> > serial input pins with Com3. Each pin has
> > a constant stream of bytes, which usually
> > repeats every three or so bytes and occasional
> > changes to a new sequence.
> >
> > For example
> > line 1 (A, Byte1A, Byte2A, A, Byte1A, Byte2A, ...
> > line 2 (B, Byte1B, Byte2B, B, ...
> > etc.
> >
> > How do I Byte1A, Byte2A, Byte1B, etc ? Is there
> > a problem with the input buffer having bytes left over
> > from a previous input ? Do I have to flush it every
> > time I switch input pins ?
> >
> > Thanks,
> >
> > John-




--- In basicx@basi..., "jxpicciri2000" <jpicciri@r...> wrote:
> Once Com3 is opened how is it closed?

See CloseCom(), the counterpart to OpenCom().

> how can one stop data from coming into the buffer ?

Data will cease being inserted into the receive queue in either of two
conditions:

1) the rx pin no longer receives a start bit from a serial stream
2) the Com port is closed