Flow control simulation with RTS and CTS
Archiver
Posts: 46,084
Does anyone know how SERIN/SEROUT with flow control can be simulated
with industry standard RTS and CTS signals for RS-232?
I am trying to have a BS2 communicate to another BS2 via MAX3110 (SPI
UART), but find that receiving BS2 is seeing multiple characters for
each transmitted character.
I think I need some sort of hand-shaking to eliminate multiple
reception.
with industry standard RTS and CTS signals for RS-232?
I am trying to have a BS2 communicate to another BS2 via MAX3110 (SPI
UART), but find that receiving BS2 is seeing multiple characters for
each transmitted character.
I think I need some sort of hand-shaking to eliminate multiple
reception.
Comments
find it on our web site. Look in:
Downloads >> Nuts & Volts Columns >> Volume #3 >> Article #89
-- Jon Williams
-- Parallax
Original Message
From: yellowniter [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=AXfC9jGA2YXWkWxZ2NVr_WUKTpBetfKKhxmn6nmOnfK8UhY8_GkFGmpsxmgug1TC22xWCzXaxGZkwLajB2A_]yellowniter@y...[/url
Sent: Friday, June 27, 2003 10:04 AM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] Flow control simulation with RTS and CTS
Does anyone know how SERIN/SEROUT with flow control can be simulated
with industry standard RTS and CTS signals for RS-232?
I am trying to have a BS2 communicate to another BS2 via MAX3110 (SPI
UART), but find that receiving BS2 is seeing multiple characters for
each transmitted character.
I think I need some sort of hand-shaking to eliminate multiple
reception.
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject
and Body of the message will be ignored.
Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
This message has been scanned by WebShield. Please report SPAM to
abuse@p....
I'm not sure if I can use it because I'm using SHIFTIN/SHIFTOUT
commands to send character from first BS2 to MAX3110 (in trasmitter)
and SHIFTIN/SHIFTOUT to receive from another MAX3110 to another BS2.
Since I'm not using SERIN/SEROUT, I cannot use the tradtional SERIN
with flow control.
I want to simulate flow control with extra pins on Stamp.
Can this be done?
--- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
wrote:
> I did an article on flow-control for serial IO in Nuts & Volts.
You can
> find it on our web site. Look in:
>
> Downloads >> Nuts & Volts Columns >> Volume #3 >> Article #89
>
> -- Jon Williams
> -- Parallax
>
>
>
>
Original Message
> From: yellowniter [noparse][[/noparse]mailto:yellowniter@y...]
> Sent: Friday, June 27, 2003 10:04 AM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] Flow control simulation with RTS and CTS
>
>
> Does anyone know how SERIN/SEROUT with flow control can be
simulated
> with industry standard RTS and CTS signals for RS-232?
>
> I am trying to have a BS2 communicate to another BS2 via MAX3110
(SPI
> UART), but find that receiving BS2 is seeing multiple characters
for
> each transmitted character.
>
> I think I need some sort of hand-shaking to eliminate multiple
> reception.
>
>
>
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
Subject
> and Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
>
>
> This message has been scanned by WebShield. Please report SPAM to
> abuse@p...
levels, as was suggested by Allan in an earlier post.
-- Jon Williams
-- Parallax
Original Message
From: yellowniter [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=_rHZlVHD6_zrnkWwJYzNcGEbn2k-D8Ds6AKfHBpBt_3v00g13tOJgDegb9RUsM5ZM_xLJL4VYvsrvdI]yellowniter@y...[/url
Sent: Friday, June 27, 2003 11:31 AM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] Re: Flow control simulation with RTS and CTS
Mr. William, I quickly scanned that article.
I'm not sure if I can use it because I'm using SHIFTIN/SHIFTOUT
commands to send character from first BS2 to MAX3110 (in trasmitter)
and SHIFTIN/SHIFTOUT to receive from another MAX3110 to another BS2.
Since I'm not using SERIN/SEROUT, I cannot use the tradtional SERIN
with flow control.
I want to simulate flow control with extra pins on Stamp.
Can this be done?
--- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
wrote:
> I did an article on flow-control for serial IO in Nuts & Volts.
You can
> find it on our web site. Look in:
>
> Downloads >> Nuts & Volts Columns >> Volume #3 >> Article #89
>
> -- Jon Williams
> -- Parallax
>
>
>
>
Original Message
> From: yellowniter [noparse][[/noparse]mailto:yellowniter@y...]
> Sent: Friday, June 27, 2003 10:04 AM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] Flow control simulation with RTS and CTS
>
>
> Does anyone know how SERIN/SEROUT with flow control can be
simulated
> with industry standard RTS and CTS signals for RS-232?
>
> I am trying to have a BS2 communicate to another BS2 via MAX3110
(SPI
> UART), but find that receiving BS2 is seeing multiple characters
for
> each transmitted character.
>
> I think I need some sort of hand-shaking to eliminate multiple
> reception.
>
>
>
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
Subject
> and Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
>
>
> This message has been scanned by WebShield. Please report SPAM to
> abuse@p...
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject
and Body of the message will be ignored.
Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
This message has been scanned by WebShield. Please report SPAM to
abuse@p....
Mr. Lane! (And also thanks to Mr. Tracy Allen and Al Williams.)
However, the only part I was able to glean from Mr. Lane's message
was WriteConfig, WriteData, and ReadData.
Mr. Lane, if you are reading this, could you please advise how
you "bit banged" to ReadConfig?
In addition, does anyone know where I can find good info. (i.e.
protocol) on how hand-shaking is done via RTC and CTS?
--- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
wrote:
> You are certainly free to use HIGH and LOW to adjust flow-control
pin
> levels, as was suggested by Allan in an earlier post.
>
> -- Jon Williams
> -- Parallax
>
>
>
Original Message
> From: yellowniter [noparse][[/noparse]mailto:yellowniter@y...]
> Sent: Friday, June 27, 2003 11:31 AM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] Re: Flow control simulation with RTS and CTS
>
>
> Mr. William, I quickly scanned that article.
> I'm not sure if I can use it because I'm using SHIFTIN/SHIFTOUT
> commands to send character from first BS2 to MAX3110 (in
trasmitter)
> and SHIFTIN/SHIFTOUT to receive from another MAX3110 to another BS2.
> Since I'm not using SERIN/SEROUT, I cannot use the tradtional SERIN
> with flow control.
>
> I want to simulate flow control with extra pins on Stamp.
>
> Can this be done?
>
> --- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
> wrote:
> > I did an article on flow-control for serial IO in Nuts & Volts.
> You can
> > find it on our web site. Look in:
> >
> > Downloads >> Nuts & Volts Columns >> Volume #3 >> Article #89
> >
> > -- Jon Williams
> > -- Parallax
> >
> >
> >
> >
Original Message
> > From: yellowniter [noparse][[/noparse]mailto:yellowniter@y...]
> > Sent: Friday, June 27, 2003 10:04 AM
> > To: basicstamps@yahoogroups.com
> > Subject: [noparse][[/noparse]basicstamps] Flow control simulation with RTS and CTS
> >
> >
> > Does anyone know how SERIN/SEROUT with flow control can be
> simulated
> > with industry standard RTS and CTS signals for RS-232?
> >
> > I am trying to have a BS2 communicate to another BS2 via MAX3110
> (SPI
> > UART), but find that receiving BS2 is seeing multiple characters
> for
> > each transmitted character.
> >
> > I think I need some sort of hand-shaking to eliminate multiple
> > reception.
> >
> >
> >
> >
> >
> > To UNSUBSCRIBE, just send mail to:
> > basicstamps-unsubscribe@yahoogroups.com
> > from the same email address that you subscribed. Text in the
> Subject
> > and Body of the message will be ignored.
> >
> >
> > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/
> >
> >
> >
> >
> > This message has been scanned by WebShield. Please report SPAM to
> > abuse@p...
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the
Subject
> and Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>
>
>
> This message has been scanned by WebShield. Please report SPAM to
> abuse@p...
There is a distinction between DTE (data terminal equipment, e.g. a
computer) and DCE (data communication equipment, e.g. a modem, or a radio
that can module data onto a carrier). The RTS and CTS signals flow from one
to the other in opposite direction (I forget which is which). Each signal
required one conductor between the equipments, and one pin for each signal
on both. In any event, the equipment that wants to send data (the sender) to
a receiver raises the RTS line saying "I want to transmit data", then waits
until the receiver senses this, becomes ready to receive, then raises CTS to
say "OK, go ahead and send it!". The sender senses the CTS going high, and
then send the data.
Ideally, at any time, the receiver can lower the CTS line to pause the
sender's transmission (this could be because a buffer is full, or it may
take a short time to process the data just received before more data can be
received). The sender should then wait until CTS goes high again. This might
not happen, so the sender should include a timeout so that is the CTS line
does not go high within a specified amount of time, the process will halt.
Once the sender is done sending data, it should drop the RTS line low,
showing the receiver that it's now able to go on doing whatever it needs to
do.
Steve
Original Message
From: "yellowniter" <yellowniter@y...>
To: <basicstamps@yahoogroups.com>
Sent: Friday, June 27, 2003 7:08 PM
Subject: [noparse][[/noparse]basicstamps] Re: Flow control simulation with RTS and CTS
> Yes, I did use what Mr. Allan Lane suggested. Thank you very much
> Mr. Lane! (And also thanks to Mr. Tracy Allen and Al Williams.)
> However, the only part I was able to glean from Mr. Lane's message
> was WriteConfig, WriteData, and ReadData.
> Mr. Lane, if you are reading this, could you please advise how
> you "bit banged" to ReadConfig?
>
> In addition, does anyone know where I can find good info. (i.e.
> protocol) on how hand-shaking is done via RTC and CTS?
>
>
>
> --- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
> wrote:
> > You are certainly free to use HIGH and LOW to adjust flow-control
> pin
> > levels, as was suggested by Allan in an earlier post.
> >
> > -- Jon Williams
> > -- Parallax
> >
> >
> >
Original Message
> > From: yellowniter [noparse][[/noparse]mailto:yellowniter@y...]
> > Sent: Friday, June 27, 2003 11:31 AM
> > To: basicstamps@yahoogroups.com
> > Subject: [noparse][[/noparse]basicstamps] Re: Flow control simulation with RTS and CTS
> >
> >
> > Mr. William, I quickly scanned that article.
> > I'm not sure if I can use it because I'm using SHIFTIN/SHIFTOUT
> > commands to send character from first BS2 to MAX3110 (in
> trasmitter)
> > and SHIFTIN/SHIFTOUT to receive from another MAX3110 to another BS2.
> > Since I'm not using SERIN/SEROUT, I cannot use the tradtional SERIN
> > with flow control.
> >
> > I want to simulate flow control with extra pins on Stamp.
> >
> > Can this be done?
> >
> > --- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
> > wrote:
> > > I did an article on flow-control for serial IO in Nuts & Volts.
> > You can
> > > find it on our web site. Look in:
> > >
> > > Downloads >> Nuts & Volts Columns >> Volume #3 >> Article #89
> > >
> > > -- Jon Williams
> > > -- Parallax
> > >
> > >
> > >
> > >
Original Message
> > > From: yellowniter [noparse][[/noparse]mailto:yellowniter@y...]
> > > Sent: Friday, June 27, 2003 10:04 AM
> > > To: basicstamps@yahoogroups.com
> > > Subject: [noparse][[/noparse]basicstamps] Flow control simulation with RTS and CTS
> > >
> > >
> > > Does anyone know how SERIN/SEROUT with flow control can be
> > simulated
> > > with industry standard RTS and CTS signals for RS-232?
> > >
> > > I am trying to have a BS2 communicate to another BS2 via MAX3110
> > (SPI
> > > UART), but find that receiving BS2 is seeing multiple characters
> > for
> > > each transmitted character.
> > >
> > > I think I need some sort of hand-shaking to eliminate multiple
> > > reception.
> > >
> > >
> > >
> > >
> > >
> > > To UNSUBSCRIBE, just send mail to:
> > > basicstamps-unsubscribe@yahoogroups.com
> > > from the same email address that you subscribed. Text in the
> > Subject
> > > and Body of the message will be ignored.
> > >
> > >
> > > Your use of Yahoo! Groups is subject to
> > > http://docs.yahoo.com/info/terms/
> > >
> > >
> > >
> > >
> > > This message has been scanned by WebShield. Please report SPAM to
> > > abuse@p...
> >
> >
> > To UNSUBSCRIBE, just send mail to:
> > basicstamps-unsubscribe@yahoogroups.com
> > from the same email address that you subscribed. Text in the
> Subject
> > and Body of the message will be ignored.
> >
> >
> > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/
> >
> >
> >
> >
> > This message has been scanned by WebShield. Please report SPAM to
> > abuse@p...
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
the write data command, and a CTS pin that is read in as part of the
read data command. The chip also has an IRQ pin that can be
activated in response to a number of conditions, including the
arrival of data into the receive fifo. That could be used to signal
the arrival of data to the Stamp so that it could service the UART.
Also, the current status of the receive buffer (empty or not) appears
on the data line out from the chip as soon as you bring chip select
low, so you don't even have to clock the chip to retrieve that bit of
information. This article: <http://www.emesystems.com/BS2IrDA>
includes control of RTS and read of the CTS line--in the circuit
shown, CTS is connected to a pushbutton, not to another Stamp, and
RTS controls an LED. I don't see much need to read the CONFIG
register. I think in most BASIC Stamp apps, you will write to it and
that's that.
To read the CONFIG it is true you would have to bit bang the first
two bits of the command (01), but the remaining 14 bits could be
retrieved with a shiftin. It is not necessary to bit-bang the read
data command, because the command is 00, so all you have to do is
leave the Din line low while you execute SHIFTIN.
The UART itself does not do any automatic handshaking or flow control
using its RTC/ETS lines. That is up to your program.
How RTC and CTS are used for flow control depends enormously on how
your system is set up. Master-slave, peer to peer etc. Here
scenarios that might be of interest to you.
<http://www.emesystems.com/BS2rs232.htm>.
You mentioned "multiple reception". I don't know what you mean by that.
-- regards
Tracy Allen
electronically monitored ecosystems
http://www.emesystems.com
mailto:tracy@e...
>Yes, I did use what Mr. Allan Lane suggested. Thank you very much
>Mr. Lane! (And also thanks to Mr. Tracy Allen and Al Williams.)
>However, the only part I was able to glean from Mr. Lane's message
>was WriteConfig, WriteData, and ReadData.
>Mr. Lane, if you are reading this, could you please advise how
>you "bit banged" to ReadConfig?
>
>In addition, does anyone know where I can find good info. (i.e.
>protocol) on how hand-shaking is done via RTC and CTS?
>
>
>
>--- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
>wrote:
>> You are certainly free to use HIGH and LOW to adjust flow-control
>pin
>> levels, as was suggested by Allan in an earlier post.
>>
>> -- Jon Williams
>> -- Parallax
>>
>>
>>
Original Message
>> From: yellowniter [noparse][[/noparse]mailto:yellowniter@y...]
>> Sent: Friday, June 27, 2003 11:31 AM
>> To: basicstamps@yahoogroups.com
>> Subject: [noparse][[/noparse]basicstamps] Re: Flow control simulation with RTS and CTS
>>
>>
>> Mr. William, I quickly scanned that article.
>> I'm not sure if I can use it because I'm using SHIFTIN/SHIFTOUT
>> commands to send character from first BS2 to MAX3110 (in
>trasmitter)
>> and SHIFTIN/SHIFTOUT to receive from another MAX3110 to another BS2.
>> Since I'm not using SERIN/SEROUT, I cannot use the tradtional SERIN
>> with flow control.
>>
>> I want to simulate flow control with extra pins on Stamp.
>>
>> Can this be done?
>>
>> --- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
>> wrote:
>> > I did an article on flow-control for serial IO in Nuts & Volts.
>> You can
>> > find it on our web site. Look in:
>> >
>> > Downloads >> Nuts & Volts Columns >> Volume #3 >> Article #89
>> >
>> > -- Jon Williams
>> > -- Parallax
>> >
>> >
>> >
>> >
Original Message
>> > From: yellowniter [noparse][[/noparse]mailto:yellowniter@y...]
>> > Sent: Friday, June 27, 2003 10:04 AM
>> > To: basicstamps@yahoogroups.com
>> > Subject: [noparse][[/noparse]basicstamps] Flow control simulation with RTS and CTS
>> >
>> >
>> > Does anyone know how SERIN/SEROUT with flow control can be
>> simulated
>> > with industry standard RTS and CTS signals for RS-232?
>> >
>> > I am trying to have a BS2 communicate to another BS2 via MAX3110
> > (SPI
>> > UART), but find that receiving BS2 is seeing multiple characters
>> for
>> > each transmitted character.
>> >
>> > I think I need some sort of hand-shaking to eliminate multiple
> > > reception.
>
What I mean by "multiple reception" is this:
First BS2 gets data typed in from PC (using SERIN 16) and then sends
data (ASCII character) to 1st MAX3110 which sends it to 2nd MAX3110.
Then data goes to 2nd BS2. The 2nd BS2 is hooked to parallel LCD (2
rows of 16 characters each).
The 2nd BS2 is supposed to receive the data, then display it on the
LCD.
What ends up happening is that when I type a character on PC, it
shows up 32 times on LCD (i.e. fills it up. If it was 4 rows, it
might even fill all 4 rows.)
I suspect that RX buffer in 2nd MAX3110 is not being cleared after it
is read. Thus 2nd BS2 keeps reading the same character.
The program for 2nd BS2 is set up to (pseudo code):
Readbuffer:
Read RX buffer from MAX3110 (using Mr. Allan Lane's suggestion)
Display on LCD
Increment cursor to next position on LCD
Goto Readbuffer
I need a way of determining if the RX buffer is truly "new data", or
old data. I think the code is reading the RX buffer many many times,
and filling the LCD screen.
I hope someone can help out.
--- In basicstamps@yahoogroups.com, Tracy Allen <tracy@e...> wrote:
> The UART itself has RTS pins that are set high/low or read as part
of
> the write data command, and a CTS pin that is read in as part of
the
> read data command. The chip also has an IRQ pin that can be
> activated in response to a number of conditions, including the
> arrival of data into the receive fifo. That could be used to
signal
> the arrival of data to the Stamp so that it could service the UART.
> Also, the current status of the receive buffer (empty or not)
appears
> on the data line out from the chip as soon as you bring chip select
> low, so you don't even have to clock the chip to retrieve that bit
of
> information. This article: <http://www.emesystems.com/BS2IrDA>
> includes control of RTS and read of the CTS line--in the circuit
> shown, CTS is connected to a pushbutton, not to another Stamp, and
> RTS controls an LED. I don't see much need to read the CONFIG
> register. I think in most BASIC Stamp apps, you will write to it
and
> that's that.
>
> To read the CONFIG it is true you would have to bit bang the first
> two bits of the command (01), but the remaining 14 bits could be
> retrieved with a shiftin. It is not necessary to bit-bang the read
> data command, because the command is 00, so all you have to do is
> leave the Din line low while you execute SHIFTIN.
>
> The UART itself does not do any automatic handshaking or flow
control
> using its RTC/ETS lines. That is up to your program.
>
> How RTC and CTS are used for flow control depends enormously on how
> your system is set up. Master-slave, peer to peer etc. Here
> scenarios that might be of interest to you.
> <http://www.emesystems.com/BS2rs232.htm>.
>
> You mentioned "multiple reception". I don't know what you mean by
that.
>
> -- regards
> Tracy Allen
> electronically monitored ecosystems
> http://www.emesystems.com
> mailto:tracy@e...
>
>
> >Yes, I did use what Mr. Allan Lane suggested. Thank you very much
> >Mr. Lane! (And also thanks to Mr. Tracy Allen and Al Williams.)
> >However, the only part I was able to glean from Mr. Lane's message
> >was WriteConfig, WriteData, and ReadData.
> >Mr. Lane, if you are reading this, could you please advise how
> >you "bit banged" to ReadConfig?
> >
> >In addition, does anyone know where I can find good info. (i.e.
> >protocol) on how hand-shaking is done via RTC and CTS?
> >
> >
> >
> >--- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
> >wrote:
> >> You are certainly free to use HIGH and LOW to adjust flow-control
> >pin
> >> levels, as was suggested by Allan in an earlier post.
> >>
> >> -- Jon Williams
> >> -- Parallax
> >>
> >>
> >>
Original Message
> >> From: yellowniter [noparse][[/noparse]mailto:yellowniter@y...]
> >> Sent: Friday, June 27, 2003 11:31 AM
> >> To: basicstamps@yahoogroups.com
> >> Subject: [noparse][[/noparse]basicstamps] Re: Flow control simulation with RTS and
CTS
> >>
> >>
> >> Mr. William, I quickly scanned that article.
> >> I'm not sure if I can use it because I'm using SHIFTIN/SHIFTOUT
> >> commands to send character from first BS2 to MAX3110 (in
> >trasmitter)
> >> and SHIFTIN/SHIFTOUT to receive from another MAX3110 to another
BS2.
> >> Since I'm not using SERIN/SEROUT, I cannot use the tradtional
SERIN
> >> with flow control.
> >>
> >> I want to simulate flow control with extra pins on Stamp.
> >>
> >> Can this be done?
> >>
> >> --- In basicstamps@yahoogroups.com, "Jon Williams"
<jwilliams@p...>
> >> wrote:
> >> > I did an article on flow-control for serial IO in Nuts & Volts.
> >> You can
> >> > find it on our web site. Look in:
> >> >
> >> > Downloads >> Nuts & Volts Columns >> Volume #3 >> Article #89
> >> >
> >> > -- Jon Williams
> >> > -- Parallax
> >> >
> >> >
> >> >
> >> >
Original Message
> >> > From: yellowniter [noparse][[/noparse]mailto:yellowniter@y...]
> >> > Sent: Friday, June 27, 2003 10:04 AM
> >> > To: basicstamps@yahoogroups.com
> >> > Subject: [noparse][[/noparse]basicstamps] Flow control simulation with RTS and CTS
> >> >
> >> >
> >> > Does anyone know how SERIN/SEROUT with flow control can be
> >> simulated
> >> > with industry standard RTS and CTS signals for RS-232?
> >> >
> >> > I am trying to have a BS2 communicate to another BS2 via
MAX3110
> > > (SPI
> >> > UART), but find that receiving BS2 is seeing multiple
characters
> >> for
> >> > each transmitted character.
> >> >
> >> > I think I need some sort of hand-shaking to eliminate multiple
> > > > reception.
> >
getting by without it.
What I need to know is how to use CTS/RTS and/or IRQ to read RX
buffer data only once. Time saving isn't critical, so I'd prefer to
stay away from using IRQ.
Is there an easy way to use CTS/RTS in a master sender & slave
receiver format? Or if IRQ is the "best" way, does anyone have some
simple pseucode code for that?
--- In basicstamps@yahoogroups.com, Tracy Allen <tracy@e...> wrote:
> The UART itself has RTS pins that are set high/low or read as part
of
> the write data command, and a CTS pin that is read in as part of
the
> read data command. The chip also has an IRQ pin that can be
> activated in response to a number of conditions, including the
> arrival of data into the receive fifo. That could be used to
signal
> the arrival of data to the Stamp so that it could service the UART.
> Also, the current status of the receive buffer (empty or not)
appears
> on the data line out from the chip as soon as you bring chip select
> low, so you don't even have to clock the chip to retrieve that bit
of
> information. This article: <http://www.emesystems.com/BS2IrDA>
> includes control of RTS and read of the CTS line--in the circuit
> shown, CTS is connected to a pushbutton, not to another Stamp, and
> RTS controls an LED. I don't see much need to read the CONFIG
> register. I think in most BASIC Stamp apps, you will write to it
and
> that's that.
>
> To read the CONFIG it is true you would have to bit bang the first
> two bits of the command (01), but the remaining 14 bits could be
> retrieved with a shiftin. It is not necessary to bit-bang the read
> data command, because the command is 00, so all you have to do is
> leave the Din line low while you execute SHIFTIN.
>
> The UART itself does not do any automatic handshaking or flow
control
> using its RTC/ETS lines. That is up to your program.
>
> How RTC and CTS are used for flow control depends enormously on how
> your system is set up. Master-slave, peer to peer etc. Here
> scenarios that might be of interest to you.
> <http://www.emesystems.com/BS2rs232.htm>.
>
> You mentioned "multiple reception". I don't know what you mean by
that.
>
> -- regards
> Tracy Allen
> electronically monitored ecosystems
> http://www.emesystems.com
> mailto:tracy@e...
>
>
> >Yes, I did use what Mr. Allan Lane suggested. Thank you very much
> >Mr. Lane! (And also thanks to Mr. Tracy Allen and Al Williams.)
> >However, the only part I was able to glean from Mr. Lane's message
> >was WriteConfig, WriteData, and ReadData.
> >Mr. Lane, if you are reading this, could you please advise how
> >you "bit banged" to ReadConfig?
> >
> >In addition, does anyone know where I can find good info. (i.e.
> >protocol) on how hand-shaking is done via RTC and CTS?
> >
> >
> >
> >--- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
> >wrote:
> >> You are certainly free to use HIGH and LOW to adjust flow-control
> >pin
> >> levels, as was suggested by Allan in an earlier post.
> >>
> >> -- Jon Williams
> >> -- Parallax
> >>
> >>
> >>
Original Message
> >> From: yellowniter [noparse][[/noparse]mailto:yellowniter@y...]
> >> Sent: Friday, June 27, 2003 11:31 AM
> >> To: basicstamps@yahoogroups.com
> >> Subject: [noparse][[/noparse]basicstamps] Re: Flow control simulation with RTS and
CTS
> >>
> >>
> >> Mr. William, I quickly scanned that article.
> >> I'm not sure if I can use it because I'm using SHIFTIN/SHIFTOUT
> >> commands to send character from first BS2 to MAX3110 (in
> >trasmitter)
> >> and SHIFTIN/SHIFTOUT to receive from another MAX3110 to another
BS2.
> >> Since I'm not using SERIN/SEROUT, I cannot use the tradtional
SERIN
> >> with flow control.
> >>
> >> I want to simulate flow control with extra pins on Stamp.
> >>
> >> Can this be done?
> >>
> >> --- In basicstamps@yahoogroups.com, "Jon Williams"
<jwilliams@p...>
> >> wrote:
> >> > I did an article on flow-control for serial IO in Nuts & Volts.
> >> You can
> >> > find it on our web site. Look in:
> >> >
> >> > Downloads >> Nuts & Volts Columns >> Volume #3 >> Article #89
> >> >
> >> > -- Jon Williams
> >> > -- Parallax
> >> >
> >> >
> >> >
> >> >
Original Message
> >> > From: yellowniter [noparse][[/noparse]mailto:yellowniter@y...]
> >> > Sent: Friday, June 27, 2003 10:04 AM
> >> > To: basicstamps@yahoogroups.com
> >> > Subject: [noparse][[/noparse]basicstamps] Flow control simulation with RTS and CTS
> >> >
> >> >
> >> > Does anyone know how SERIN/SEROUT with flow control can be
> >> simulated
> >> > with industry standard RTS and CTS signals for RS-232?
> >> >
> >> > I am trying to have a BS2 communicate to another BS2 via
MAX3110
> > > (SPI
> >> > UART), but find that receiving BS2 is seeing multiple
characters
> >> for
> >> > each transmitted character.
> >> >
> >> > I think I need some sort of hand-shaking to eliminate multiple
> > > > reception.
> >
1. You can read the incoming CTS state on 'ReadData'.
2. You can set the outgoing RTS state on 'WriteData'.
3. I don't think the MAX3110 does 'automatic' hardware
handshaking, where it automatically sets CTS low when
the 8-byte FIFO is full.
4. You CAN use the MAX3110 '232 drivers' to make a
TTL level RTS and CTS, tie these to BS2 pins, and
directly read and write them in your code.
--- In basicstamps@yahoogroups.com, "yellowniter" <yellowniter@y...>
wrote:
> Mr. William, I quickly scanned that article.
> I'm not sure if I can use it because I'm using SHIFTIN/SHIFTOUT
> commands to send character from first BS2 to MAX3110 (in
trasmitter)
> and SHIFTIN/SHIFTOUT to receive from another MAX3110 to another BS2.
> Since I'm not using SERIN/SEROUT, I cannot use the tradtional SERIN
> with flow control.
>
> I want to simulate flow control with extra pins on Stamp.
>
> Can this be done?
>
> --- In basicstamps@yahoogroups.com, "Jon Williams" <jwilliams@p...>
> wrote:
> > I did an article on flow-control for serial IO in Nuts & Volts.
> You can
> > find it on our web site. Look in:
> >
> > Downloads >> Nuts & Volts Columns >> Volume #3 >> Article #89
> >
> > -- Jon Williams
> > -- Parallax
> >
> >
> >
> >
Original Message
> > From: yellowniter [noparse][[/noparse]mailto:yellowniter@y...]
> > Sent: Friday, June 27, 2003 10:04 AM
> > To: basicstamps@yahoogroups.com
> > Subject: [noparse][[/noparse]basicstamps] Flow control simulation with RTS and CTS
> >
> >
> > Does anyone know how SERIN/SEROUT with flow control can be
> simulated
> > with industry standard RTS and CTS signals for RS-232?
> >
> > I am trying to have a BS2 communicate to another BS2 via MAX3110
> (SPI
> > UART), but find that receiving BS2 is seeing multiple characters
> for
> > each transmitted character.
> >
> > I think I need some sort of hand-shaking to eliminate multiple
> > reception.
> >
> >
> >
> >
> >
> > To UNSUBSCRIBE, just send mail to:
> > basicstamps-unsubscribe@yahoogroups.com
> > from the same email address that you subscribed. Text in the
> Subject
> > and Body of the message will be ignored.
> >
> >
> > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/
> >
> >
> >
> >
> > This message has been scanned by WebShield. Please report SPAM to
> > abuse@p...
T_Out and T_In. You start with the
Clock line LOW, ChipSelect HIGH,
T_Out set to $4000, which is the
'ReadConfig' command. T_In set to
0, to be filled during the routine.
You Drop the ChipSelect line. This makes
the DataIn line from the 3110 valid.
Repeat16Times:
You read DataIn line as T_In.Bit0
You then read the top bit of T_Out.
If its a 0, you output a 0 on DataOut,
if its a 1, you output a 1 on DataOut.
You then pulse the Clock line High, then
Low. This clocks out your first bit to
the 3110, and makes the DataIn line valid
for the next DataIn bit.
You shift T_In up one bit, then read the
DataIn state into T_In.Bit0.
Shift T_Out up one bit.
Repeat the above 16 times. What you've done
is clock out T_Out to the 3110, and clocked
the 16-bit word from the 3110 into T_In.
Then, raise '/ChipSelect' to deselect the
3110.
I call this 'bit-banging' because for each
bit in and out, you are explicitly
controlling the state of data and clock
pins.
If the top bit of the 16-bit word read from the
3110 is '0', then no data was read from the 3110.
This '0' means the Rx FIFO is empty, and the
word just read should be tossed.
--- In basicstamps@yahoogroups.com, "yellowniter" <yellowniter@y...>
wrote:
> Thank you Mr. Allen. I will study the materials you suggested.
> What I mean by "multiple reception" is this:
>
> First BS2 gets data typed in from PC (using SERIN 16) and then
sends
> data (ASCII character) to 1st MAX3110 which sends it to 2nd
MAX3110.
> Then data goes to 2nd BS2. The 2nd BS2 is hooked to parallel LCD
(2
> rows of 16 characters each).
> The 2nd BS2 is supposed to receive the data, then display it on the
> LCD.
> What ends up happening is that when I type a character on PC, it
> shows up 32 times on LCD (i.e. fills it up. If it was 4 rows, it
> might even fill all 4 rows.)
>
> I suspect that RX buffer in 2nd MAX3110 is not being cleared after
it
> is read. Thus 2nd BS2 keeps reading the same character.
>
> The program for 2nd BS2 is set up to (pseudo code):
>
> Readbuffer:
> Read RX buffer from MAX3110 (using Mr. Allan Lane's suggestion)
> Display on LCD
> Increment cursor to next position on LCD
> Goto Readbuffer
>
> I need a way of determining if the RX buffer is truly "new data",
or
> old data. I think the code is reading the RX buffer many many
times,
> and filling the LCD screen.
>
> I hope someone can help out.
>
>
> --- In basicstamps@yahoogroups.com, Tracy Allen <tracy@e...> wrote:
> > The UART itself has RTS pins that are set high/low or read as
part
> of
> > the write data command, and a CTS pin that is read in as part of
> the
> > read data command. The chip also has an IRQ pin that can be
> > activated in response to a number of conditions, including the
> > arrival of data into the receive fifo. That could be used to
> signal
> > the arrival of data to the Stamp so that it could service the
UART.
> > Also, the current status of the receive buffer (empty or not)
> appears
> > on the data line out from the chip as soon as you bring chip
select
> > low, so you don't even have to clock the chip to retrieve that
bit
> of
> > information. This article: <http://www.emesystems.com/BS2IrDA>
> > includes control of RTS and read of the CTS line--in the circuit
> > shown, CTS is connected to a pushbutton, not to another Stamp,
and
> > RTS controls an LED. I don't see much need to read the CONFIG
> > register. I think in most BASIC Stamp apps, you will write to it
> and
> > that's that.
> >
> > To read the CONFIG it is true you would have to bit bang the
first
> > two bits of the command (01), but the remaining 14 bits could be
> > retrieved with a shiftin. It is not necessary to bit-bang the
read
> > data command, because the command is 00, so all you have to do is
> > leave the Din line low while you execute SHIFTIN.
> >
> > The UART itself does not do any automatic handshaking or flow
> control
> > using its RTC/ETS lines. That is up to your program.
> >
> > How RTC and CTS are used for flow control depends enormously on
how
> > your system is set up. Master-slave, peer to peer etc. Here
> > scenarios that might be of interest to you.
> > <http://www.emesystems.com/BS2rs232.htm>.
> >
> > You mentioned "multiple reception". I don't know what you mean
by
> that.
> >
> > -- regards
> > Tracy Allen
> > electronically monitored ecosystems
> > http://www.emesystems.com
> > mailto:tracy@e...
> >
> >
> > >Yes, I did use what Mr. Allan Lane suggested. Thank you very
much
> > >Mr. Lane! (And also thanks to Mr. Tracy Allen and Al Williams.)
> > >However, the only part I was able to glean from Mr. Lane's
message
> > >was WriteConfig, WriteData, and ReadData.
> > >Mr. Lane, if you are reading this, could you please advise how
> > >you "bit banged" to ReadConfig?
> > >
> > >In addition, does anyone know where I can find good info. (i.e.
> > >protocol) on how hand-shaking is done via RTC and CTS?
> > >
> > >
> > >
> > >--- In basicstamps@yahoogroups.com, "Jon Williams"
<jwilliams@p...>
> > >wrote:
> > >> You are certainly free to use HIGH and LOW to adjust flow-
control
> > >pin
> > >> levels, as was suggested by Allan in an earlier post.
> > >>
> > >> -- Jon Williams
> > >> -- Parallax
> > >>
> > >>
> > >>
Original Message
> > >> From: yellowniter [noparse][[/noparse]mailto:yellowniter@y...]
> > >> Sent: Friday, June 27, 2003 11:31 AM
> > >> To: basicstamps@yahoogroups.com
> > >> Subject: [noparse][[/noparse]basicstamps] Re: Flow control simulation with RTS
and
> CTS
> > >>
> > >>
> > >> Mr. William, I quickly scanned that article.
> > >> I'm not sure if I can use it because I'm using SHIFTIN/SHIFTOUT
> > >> commands to send character from first BS2 to MAX3110 (in
> > >trasmitter)
> > >> and SHIFTIN/SHIFTOUT to receive from another MAX3110 to
another
> BS2.
> > >> Since I'm not using SERIN/SEROUT, I cannot use the tradtional
> SERIN
> > >> with flow control.
> > >>
> > >> I want to simulate flow control with extra pins on Stamp.
> > >>
> > >> Can this be done?
> > >>
> > >> --- In basicstamps@yahoogroups.com, "Jon Williams"
> <jwilliams@p...>
> > >> wrote:
> > >> > I did an article on flow-control for serial IO in Nuts &
Volts.
> > >> You can
> > >> > find it on our web site. Look in:
> > >> >
> > >> > Downloads >> Nuts & Volts Columns >> Volume #3 >> Article
#89
> > >> >
> > >> > -- Jon Williams
> > >> > -- Parallax
> > >> >
> > >> >
> > >> >
> > >> >
Original Message
> > >> > From: yellowniter [noparse][[/noparse]mailto:yellowniter@y...]
> > >> > Sent: Friday, June 27, 2003 10:04 AM
> > >> > To: basicstamps@yahoogroups.com
> > >> > Subject: [noparse][[/noparse]basicstamps] Flow control simulation with RTS and
CTS
> > >> >
> > >> >
> > >> > Does anyone know how SERIN/SEROUT with flow control can be
> > >> simulated
> > >> > with industry standard RTS and CTS signals for RS-232?
> > >> >
> > >> > I am trying to have a BS2 communicate to another BS2 via
> MAX3110
> > > > (SPI
> > >> > UART), but find that receiving BS2 is seeing multiple
> characters
> > >> for
> > >> > each transmitted character.
> > >> >
> > >> > I think I need some sort of hand-shaking to eliminate
multiple
> > > > > reception.
> > >
>Thank you Mr. Allen. I will study the materials you suggested.
>What I mean by "multiple reception" is this:
>
>First BS2 gets data typed in from PC (using SERIN 16) and then sends
>data (ASCII character) to 1st MAX3110 which sends it to 2nd MAX3110.
>Then data goes to 2nd BS2. The 2nd BS2 is hooked to parallel LCD (2
>rows of 16 characters each).
>The 2nd BS2 is supposed to receive the data, then display it on the
>LCD.
>What ends up happening is that when I type a character on PC, it
>shows up 32 times on LCD (i.e. fills it up. If it was 4 rows, it
>might even fill all 4 rows.)
>
>I suspect that RX buffer in 2nd MAX3110 is not being cleared after it
>is read. Thus 2nd BS2 keeps reading the same character.
>
>The program for 2nd BS2 is set up to (pseudo code):
>
>Readbuffer:
>Read RX buffer from MAX3110 (using Mr. Allan Lane's suggestion)
>Display on LCD
>Increment cursor to next position on LCD
>Goto Readbuffer
>
>I need a way of determining if the RX buffer is truly "new data", or
>old data. I think the code is reading the RX buffer many many times,
>and filling the LCD screen.
>
>I hope someone can help out.
Change to some other pin than Pin 16.
I think this is it. I will try your suggestion of monitoring bit15
(MSB) of read data. If bit15=0, then then ignore data on bit0-7.
If bit15=1, then use data on bit0-7.
Someone else suggested that I don't use pin 16 of BS2 to receive data
from PC keyboard. Why not? If I use SERIN 16, Baudmode, [noparse][[/noparse]char], is
there some side-effect?
I'm simply using pin16 to get data that is typed in from PC's
keyboard (and save a Stamp pin).
--- In basicstamps@yahoogroups.com, "Allan Lane" <allan.lane@h...>
wrote:
> Yes.
> If the top bit of the 16-bit word read from the
> 3110 is '0', then no data was read from the 3110.
> This '0' means the Rx FIFO is empty, and the
> word just read should be tossed.
>
> --- In basicstamps@yahoogroups.com, "yellowniter"
<yellowniter@y...>
> wrote:
> > Thank you Mr. Allen. I will study the materials you suggested.
> > What I mean by "multiple reception" is this:
> >
> > First BS2 gets data typed in from PC (using SERIN 16) and then
> sends
> > data (ASCII character) to 1st MAX3110 which sends it to 2nd
> MAX3110.
> > Then data goes to 2nd BS2. The 2nd BS2 is hooked to parallel LCD
> (2
> > rows of 16 characters each).
> > The 2nd BS2 is supposed to receive the data, then display it on
the
> > LCD.
> > What ends up happening is that when I type a character on PC, it
> > shows up 32 times on LCD (i.e. fills it up. If it was 4 rows, it
> > might even fill all 4 rows.)
> >
> > I suspect that RX buffer in 2nd MAX3110 is not being cleared
after
> it
> > is read. Thus 2nd BS2 keeps reading the same character.
> >
> > The program for 2nd BS2 is set up to (pseudo code):
> >
> > Readbuffer:
> > Read RX buffer from MAX3110 (using Mr. Allan Lane's suggestion)
> > Display on LCD
> > Increment cursor to next position on LCD
> > Goto Readbuffer
> >
> > I need a way of determining if the RX buffer is truly "new data",
> or
> > old data. I think the code is reading the RX buffer many many
> times,
> > and filling the LCD screen.
> >
> > I hope someone can help out.
> >
> >
> > --- In basicstamps@yahoogroups.com, Tracy Allen <tracy@e...>
wrote:
> > > The UART itself has RTS pins that are set high/low or read as
> part
> > of
> > > the write data command, and a CTS pin that is read in as part
of
> > the
> > > read data command. The chip also has an IRQ pin that can be
> > > activated in response to a number of conditions, including the
> > > arrival of data into the receive fifo. That could be used to
> > signal
> > > the arrival of data to the Stamp so that it could service the
> UART.
> > > Also, the current status of the receive buffer (empty or not)
> > appears
> > > on the data line out from the chip as soon as you bring chip
> select
> > > low, so you don't even have to clock the chip to retrieve that
> bit
> > of
> > > information. This article:
<http://www.emesystems.com/BS2IrDA>
> > > includes control of RTS and read of the CTS line--in the
circuit
> > > shown, CTS is connected to a pushbutton, not to another Stamp,
> and
> > > RTS controls an LED. I don't see much need to read the CONFIG
> > > register. I think in most BASIC Stamp apps, you will write to
it
> > and
> > > that's that.
> > >
> > > To read the CONFIG it is true you would have to bit bang the
> first
> > > two bits of the command (01), but the remaining 14 bits could
be
> > > retrieved with a shiftin. It is not necessary to bit-bang the
> read
> > > data command, because the command is 00, so all you have to do
is
> > > leave the Din line low while you execute SHIFTIN.
> > >
> > > The UART itself does not do any automatic handshaking or flow
> > control
> > > using its RTC/ETS lines. That is up to your program.
> > >
> > > How RTC and CTS are used for flow control depends enormously on
> how
> > > your system is set up. Master-slave, peer to peer etc. Here
> > > scenarios that might be of interest to you.
> > > <http://www.emesystems.com/BS2rs232.htm>.
> > >
> > > You mentioned "multiple reception". I don't know what you mean
> by
> > that.
> > >
> > > -- regards
> > > Tracy Allen
> > > electronically monitored ecosystems
> > > http://www.emesystems.com
> > > mailto:tracy@e...
> > >
> > >
> > > >Yes, I did use what Mr. Allan Lane suggested. Thank you very
> much
> > > >Mr. Lane! (And also thanks to Mr. Tracy Allen and Al
Williams.)
> > > >However, the only part I was able to glean from Mr. Lane's
> message
> > > >was WriteConfig, WriteData, and ReadData.
> > > >Mr. Lane, if you are reading this, could you please advise how
> > > >you "bit banged" to ReadConfig?
> > > >
> > > >In addition, does anyone know where I can find good info. (i.e.
> > > >protocol) on how hand-shaking is done via RTC and CTS?
> > > >
> > > >
> > > >
> > > >--- In basicstamps@yahoogroups.com, "Jon Williams"
> <jwilliams@p...>
> > > >wrote:
> > > >> You are certainly free to use HIGH and LOW to adjust flow-
> control
> > > >pin
> > > >> levels, as was suggested by Allan in an earlier post.
> > > >>
> > > >> -- Jon Williams
> > > >> -- Parallax
> > > >>
> > > >>
> > > >>
Original Message
> > > >> From: yellowniter [noparse][[/noparse]mailto:yellowniter@y...]
> > > >> Sent: Friday, June 27, 2003 11:31 AM
> > > >> To: basicstamps@yahoogroups.com
> > > >> Subject: [noparse][[/noparse]basicstamps] Re: Flow control simulation with RTS
> and
> > CTS
> > > >>
> > > >>
> > > >> Mr. William, I quickly scanned that article.
> > > >> I'm not sure if I can use it because I'm using
SHIFTIN/SHIFTOUT
> > > >> commands to send character from first BS2 to MAX3110 (in
> > > >trasmitter)
> > > >> and SHIFTIN/SHIFTOUT to receive from another MAX3110 to
> another
> > BS2.
> > > >> Since I'm not using SERIN/SEROUT, I cannot use the
tradtional
> > SERIN
> > > >> with flow control.
> > > >>
> > > >> I want to simulate flow control with extra pins on Stamp.
> > > >>
> > > >> Can this be done?
> > > >>
> > > >> --- In basicstamps@yahoogroups.com, "Jon Williams"
> > <jwilliams@p...>
> > > >> wrote:
> > > >> > I did an article on flow-control for serial IO in Nuts &
> Volts.
> > > >> You can
> > > >> > find it on our web site. Look in:
> > > >> >
> > > >> > Downloads >> Nuts & Volts Columns >> Volume #3 >>
Article
> #89
> > > >> >
> > > >> > -- Jon Williams
> > > >> > -- Parallax
> > > >> >
> > > >> >
> > > >> >
> > > >> >
Original Message
> > > >> > From: yellowniter [noparse][[/noparse]mailto:yellowniter@y...]
> > > >> > Sent: Friday, June 27, 2003 10:04 AM
> > > >> > To: basicstamps@yahoogroups.com
> > > >> > Subject: [noparse][[/noparse]basicstamps] Flow control simulation with RTS
and
> CTS
> > > >> >
> > > >> >
> > > >> > Does anyone know how SERIN/SEROUT with flow control can be
> > > >> simulated
> > > >> > with industry standard RTS and CTS signals for RS-232?
> > > >> >
> > > >> > I am trying to have a BS2 communicate to another BS2 via
> > MAX3110
> > > > > (SPI
> > > >> > UART), but find that receiving BS2 is seeing multiple
> > characters
> > > >> for
> > > >> > each transmitted character.
> > > >> >
> > > >> > I think I need some sort of hand-shaking to eliminate
> multiple
> > > > > > reception.
> > > >
>Thank you Mr. Lane.
>
>I think this is it. I will try your suggestion of monitoring bit15
>(MSB) of read data. If bit15=0, then then ignore data on bit0-7.
>If bit15=1, then use data on bit0-7.
>
>Someone else suggested that I don't use pin 16 of BS2 to receive data
>from PC keyboard. Why not? If I use SERIN 16, Baudmode, [noparse][[/noparse]char], is
>there some side-effect?
>I'm simply using pin16 to get data that is typed in from PC's
>keyboard (and save a Stamp pin).
Characters are echoed using the Sin/Sout port (Port 16). This is by design.
Bruce Bates
>At 08:07 PM 6/27/03 +0000, yellowniter wrote:
> >Thank you Mr. Lane.
> >
> >I think this is it. I will try your suggestion of monitoring bit15
> >(MSB) of read data. If bit15=0, then then ignore data on bit0-7.
> >If bit15=1, then use data on bit0-7.
> >
> >Someone else suggested that I don't use pin 16 of BS2 to receive data
> >from PC keyboard. Why not? If I use SERIN 16, Baudmode, [noparse][[/noparse]char], is
> >there some side-effect?
> >I'm simply using pin16 to get data that is typed in from PC's
> >keyboard (and save a Stamp pin).
>
>Characters are echoed using the Sin/Sout port (Port 16). This is by design.
>
>Bruce Bates
Sorry ! I thought the Debug Port was being used in the MAX31xx configuration.
What is it that you're trying to accomplish using the two MAX chips ?
Bruce Bates
>To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
>from the same email address that you subscribed. Text in the Subject and
>Body of the message will be ignored.
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
I simply monitor bit15 of ReadData and discard it if it is 0, and use
it if it is 1.
I don't even need to worry about CTS or RTS...although it would be
nice to know how it is supposed to work for future project.
Mr. Lane, how does the MAX3110 "know" if bit15 should be set to 1 or
0 by MAX3110? i.e. How does it know that "RX buffer was already
read, so next time a ReadData is performed, bit15 should be set to
0", or "RX buffer is not yet read, thus next bit15 should be set to 1
on next ReadData"? I've read the MAX data sheet, but could not find
good info. on behavior of bit15.
Bruce, I'm using pin16 just as a convenient way to test my
hardware/software.
Final project will not be getting input from PC keyboard of course.
--- In basicstamps@yahoogroups.com, "Allan Lane" <allan.lane@h...>
wrote:
> Yes.
> If the top bit of the 16-bit word read from the
> 3110 is '0', then no data was read from the 3110.
> This '0' means the Rx FIFO is empty, and the
> word just read should be tossed.
>
> --- In basicstamps@yahoogroups.com, "yellowniter"
<yellowniter@y...>
> wrote:
> > Thank you Mr. Allen. I will study the materials you suggested.
> > What I mean by "multiple reception" is this:
> >
> > First BS2 gets data typed in from PC (using SERIN 16) and then
> sends
> > data (ASCII character) to 1st MAX3110 which sends it to 2nd
> MAX3110.
> > Then data goes to 2nd BS2. The 2nd BS2 is hooked to parallel LCD
> (2
> > rows of 16 characters each).
> > The 2nd BS2 is supposed to receive the data, then display it on
the
> > LCD.
> > What ends up happening is that when I type a character on PC, it
> > shows up 32 times on LCD (i.e. fills it up. If it was 4 rows, it
> > might even fill all 4 rows.)
> >
> > I suspect that RX buffer in 2nd MAX3110 is not being cleared
after
> it
> > is read. Thus 2nd BS2 keeps reading the same character.
> >
> > The program for 2nd BS2 is set up to (pseudo code):
> >
> > Readbuffer:
> > Read RX buffer from MAX3110 (using Mr. Allan Lane's suggestion)
> > Display on LCD
> > Increment cursor to next position on LCD
> > Goto Readbuffer
> >
> > I need a way of determining if the RX buffer is truly "new data",
> or
> > old data. I think the code is reading the RX buffer many many
> times,
> > and filling the LCD screen.
> >
> > I hope someone can help out.
> >
> >
> > --- In basicstamps@yahoogroups.com, Tracy Allen <tracy@e...>
wrote:
> > > The UART itself has RTS pins that are set high/low or read as
> part
> > of
> > > the write data command, and a CTS pin that is read in as part
of
> > the
> > > read data command. The chip also has an IRQ pin that can be
> > > activated in response to a number of conditions, including the
> > > arrival of data into the receive fifo. That could be used to
> > signal
> > > the arrival of data to the Stamp so that it could service the
> UART.
> > > Also, the current status of the receive buffer (empty or not)
> > appears
> > > on the data line out from the chip as soon as you bring chip
> select
> > > low, so you don't even have to clock the chip to retrieve that
> bit
> > of
> > > information. This article:
<http://www.emesystems.com/BS2IrDA>
> > > includes control of RTS and read of the CTS line--in the
circuit
> > > shown, CTS is connected to a pushbutton, not to another Stamp,
> and
> > > RTS controls an LED. I don't see much need to read the CONFIG
> > > register. I think in most BASIC Stamp apps, you will write to
it
> > and
> > > that's that.
> > >
> > > To read the CONFIG it is true you would have to bit bang the
> first
> > > two bits of the command (01), but the remaining 14 bits could
be
> > > retrieved with a shiftin. It is not necessary to bit-bang the
> read
> > > data command, because the command is 00, so all you have to do
is
> > > leave the Din line low while you execute SHIFTIN.
> > >
> > > The UART itself does not do any automatic handshaking or flow
> > control
> > > using its RTC/ETS lines. That is up to your program.
> > >
> > > How RTC and CTS are used for flow control depends enormously on
> how
> > > your system is set up. Master-slave, peer to peer etc. Here
> > > scenarios that might be of interest to you.
> > > <http://www.emesystems.com/BS2rs232.htm>.
> > >
> > > You mentioned "multiple reception". I don't know what you mean
> by
> > that.
> > >
> > > -- regards
> > > Tracy Allen
> > > electronically monitored ecosystems
> > > http://www.emesystems.com
> > > mailto:tracy@e...
> > >
> > >
> > > >Yes, I did use what Mr. Allan Lane suggested. Thank you very
> much
> > > >Mr. Lane! (And also thanks to Mr. Tracy Allen and Al
Williams.)
> > > >However, the only part I was able to glean from Mr. Lane's
> message
> > > >was WriteConfig, WriteData, and ReadData.
> > > >Mr. Lane, if you are reading this, could you please advise how
> > > >you "bit banged" to ReadConfig?
> > > >
> > > >In addition, does anyone know where I can find good info. (i.e.
> > > >protocol) on how hand-shaking is done via RTC and CTS?
> > > >
> > > >
> > > >
> > > >--- In basicstamps@yahoogroups.com, "Jon Williams"
> <jwilliams@p...>
> > > >wrote:
> > > >> You are certainly free to use HIGH and LOW to adjust flow-
> control
> > > >pin
> > > >> levels, as was suggested by Allan in an earlier post.
> > > >>
> > > >> -- Jon Williams
> > > >> -- Parallax
> > > >>
> > > >>
> > > >>
Original Message
> > > >> From: yellowniter [noparse][[/noparse]mailto:yellowniter@y...]
> > > >> Sent: Friday, June 27, 2003 11:31 AM
> > > >> To: basicstamps@yahoogroups.com
> > > >> Subject: [noparse][[/noparse]basicstamps] Re: Flow control simulation with RTS
> and
> > CTS
> > > >>
> > > >>
> > > >> Mr. William, I quickly scanned that article.
> > > >> I'm not sure if I can use it because I'm using
SHIFTIN/SHIFTOUT
> > > >> commands to send character from first BS2 to MAX3110 (in
> > > >trasmitter)
> > > >> and SHIFTIN/SHIFTOUT to receive from another MAX3110 to
> another
> > BS2.
> > > >> Since I'm not using SERIN/SEROUT, I cannot use the
tradtional
> > SERIN
> > > >> with flow control.
> > > >>
> > > >> I want to simulate flow control with extra pins on Stamp.
> > > >>
> > > >> Can this be done?
> > > >>
> > > >> --- In basicstamps@yahoogroups.com, "Jon Williams"
> > <jwilliams@p...>
> > > >> wrote:
> > > >> > I did an article on flow-control for serial IO in Nuts &
> Volts.
> > > >> You can
> > > >> > find it on our web site. Look in:
> > > >> >
> > > >> > Downloads >> Nuts & Volts Columns >> Volume #3 >>
Article
> #89
> > > >> >
> > > >> > -- Jon Williams
> > > >> > -- Parallax
> > > >> >
> > > >> >
> > > >> >
> > > >> >
Original Message
> > > >> > From: yellowniter [noparse][[/noparse]mailto:yellowniter@y...]
> > > >> > Sent: Friday, June 27, 2003 10:04 AM
> > > >> > To: basicstamps@yahoogroups.com
> > > >> > Subject: [noparse][[/noparse]basicstamps] Flow control simulation with RTS
and
> CTS
> > > >> >
> > > >> >
> > > >> > Does anyone know how SERIN/SEROUT with flow control can be
> > > >> simulated
> > > >> > with industry standard RTS and CTS signals for RS-232?
> > > >> >
> > > >> > I am trying to have a BS2 communicate to another BS2 via
> > MAX3110
> > > > > (SPI
> > > >> > UART), but find that receiving BS2 is seeing multiple
> > characters
> > > >> for
> > > >> > each transmitted character.
> > > >> >
> > > >> > I think I need some sort of hand-shaking to eliminate
> multiple
> > > > > > reception.
> > > >
good way to get data from the PC.
Note you could interface the keyboard directly,
which is not what you are doing currently,
I assume -- but some people have done this,
in which case you can't use SERIN, but there
must be some other interface to the PC
keyboard...
I hope my hints helped. In retrospect, it
doesn't seem like you need 'true' handshaking,
you only needed that factoid about the top
bit.
--- In basicstamps@yahoogroups.com, "yellowniter" <yellowniter@y...>
wrote:
> Thank you Mr. Lane.
>
> I think this is it. I will try your suggestion of monitoring bit15
> (MSB) of read data. If bit15=0, then then ignore data on bit0-7.
> If bit15=1, then use data on bit0-7.
>
> Someone else suggested that I don't use pin 16 of BS2 to receive
data
> from PC keyboard. Why not? If I use SERIN 16, Baudmode, [noparse][[/noparse]char],
is
> there some side-effect?
> I'm simply using pin16 to get data that is typed in from PC's
> keyboard (and save a Stamp pin).
>
> --- In basicstamps@yahoogroups.com, "Allan Lane" <allan.lane@h...>
> wrote:
> > Yes.
> > If the top bit of the 16-bit word read from the
> > 3110 is '0', then no data was read from the 3110.
> > This '0' means the Rx FIFO is empty, and the
> > word just read should be tossed.
> >
They say:
"R = 1, Data is available to be read or is being
read from the receive register or FIFO"
"R = 0, Receive register and FIOF are empty".
It's only implied (and I verified this in my
own code) that if that bit is 0, then you
did a read when no data was available, and
the data byte returned is not valid. You've
now shown that it just returns the last byte
read each time you do that.
Usual UARTS have a bit which you can check
to determine if data is ready. On the 3110,
the same read which would find if it was
ready could just as well get the byte, and
save time. So the 3110 ONLY sets this bit
if you are doing a 'new read' of data it
has already received for you. It only
sets this bit (and gives you the byte)
if it had a byte ready before you started
your read.
--- In basicstamps@yahoogroups.com, "yellowniter" <yellowniter@y...>
wrote:
> Mr. Lane, this works! Thank you for your insights!
> I simply monitor bit15 of ReadData and discard it if it is 0, and
use
> it if it is 1.
>
> I don't even need to worry about CTS or RTS...although it would be
> nice to know how it is supposed to work for future project.
>
> Mr. Lane, how does the MAX3110 "know" if bit15 should be set to 1
or
> 0 by MAX3110? i.e. How does it know that "RX buffer was already
> read, so next time a ReadData is performed, bit15 should be set to
> 0", or "RX buffer is not yet read, thus next bit15 should be set to
1
> on next ReadData"? I've read the MAX data sheet, but could not
find
> good info. on behavior of bit15.
>
> Bruce, I'm using pin16 just as a convenient way to test my
> hardware/software.
> Final project will not be getting input from PC keyboard of course.
>
>
> --- In basicstamps@yahoogroups.com, "Allan Lane" <allan.lane@h...>
> wrote:
> > Yes.
> > If the top bit of the 16-bit word read from the
> > 3110 is '0', then no data was read from the 3110.
> > This '0' means the Rx FIFO is empty, and the
> > word just read should be tossed.
> >
> > --- In basicstamps@yahoogroups.com, "yellowniter"
> <yellowniter@y...>