DefineCom3

Started by David Sousa Mendes February 5, 2009
After working several times with DefineCom3 together with OpenCom(3, ...)some questions arise:

Imagine we have this piece of code:
Call DefineCom3(16, 17, bx1000_1000))

Call OpenCom(3, 9600, InputBuffer, OutputBuffer)
1- The I/O pins from BX work on a 0-5V logic right? So, what happens when we set pins 16 and 17 as input and output pins of the serial communication? Do those pins start working on a +9V-9V logic?

2 - What if I want to connect two BX microcontrolers by this communications port? Should I set it to inverted logic or not? Is the microcontroler able to work on both logics?

David



Hi
I am very rusty on BX24s.
But.
The i/o pins are always 5v logic no matter what you do with them. So
when you attach Com3 to them they will still only work at 5v logic
levels. The logic level will be True ie logic 0 is 0v and logic 1 is
high (5v).
Normal RS232 is inverted, ie logic 1 is -v and logic 0 is +V. A lot
of PCs will be able to read the signal from the BX-24 if the
transmission is set to inverted (if possible, it must be in the
manual). Transmission from the PC to the BX is at too high a voltage
but a 22k series resistor (in conjunction with the pins internal
protection diode) will safely limit the voltage.
>From BX-24 to Bx-24 you can just connect the pins directly and it
doesn't matter if both BXs are set to True or Inverted as long as
they are both the same and Tx from one goes to Rx on the other.

David

--- In b..., "David Sousa Mendes"
wrote:
>
> After working several times with DefineCom3 together with OpenCom
(3, ...)some questions arise:
>
> Imagine we have this piece of code:
> Call DefineCom3(16, 17, bx1000_1000))
>
> Call OpenCom(3, 9600, InputBuffer, OutputBuffer)
> 1- The I/O pins from BX work on a 0-5V logic right? So, what
happens when we set pins 16 and 17 as input and output pins of the
serial communication? Do those pins start working on a +9V-9V logic?
>
> 2 - What if I want to connect two BX microcontrolers by this
communications port? Should I set it to inverted logic or not? Is the
microcontroler able to work on both logics?
>
> David
>
>
>

Thanks David
According to what you say, a PC (RS232: -9V to +9V) can read directly from a BX comm port (0V to 5V) as long as we configure the BX to inverted logic, right?

1 - But still there is something that does not make sense. I accept that a PC can read 5V and take it as if it was 9V (logic value FALSE). But accepting that the PC reads 0V as it was -9V it's harder because 0V in RS232C belongs to the forbitten region.
If we look at wikepedias RS232 protocol, we read:
"The RS-232 standard defines the voltage levels that correspond to logical one and logical zero levels. Valid signals are plus or minus 3 to 15 volts. The range near zero volts is not a valid RS-232 level". Can someone explain this to me?

2 - If we can connect directly 0-5V microcontrolers to -9+9V PCs, what is the use of Maxxim's max232 converter?

Thanks for your help

David

----- Original Message -----
From: David L Buckley
To: b...
Sent: Friday, February 06, 2009 4:38 PM
Subject: [BasicX] Re: DefineCom3
Hi
I am very rusty on BX24s.
But.
The i/o pins are always 5v logic no matter what you do with them. So
when you attach Com3 to them they will still only work at 5v logic
levels. The logic level will be True ie logic 0 is 0v and logic 1 is
high (5v).
Normal RS232 is inverted, ie logic 1 is -v and logic 0 is +V. A lot
of PCs will be able to read the signal from the BX-24 if the
transmission is set to inverted (if possible, it must be in the
manual). Transmission from the PC to the BX is at too high a voltage
but a 22k series resistor (in conjunction with the pins internal
protection diode) will safely limit the voltage.
From BX-24 to Bx-24 you can just connect the pins directly and it
doesn't matter if both BXs are set to True or Inverted as long as
they are both the same and Tx from one goes to Rx on the other.

David

