Anoter SEROUT question
Archiver
Posts: 46,084
What does Inverted mode mean versus True?
Suppose I have SEROUT 0, Baud, [noparse][[/noparse]myData] for my BS2.
Suppose myData is VAR Byte and equals %01000001 (for character "A").
If Baud=84 (9600 bps, 8 bit, no parity, TRUE), then what gets sent
out on pin 0? %01000001?
If Baud=16468 (9600 bps, 8 bit, no parity, INVERTED), then what gets
sent out on pin 0? %10111110 (i.e. myData inverted)?
Is my understanding correct?
Suppose I have SEROUT 0, Baud, [noparse][[/noparse]myData] for my BS2.
Suppose myData is VAR Byte and equals %01000001 (for character "A").
If Baud=84 (9600 bps, 8 bit, no parity, TRUE), then what gets sent
out on pin 0? %01000001?
If Baud=16468 (9600 bps, 8 bit, no parity, INVERTED), then what gets
sent out on pin 0? %10111110 (i.e. myData inverted)?
Is my understanding correct?
Comments
>What does Inverted mode mean versus True?
>
>Suppose I have SEROUT 0, Baud, [noparse][[/noparse]myData] for my BS2.
>
>Suppose myData is VAR Byte and equals %01000001 (for character "A").
>
>If Baud=84 (9600 bps, 8 bit, no parity, TRUE), then what gets sent
>out on pin 0? %01000001?
>
>If Baud=16468 (9600 bps, 8 bit, no parity, INVERTED), then what gets
>sent out on pin 0? %10111110 (i.e. myData inverted)?
>
>Is my understanding correct?
Yes you are correct.... The ability to "invert" the data through
software, in a way "hand-shakes" with your hardware. Suppose you
are converting from a 5V level to a 12V level (pseudo RS232).
On your hardware end you might only have a single transistor (NPN)
doing this...
EXAMPLE:
o
> Output
|
C----o----/\/\----> +12V
StampPin >--/\/\----B 2.2K
1K E----GND
...Here you have another inversion through Hardware because of the
nature of the transistor. So an easy fix to correct this is through
your software by sending the data inverted.
-Beau Schwabe
If you want to use the DB-9 on the BOE,
(which is connected to pseudo-port 16,
which has a pseudo MAX232 driver on it)
then you should use 'INVERT' mode.
If you want to receive from a PC with
only a 22kohm resistor in series, then
you should use 'Normal' mode
('non-invert' mode).
As far as I can tell, you use 'Invert'
mode when you have a 232 driver in-circuit.
You use 'Normal' mode when you don't.
Your analysis of the bit patterns sent
seems correct, though I have never actually
looked at the serout with a logic analyzer.
--- In basicstamps@yahoogroups.com, "yellowniter" <yellowniter@y...>
wrote:
> What does Inverted mode mean versus True?
>
> Suppose I have SEROUT 0, Baud, [noparse][[/noparse]myData] for my BS2.
>
> Suppose myData is VAR Byte and equals %01000001 (for character "A").
>
> If Baud=84 (9600 bps, 8 bit, no parity, TRUE), then what gets sent
> out on pin 0? %01000001?
>
> If Baud=16468 (9600 bps, 8 bit, no parity, INVERTED), then what
gets
> sent out on pin 0? %10111110 (i.e. myData inverted)?
>
> Is my understanding correct?
>What does Inverted mode mean versus True?
>
>Suppose I have SEROUT 0, Baud, [noparse][[/noparse]myData] for my BS2.
>
>Suppose myData is VAR Byte and equals %01000001 (for character "A").
>
>If Baud=84 (9600 bps, 8 bit, no parity, TRUE), then what gets sent
>out on pin 0? %01000001?
>
>If Baud=16468 (9600 bps, 8 bit, no parity, INVERTED), then what gets
>sent out on pin 0? %10111110 (i.e. myData inverted)?
>
>Is my understanding correct?
Hi Yellowniter,
RS232 standard transmits least significant bit first, so you would
have to read what you have written above from right to left. But
even before the least significant bit, there is a START bit, and at
the end, there is at least one STOP bit.
The RS232 line is idle in the "1" state, which is also called
"marking", because in the early days of teleprinters, the pen was
down marking the tape and lifted up to transmit a "0" or "space".
RS232 is an "inverted" logic, so the logical "1" state is by
convention transmitted as a low (negative voltage, think "pen down")
level, and a zero is transmitted as a high (positive voltage, think
"pen up") level.
When a single letter "A" is transmitted, reading from left to right,
the logic true state looks like this:
111111111111111101000001001111111111111111111 --> time
^ ^
start "A" stop
Note that the resting state is logical 1, and then comes the start
bit, a zero, then the least significant bit, a one, and then the
other 7 bits, and then the obligatory stop bit, a 1, and then an
indeterminate number of additional ones.
Since RS232 standard is an inverted logic, voltage level is
"inverted" from the logic level:
volts ________________-_
_--___________________ low idle=1, high=0
logic 111111111111111101000001001111111111111111111
^ ^
start "A" stop
A logical 1 is the most negative voltage and the logical zero is the
most positive voltage. That may be -15 volts and +15 volts, or it
might be 0 volts and 5 volts.
(diagrams need monospace font to line up properly)
The Stamp can do either true or inverted on its regular pins p0 to
p15 (and on x0 to x15 on the '2p).
"True" with baudmode $54 (84 decimal, BS2, BS2e and BS2pe), sends
data where a 1 gives a high output level, like this:
111111111111111101000001001111111111111111111
_-_____-__
While "inverted" with $4000 added, sends data where a 1 gives a low
output level:
111111111111111101000001001111111111111111111
________________-_
_--___________________ low resting=1, high=0
Either of these transmits least significant bit first and append the
start and the stop bit(s). You also have an option for 7 bits, even
parity, but that is another matter.
If you are going to send or receive data on a Stamp pin to/from a
standard RS232 line, you will use the inverted baudmode $4054.
If you are going to use a hardware inverter between the stamp pin and
a standard RS232 line, in either transmit or receive, then you will
use the true baudmode $54, because the hardware inverter does the
inverting (duh!)!
If you are transmitting between two stamps, you can do anything you
want, so long as the settings on both ends agree.
In the open baud modes, the state that represents the zero is
actively driven. The state that represents 1, the idle line, is left
as a high impedance and requires the pullup or pulldown resistor. In
the true baudmode, that is a pullup resistor, and in the inverted
mode, it is a pulldown resistor.
During the line "idle" state, other Stamps can take control of the
line in a master-slave, ring, peer to peer, etc scenario. It is
possible with diodes to rig up standard PC serial port to act as if
open baudmode, so it can participate in the network. Open mode is
more subject to noise pickup, which may or may not be a
consideration.
The Stamp's logical pin P16 is a special case. It includes a built
in hardware inverter, a transistor circuit. So you would normally
want to drive it with the True baudmode, $54. But in fact the
PBASIC compiler ignores the $4000 setting, and you can use either $54
or $4054, and it transmits the same either way to interface RS232
standard. The true/inverted option does matter when you use a flow
control pin with the SEROUT command, and which one you use will
depend on whether or not the flow control pin itself has a hardware
inverter.
I hope that sort of summarizes the options for you,
-- Tracy Allen
http://www.emesystems.com/BS2rs232.htm
I think there might be a small typo. You wrote:
"True" with baudmode $54 (84 decimal, BS2, BS2e and BS2pe), sends
> data where a 1 gives a high output level, like this:
> 111111111111111101000001001111111111111111111
>
_-_____-__
Should it have been 11111101000001011111 instead?
Starting from left to right, the 111111 are idle.
First 0 is the Start.
Then comes 10000010 (LSB to MSB) for letter "A" (%01000001 or 0x41).
Then comes 1 for Stop.
Then it stays at idle (11111).
Or is there something I missed?
Otherwise, I follow what you said.
Thank you.
--- In basicstamps@yahoogroups.com, Tracy Allen <tracy@e...> wrote:
> Yellowniter wrote:
> >What does Inverted mode mean versus True?
> >
> >Suppose I have SEROUT 0, Baud, [noparse][[/noparse]myData] for my BS2.
> >
> >Suppose myData is VAR Byte and equals %01000001 (for
character "A").
> >
> >If Baud=84 (9600 bps, 8 bit, no parity, TRUE), then what gets sent
> >out on pin 0? %01000001?
> >
> >If Baud=16468 (9600 bps, 8 bit, no parity, INVERTED), then what
gets
> >sent out on pin 0? %10111110 (i.e. myData inverted)?
> >
> >Is my understanding correct?
>
>
> Hi Yellowniter,
>
>
> RS232 standard transmits least significant bit first, so you would
> have to read what you have written above from right to left. But
> even before the least significant bit, there is a START bit, and at
> the end, there is at least one STOP bit.
>
> The RS232 line is idle in the "1" state, which is also called
> "marking", because in the early days of teleprinters, the pen was
> down marking the tape and lifted up to transmit a "0" or "space".
>
> RS232 is an "inverted" logic, so the logical "1" state is by
> convention transmitted as a low (negative voltage, think "pen
down")
> level, and a zero is transmitted as a high (positive voltage, think
> "pen up") level.
>
> When a single letter "A" is transmitted, reading from left to
right,
> the logic true state looks like this:
> 111111111111111101000001001111111111111111111 --> time
> ^ ^
> start "A" stop
> Note that the resting state is logical 1, and then comes the start
> bit, a zero, then the least significant bit, a one, and then the
> other 7 bits, and then the obligatory stop bit, a 1, and then an
> indeterminate number of additional ones.
>
> Since RS232 standard is an inverted logic, voltage level is
> "inverted" from the logic level:
>
> volts ________________-_
_--___________________ low
idle=1, high=0
>
> logic 111111111111111101000001001111111111111111111
> ^ ^
> start "A" stop
>
> A logical 1 is the most negative voltage and the logical zero is
the
> most positive voltage. That may be -15 volts and +15 volts, or it
> might be 0 volts and 5 volts.
>
> (diagrams need monospace font to line up properly)
>
>
> The Stamp can do either true or inverted on its regular pins p0 to
> p15 (and on x0 to x15 on the '2p).
>
> "True" with baudmode $54 (84 decimal, BS2, BS2e and BS2pe), sends
> data where a 1 gives a high output level, like this:
> 111111111111111101000001001111111111111111111
>
_-_____-__
>
>
> While "inverted" with $4000 added, sends data where a 1 gives a low
> output level:
> 111111111111111101000001001111111111111111111
> ________________-_
_--___________________ low resting=1,
high=0
>
> Either of these transmits least significant bit first and append
the
> start and the stop bit(s). You also have an option for 7 bits,
even
> parity, but that is another matter.
>
> If you are going to send or receive data on a Stamp pin to/from a
> standard RS232 line, you will use the inverted baudmode $4054.
>
> If you are going to use a hardware inverter between the stamp pin
and
> a standard RS232 line, in either transmit or receive, then you will
> use the true baudmode $54, because the hardware inverter does the
> inverting (duh!)!
>
> If you are transmitting between two stamps, you can do anything you
> want, so long as the settings on both ends agree.
>
> In the open baud modes, the state that represents the zero is
> actively driven. The state that represents 1, the idle line, is
left
> as a high impedance and requires the pullup or pulldown resistor.
In
> the true baudmode, that is a pullup resistor, and in the inverted
> mode, it is a pulldown resistor.
> During the line "idle" state, other Stamps can take control of the
> line in a master-slave, ring, peer to peer, etc scenario. It is
> possible with diodes to rig up standard PC serial port to act as if
> open baudmode, so it can participate in the network. Open mode is
> more subject to noise pickup, which may or may not be a
> consideration.
>
> The Stamp's logical pin P16 is a special case. It includes a built
> in hardware inverter, a transistor circuit. So you would normally
> want to drive it with the True baudmode, $54. But in fact the
> PBASIC compiler ignores the $4000 setting, and you can use either
$54
> or $4054, and it transmits the same either way to interface RS232
> standard. The true/inverted option does matter when you use a flow
> control pin with the SEROUT command, and which one you use will
> depend on whether or not the flow control pin itself has a hardware
> inverter.
>
> I hope that sort of summarizes the options for you,
>
> -- Tracy Allen
> http://www.emesystems.com/BS2rs232.htm
>
>I think there might be a small typo. You wrote:
>
>"True" with baudmode $54 (84 decimal, BS2, BS2e and BS2pe), sends
>> data where a 1 gives a high output level, like this:
>> 111111111111111101000001001111111111111111111
>>
_-_____-__
>
>Should it have been 11111101000001011111 instead?
You're absolutely right; an extra "0" is in there at the end.
>
>Starting from left to right, the 111111 are idle.
>First 0 is the Start.
>Then comes 10000010 (LSB to MSB) for letter "A" (%01000001 or 0x41).
>Then comes 1 for Stop.
>Then it stays at idle (11111).
>
>Or is there something I missed?
>
>Otherwise, I follow what you said.
>
>Thank you.
>
>
>
>
>--- In basicstamps@yahoogroups.com, Tracy Allen <tracy@e...> wrote:
>> Yellowniter wrote:
>> >What does Inverted mode mean versus True?
>> >
>> >Suppose I have SEROUT 0, Baud, [noparse][[/noparse]myData] for my BS2.
>> >
>> >Suppose myData is VAR Byte and equals %01000001 (for
>character "A").
>> >
>> >If Baud=84 (9600 bps, 8 bit, no parity, TRUE), then what gets sent
>> >out on pin 0? %01000001?
>> >
>> >If Baud=16468 (9600 bps, 8 bit, no parity, INVERTED), then what
>gets
>> >sent out on pin 0? %10111110 (i.e. myData inverted)?
>> >
>> >Is my understanding correct?
>>
>>
>> Hi Yellowniter,
>>
>>
>> RS232 standard transmits least significant bit first, so you would
>> have to read what you have written above from right to left. But
>> even before the least significant bit, there is a START bit, and at
>> the end, there is at least one STOP bit.
>>
>> The RS232 line is idle in the "1" state, which is also called
>> "marking", because in the early days of teleprinters, the pen was
>> down marking the tape and lifted up to transmit a "0" or "space".
>>
>> RS232 is an "inverted" logic, so the logical "1" state is by
>> convention transmitted as a low (negative voltage, think "pen
>down")
>> level, and a zero is transmitted as a high (positive voltage, think
>> "pen up") level.
>>
>> When a single letter "A" is transmitted, reading from left to
>right,
>> the logic true state looks like this:
>> 111111111111111101000001001111111111111111111 --> time
>> ^ ^
>> start "A" stop
>> Note that the resting state is logical 1, and then comes the start
>> bit, a zero, then the least significant bit, a one, and then the
>> other 7 bits, and then the obligatory stop bit, a 1, and then an
>> indeterminate number of additional ones.
>>
>> Since RS232 standard is an inverted logic, voltage level is
>> "inverted" from the logic level:
>>
>> volts ________________-_
_--___________________ low
>idle=1, high=0
>>
>> logic 111111111111111101000001001111111111111111111
>> ^ ^
>> start "A" stop
>>
>> A logical 1 is the most negative voltage and the logical zero is
>the
>> most positive voltage. That may be -15 volts and +15 volts, or it
>> might be 0 volts and 5 volts.
>>
>> (diagrams need monospace font to line up properly)
>>
>>
>> The Stamp can do either true or inverted on its regular pins p0 to
>> p15 (and on x0 to x15 on the '2p).
>>
>> "True" with baudmode $54 (84 decimal, BS2, BS2e and BS2pe), sends
>> data where a 1 gives a high output level, like this:
>> 111111111111111101000001001111111111111111111
>>
_-_____-__
>>
>>
>> While "inverted" with $4000 added, sends data where a 1 gives a low
>> output level:
>> 111111111111111101000001001111111111111111111
>> ________________-_
_--___________________ low resting=1,
>high=0
>>
>> Either of these transmits least significant bit first and append
>the
>> start and the stop bit(s). You also have an option for 7 bits,
>even
>> parity, but that is another matter.
>>
>> If you are going to send or receive data on a Stamp pin to/from a
>> standard RS232 line, you will use the inverted baudmode $4054.
>>
>> If you are going to use a hardware inverter between the stamp pin
>and
>> a standard RS232 line, in either transmit or receive, then you will
>> use the true baudmode $54, because the hardware inverter does the
>> inverting (duh!)!
>>
>> If you are transmitting between two stamps, you can do anything you
>> want, so long as the settings on both ends agree.
>>
>> In the open baud modes, the state that represents the zero is
>> actively driven. The state that represents 1, the idle line, is
>left
>> as a high impedance and requires the pullup or pulldown resistor.
>In
>> the true baudmode, that is a pullup resistor, and in the inverted
>> mode, it is a pulldown resistor.
>> During the line "idle" state, other Stamps can take control of the
>> line in a master-slave, ring, peer to peer, etc scenario. It is
>> possible with diodes to rig up standard PC serial port to act as if
>> open baudmode, so it can participate in the network. Open mode is
>> more subject to noise pickup, which may or may not be a
>> consideration.
>>
>> The Stamp's logical pin P16 is a special case. It includes a built
>> in hardware inverter, a transistor circuit. So you would normally
>> want to drive it with the True baudmode, $54. But in fact the
>> PBASIC compiler ignores the $4000 setting, and you can use either
>$54
>> or $4054, and it transmits the same either way to interface RS232
>> standard. The true/inverted option does matter when you use a flow
>> control pin with the SEROUT command, and which one you use will
>> depend on whether or not the flow control pin itself has a hardware
>> inverter.
>>
>> I hope that sort of summarizes the options for you,
>>
>> -- Tracy Allen
>> http://www.emesystems.com/BS2rs232.htm
>
>
>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/