baudmode: driven and inverted bits
Archiver
Posts: 46,084
I understand the use of the size, parity and baudrate bits for the
SERIN and SEROUT commands; however, I don't understand the purpose
of the "driven" or "inverted" bits.
Could someone explain how I'd determine whether I needed to set one
or both (ie. are there simple tests to determine whether the device
I'm sending-to or receiving-from is configured as "driven"
or "inverted")?
Thanks!
--Donn
SERIN and SEROUT commands; however, I don't understand the purpose
of the "driven" or "inverted" bits.
Could someone explain how I'd determine whether I needed to set one
or both (ie. are there simple tests to determine whether the device
I'm sending-to or receiving-from is configured as "driven"
or "inverted")?
Thanks!
--Donn
Comments
thread...
I understand the use of the size, parity and baudrate bits for the
SERIN and SEROUT commands; however, I don't understand the purpose
of the "driven" or "inverted" bits.
Could someone explain how I'd determine whether I needed to set one
or both (ie. are there simple tests to determine whether the device
I'm sending-to or receiving-from is configured as "driven"
or "inverted")?
Thanks!
--Donn
>thread...
>
>I understand the use of the size, parity and baudrate bits for the
>SERIN and SEROUT commands; however, I don't understand the purpose
>of the "driven" or "inverted" bits.
>
>Could someone explain how I'd determine whether I needed to set one
>or both (ie. are there simple tests to determine whether the device
>I'm sending-to or receiving-from is configured as "driven"
>or "inverted")?
>
>Thanks!
>--Donn
Hi Donn,
For almost all purposes, you will use the "driven" as opposed to the
"open" baud modes. The "open" modes are useful for "multidrop"
systems where you want several stamps connected together on one
serial bus.
As to "inverted" vs "non-inverted" ("true"), it depends on whether
you have an inverting line driver between the Stamp and the other
equipment. It helps to know how the RS232 line works. External
equipment expects the RS232 line to rest at a low level, usually -5
to -15 volts, although many devices will accept 0 volts as a valid
low level. Then when data comes along, the RS232 line pulses to a
high level of +5 to +15 volts. On the RS232 line, the low level is
the "1" or "marking" state and the high level is the "0" or spacing
state. That is why RS232 is called an inverted logic (low is "1" and
high is "0").
-- If you connect directly to one of the Stamp io pins p0 to p15
(or x0 to x15 on the big stamps), you should use the "inverted" baud
modes, for example, $4054 for 9600 baud on the BS2. Be sure to
include a resistor of ~20kohms on the pin you use for input to the
Stamp, because some RS232 ports do generate +/-15 volts on their
serial ports, and the resistor is needed to limit the current. Also,
include a 200 to 1000 ohm resistor on the Stamp pin you use for
serial output.
-- If you connect an inverting line driver like the <MAX232>
between the Stamp pin and your external device, then use the
"non-inverted" baud modes, like $54 for 9600 baud on the BS2. The
line driver inverts the signal both for input and output.
-- If you connect your external equipment to the Stamp system port,
addressed as p16, then use the "noninverted" baud modes (e.g. $54 for
9600 on the BS2), because that port includes an inverting line
driver. Actually, you could also use the "inverted" mode, because
the interpreter will just go ahead and use non-inverted anyway. The
mode does affect the flow control signal if you are using it, which
is a useful option, but that is off topic.
-- If you are connecting directly from one stamp to another, it
does not matter from a logical point of view which one you use, so
long as they agree on both ends.
I hope that clears it up for you. I know I have to look it up
every time. I have a little more reference information posted at
<http://www.emesys.com/BS2rs232.htm#Baudmode>
-- best regards
Tracy Allen
electronically monitored ecosystems
http://www.emesystems.com
mailto:tracy@e...
Thanks for all the helpful information on serial
interfacing. Here's another question in the same vein: Can
anyone suggest a simple optical isolation circuit for serial
communication between a stamp and a laptop serial port? It
would be nice if the PC side of the circuit could be powered
from the laptop serial port so that no additional power
supply is required.
Thanks,
Michael
>
>Thanks for all the helpful information on serial
>interfacing. Here's another question in the same vein: Can
>anyone suggest a simple optical isolation circuit for serial
>communication between a stamp and a laptop serial port? It
>would be nice if the PC side of the circuit could be powered
>from the laptop serial port so that no additional power
>supply is required.
>
>Thanks,
>Michael
Many PCs have an IRDA serial infrared port built in. You can use
that with the Stamp, if you provide the Stamp with an IrDA interface.
Here is one using the MAX3100:
http://www.emesys.com/BS2IrDA.htm
Another option might be the RS232<->IR chips from Rentron, or the new
IRbuddy from Parallax. Those modules use high frequency modulation
to achieve much greater range than is possible with IrDA.
-- Tracy
volts -- the communication line is held low and driven high by the bits.
The inverted signal (like a PC uses) are pulses going from 5 volts to zero
volts -- the communication line is held high and driven low by the bits.
Its better just to use the standard mode for Stamp to Stamp stuff. Some
serial LCD controllers do use inverted signal though.
Original Message
> I understand the use of the size, parity and baudrate bits for the
> SERIN and SEROUT commands; however, I don't understand the purpose
> of the "driven" or "inverted" bits.
>
> Could someone explain how I'd determine whether I needed to set one
> or both (ie. are there simple tests to determine whether the device
> I'm sending-to or receiving-from is configured as "driven"
> or "inverted")?