--- In b..., "David Sousa Mendes"
wrote:
>
> After working several times with DefineCom3 together with OpenCom
(3, ...)some questions arise:
>
> Imagine we have this piece of code:
> Call DefineCom3(16, 17, bx1000_1000))
>
> Call OpenCom(3, 9600, InputBuffer, OutputBuffer)
>
>
> 1- The I/O pins from BX work on a 0-5V logic right? So, what
happens when we set pins 16 and 17 as input and output pins of the
serial communication? Do those pins start working on a +9V-9V logic?
>
> 2 - What if I want to connect two BX microcontrolers by this
communications port? Should I set it to inverted logic or not? Is the
microcontroler able to work on both logics?
>
> David
>
>
>



Yes according to the specs it can't work but fortunately the PC
hardware doesn't seem to care and most? some? all?(no) PCs can work
with 0 and 5v signals. Using a max232 chip (or similar *) means the
voltages meet the spec and so work with any other hardware meeting
the spec. If your computer won't read 0/5v signals you can't take it
back to the shop because it is not supposed to be able to. Also
connecting you microcontroller direct to rs232 level signals will
blow up your microcontroller, well probably just kill it. The series
22k resistor limits the current to that which can be tolerated by the
protection diode on the input pin of the microcontroller. usng a
max232* chip means you don't have to worry about limiting the
current. Using 0/5v signals to a PC means there is no noise imunity
and you won't be able to use long cables.
If it all works without a max232* take it as a bonus, if it doesn't
then use the chip.

David
--- In b..., "David Sousa Mendes"
wrote:
>
> Thanks David
> According to what you say, a PC (RS232: -9V to +9V) can read
directly from a BX comm port (0V to 5V) as long as we configure the
BX to inverted logic, right?
>
> 1 - But still there is something that does not make sense. I accept
that a PC can read 5V and take it as if it was 9V (logic value
FALSE). But accepting that the PC reads 0V as it was -9V it's harder
because 0V in RS232C belongs to the forbitten region.
> If we look at wikepedias RS232 protocol, we read:
> "The RS-232 standard defines the voltage levels that correspond to
logical one and logical zero levels. Valid signals are plus or minus
3 to 15 volts. The range near zero volts is not a valid RS-232
level". Can someone explain this to me?
>
> 2 - If we can connect directly 0-5V microcontrolers to -9+9V PCs,
what is the use of Maxxim's max232 converter?
>
> Thanks for your help
>
> David
> ----- Original Message -----
> From: David L Buckley
> To: b...
> Sent: Friday, February 06, 2009 4:38 PM
> Subject: [BasicX] Re: DefineCom3
> Hi
> I am very rusty on BX24s.
> But.
> The i/o pins are always 5v logic no matter what you do with them.
So
> when you attach Com3 to them they will still only work at 5v
logic
> levels. The logic level will be True ie logic 0 is 0v and logic 1
is
> high (5v).
> Normal RS232 is inverted, ie logic 1 is -v and logic 0 is +V. A
lot
> of PCs will be able to read the signal from the BX-24 if the
> transmission is set to inverted (if possible, it must be in the
> manual). Transmission from the PC to the BX is at too high a
voltage
> but a 22k series resistor (in conjunction with the pins internal
> protection diode) will safely limit the voltage.
> From BX-24 to Bx-24 you can just connect the pins directly and it
> doesn't matter if both BXs are set to True or Inverted as long as
> they are both the same and Tx from one goes to Rx on the other.
>
> David
>
> --- In b..., "David Sousa Mendes"
> wrote:
> >
> > After working several times with DefineCom3 together with
OpenCom
> (3, ...)some questions arise:
> >
> > Imagine we have this piece of code:
> > Call DefineCom3(16, 17, bx1000_1000))
> >
> > Call OpenCom(3, 9600, InputBuffer, OutputBuffer)
> >
> >
> > 1- The I/O pins from BX work on a 0-5V logic right? So, what
> happens when we set pins 16 and 17 as input and output pins of
the
> serial communication? Do those pins start working on a +9V-9V
logic?
> >
> > 2 - What if I want to connect two BX microcontrolers by this
> communications port? Should I set it to inverted logic or not? Is
the
> microcontroler able to work on both logics?
> >
> > David
> >
> >
> >
>
>
>

Thanks a lot, David
Now everything is clear!
Regards

David .

----- Original Message -----
From: David L Buckley
To: b...
Sent: Sunday, February 08, 2009 4:12 PM
Subject: [BasicX] Re: DefineCom3
Yes according to the specs it can't work but fortunately the PC
hardware doesn't seem to care and most? some? all?(no) PCs can work
with 0 and 5v signals. Using a max232 chip (or similar *) means the
voltages meet the spec and so work with any other hardware meeting
the spec. If your computer won't read 0/5v signals you can't take it
back to the shop because it is not supposed to be able to. Also
connecting you microcontroller direct to rs232 level signals will
blow up your microcontroller, well probably just kill it. The series
22k resistor limits the current to that which can be tolerated by the
protection diode on the input pin of the microcontroller. usng a
max232* chip means you don't have to worry about limiting the
current. Using 0/5v signals to a PC means there is no noise imunity
and you won't be able to use long cables.
If it all works without a max232* take it as a bonus, if it doesn't
then use the chip.

David

--- In b..., "David Sousa Mendes"
wrote:
>
> Thanks David
> According to what you say, a PC (RS232: -9V to +9V) can read
directly from a BX comm port (0V to 5V) as long as we configure the
BX to inverted logic, right?
>
> 1 - But still there is something that does not make sense. I accept
that a PC can read 5V and take it as if it was 9V (logic value
FALSE). But accepting that the PC reads 0V as it was -9V it's harder
because 0V in RS232C belongs to the forbitten region.
> If we look at wikepedias RS232 protocol, we read:
> "The RS-232 standard defines the voltage levels that correspond to
logical one and logical zero levels. Valid signals are plus or minus
3 to 15 volts. The range near zero volts is not a valid RS-232
level". Can someone explain this to me?
>
> 2 - If we can connect directly 0-5V microcontrolers to -9+9V PCs,
what is the use of Maxxim's max232 converter?
>
> Thanks for your help
>
> David
>
>
>
>
>
>
>
>
> ----- Original Message -----
> From: David L Buckley
> To: b...
> Sent: Friday, February 06, 2009 4:38 PM
> Subject: [BasicX] Re: DefineCom3
>
>
> Hi
> I am very rusty on BX24s.
> But.
> The i/o pins are always 5v logic no matter what you do with them.
So
> when you attach Com3 to them they will still only work at 5v
logic
> levels. The logic level will be True ie logic 0 is 0v and logic 1
is
> high (5v).
> Normal RS232 is inverted, ie logic 1 is -v and logic 0 is +V. A
lot
> of PCs will be able to read the signal from the BX-24 if the
> transmission is set to inverted (if possible, it must be in the
> manual). Transmission from the PC to the BX is at too high a
voltage
> but a 22k series resistor (in conjunction with the pins internal
> protection diode) will safely limit the voltage.
> From BX-24 to Bx-24 you can just connect the pins directly and it
> doesn't matter if both BXs are set to True or Inverted as long as
> they are both the same and Tx from one goes to Rx on the other.
>
> David
>
> --- In b..., "David Sousa Mendes"
> wrote:
> >
> > After working several times with DefineCom3 together with
OpenCom
> (3, ...)some questions arise:
> >
> > Imagine we have this piece of code:
> > Call DefineCom3(16, 17, bx1000_1000))
> >
> > Call OpenCom(3, 9600, InputBuffer, OutputBuffer)
> >
> >
> > 1- The I/O pins from BX work on a 0-5V logic right? So, what
> happens when we set pins 16 and 17 as input and output pins of
the
> serial communication? Do those pins start working on a +9V-9V
logic?
> >
> > 2 - What if I want to connect two BX microcontrolers by this
> communications port? Should I set it to inverted logic or not? Is
the
> microcontroler able to work on both logics?
> >
> > David
> >
> >
> >
>
>
>
>
>
>
>



> ... Using 0/5v signals to a PC means there is no noise immunity and
you won't be able to use long cables.

I've been doing a development project on a boat for some time and have
learned that most current NMEA devices (which originally used bipolar
RS232 levels) use 5v logic-level signaling. Some instrument wiring runs
are 50 feet or longer and work well at 4800 bps, and 38400 is coming
into common use.

To beat noise, principally due to ground loops, some devices have
differential inputs (essentially unipolar RS422 inputs) but many are
simply opto-isolated, drawing ~2mA to drive the LED; both use the ground
of the "talker", not the local ground.

FWIW.

Tom