Shop OBEX P1 Docs P2 Docs Learn Events
confusion in my cereal; ha i made a pun — Parallax Forums

confusion in my cereal; ha i made a pun

nick bernardnick bernard Posts: 329
edited 2004-12-08 16:01 in BASIC Stamp
HAIL BOARD!

i've been using 16624 as my baud for my serial communications... this baud origionated from my seetron display from scott edwards and i've always just used that single baud rate for everything else...
now if i'm not mistaken 16624 = 9600 8N1 inverted

now for the confusion...
i tried to send serial data from my application into hyperterminal or the debug window. i used a baud of 84 = 9600 8N1 to talk to the pc(debug terminal xor hyperterminal, that is one at a time) which was also set to 9600 8N1 ... but it did not work... i did notice, however, that the 16624 = 9600 8N1 inverted DID WORK... why is that... i thought that setting was for "open baud modes" or driving devices such as my lcd display...

the confustion lingers. enlighten me please! why is the pc is rx'ing up the inverted mode when i think it should be rx'ing the non-inverted mode?

ROX ON
nickB

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
League Bowling.... it's not a sport, it's a way of life

Comments

  • NewzedNewzed Posts: 2,503
    edited 2004-12-03 17:45
    16624 is not a standard baud rate for any Stamp that I know of.· If you are using a BS2, then the proper baud rate to communicate with Hyper is 16468.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    New Combo LCD Backpack

    http://hometown.aol.com/newzed/index.html
    ·
  • dandreaedandreae Posts: 1,375
    edited 2004-12-03 18:09
    Hello,

    16624 is 8-bit, no parity, inverted, which is used for the BS2p,BS2sx.· 84 is 8-bit, no parity, true, which is for the BS2, BS2e, and BS2pe.· If you look on page 297 of the BASIC Stamp manual, it will give you the different rates for each stamp.· Here is a link for the downlopad of the manual:· http://www.parallax.com/html_pages/downloads/basicstamps/documentation_basic_stamp.asp·.

    Dave



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Dave Andreae

    Tech Support
    dandreae@parallax.com
    www.parallax.com

    ·
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-12-03 18:35
    This is actually the second time today that I've posted this -- serial stuff is easy to handle by taking advantage of the IDE's conditional compilation capabilities.· This burb is at the top of my standard programming template:

    #SELECT $STAMP
      #CASE BS2, BS2E, BS2PE
        T1200       CON     813
        T2400       CON     396
        T4800       CON     188
        T9600       CON     84
        T19K2       CON     32
        TMidi       CON     12
        T38K4       CON     6
      #CASE BS2SX, BS2P
        T1200       CON     2063
        T2400       CON     1021
        T4800       CON     500
        T9600       CON     240
        T19K2       CON     110
        TMidi       CON     60
        T38K4       CON     45
    #ENDSELECT
     
    SevenBit        CON     $2000
    Inverted        CON     $4000
    Open            CON     $8000
    Baud            CON     T9600
    


    This takes the hassle out of serial parameters, especially if you want to move from Stamp-to-Stamp.

    If you go into the Edit/Preferences.../Files & Directories... you can set this file as the template that gets loaded when you select File/New or click the New icon on the toolbar.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • nick bernardnick bernard Posts: 329
    edited 2004-12-03 18:52
    HAIL Dave Andreae (Parallax)!
    RIGHTO! i did have 84 and 240 mixed up...

    HAIL ALL!
    but i'm still confused...
    why do i have to invert the data going into the PC when the PC has no "invert | true" option...
    (or) why doesnt it take the non-inverted data when there is no "invert | true"option...

    whoa is me
    nickB

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    League Bowling.... it's not a sport, it's a way of life
  • allanlane5allanlane5 Posts: 3,815
    edited 2004-12-03 18:56
    You have to 'invert' data going to your PC because it goes through a pseudo-MAX232 circuit made out of a few transistors on the BS2 module.

    If you recieve data *from* the PC on another BS2 pin, through a 22 Kohm resistor, then you would use a non-inverted mode, because there would be no MAX232 inverter/driver on that line.

    The 'Open' baud modes are so you can make a shared open-collector bus using SERIN/SEROUT. If you don't know what open-collector means, well there are other posts that explain this in more detail.
  • nick bernardnick bernard Posts: 329
    edited 2004-12-06 14:39
    hail allanlane5
    thx for the input...
    are you referring to the Sout pin (PIN 16) when you say "You have to 'invert' data going to your PC because it goes through a pseudo-MAX232 circuit made out of a few transistors on the BS2 module?"

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    League Bowling.... it's not a sport, it's a way of life
  • allanlane5allanlane5 Posts: 3,815
    edited 2004-12-06 16:11
    Yes, I am referring to the SOUT pin, which is the pin that gets driven when you say "SEROUT 16, xxxx"

    I think it is physically pin 3 on the BS2 module, by the way. I could be mistaken.

    Note for this to work, you *must* have wired the SIN pin, since the BS2 modulates the voltage from the PC coming in the SIN pin to make the SOUT signal. They save an additional power supply by doing this.
  • steve_bsteve_b Posts: 1,563
    edited 2004-12-06 18:19
    YES, do be sure to wire all pins less you have issues down the road, if not immediately!





    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    http://www.geocities.com/paulsopenstage

    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

  • nick bernardnick bernard Posts: 329
    edited 2004-12-06 18:38
    HAIL...i


    this is all begining to make a little more cents to me...
    thx to all

    but,
    i'm using pin 15 for my serial tx'n. does pin 15 have a tx buffer as such?

    also i have another application thar uses 9600 8N1 true (240 on the bs2sx) through a max232 to talk to a VB app (MScomm object set to 9600 8N1)... why is the serial data not inverted in that instance?


    cornflakes are my favorite cereal.
    rox on
    nickB

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    League Bowling.... it's not a sport, it's a way of life
  • steve_bsteve_b Posts: 1,563
    edited 2004-12-07 18:48
    Do mean a buffer in the sense of....of the receiver isn't ready to receive, the tx will wait until it is?· or even keep passing the data along until it gets it?

    There's no buffer so far as that in the stamps....no CRC....· Not to say you couldn't do it in software.

    So far as your True vs Inverted question.

    Google some RS232 specs on the net.
    For a quick breakdown....a 1 in TTL is +5volts (or above 2.5volts);· a 0 in TTL is 0volts (or below 2.5volts).
    now in RS232, the voltage levels are + and - 12volts.· But, the relationships are reversed.
    SO: a 0 in RS232 isn't 0volts....it's +12. and a 1 in RS232 is -12volts.

    notice the 'INVERSION'·from TTL to RS232.· Nowadays, power management in laptops (and other devices) has shrunk the rs232 levels to near +/-5volts.· The Stamp puts out 0 and +5.· Believe it or not....this is enough for most devices to discern some data from.
    BUT, in a stamp we must send out +5s and 0's right....and don't forget that our levels have to be inverted.· Hence the option of the 'INVERTED' baudmodes.

    Now, when you use an IC like the MAX232...it takes TTL data and converts it to proper RS232 levels.· SO, it is expecting a +5V to represent a binary 1 and 0volts to represent a binary 0.· SO, we MUST be sure we send out data as 'TRUE' wrt baudmodes.

    Remember too that the stamp can receive proper RS232 levels, but that a resistor is needed in series to prevent damage to pins.
    You would have to 'SERIN' this data as INVERTED data since it's coming as RS232 and not TTL (remember RS232 differentials are opposite of TTL in regards to binary 1's and 0's).

    I could go on....but I'm supposed to be working! cool.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    http://www.geocities.com/paulsopenstage

    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

  • allanlane5allanlane5 Posts: 3,815
    edited 2004-12-07 19:42
    Short answer on inversion -- test it till it works.

    And no, there is no RS-232 bufferering on the BS2 -- it only recieves the data if the BS2 is waiting on the SERIN command when the data comes in. If the BS2 is doing something else, it ignores the data.
  • nick bernardnick bernard Posts: 329
    edited 2004-12-08 15:38
    HAIL steve_b & allanlane5

    you guys are the ROX....
    i knew everything you guys were saying with the exception of "a 0 in RS232 isn't 0volts....it's +12. and a 1 in RS232 is -12volts."

    i kinda had to play dumb because i was fishing for an answer to a question that i didnt know how to put into words.

    please forgive the ignorance & thx for your patience

    ROX ON
    nickB

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    League Bowling.... it's not a sport, it's a way of life
  • allanlane5allanlane5 Posts: 3,815
    edited 2004-12-08 16:01
    Yes, RS232 specifications can be confusing.

    The RS232 line sits at an 'idle' state, when not sending data. I believe this is -12 volts. On the TTL side, this corresponds to a +5 voltage, or a '1' state (an inversion, see? + 5 to -12). When it wants to send a zero, it sends the voltage to +12 volts. On the TTL side, this corresponds to a zero voltage (also an inversion -- 0 volts goes to +12). Note +- 10 volts, and +- 5 volts also work.

    The device that translates TTL to RS232 voltage levels is called a '232 driver'. Once upon a time, you had to use the 1488 and 1489 drivers (one to send, one to recieve). The sender had to have a dual power supply, +12 and -12, to do its work.

    MAXIM came out with the MAX232 chip. This chip has an on-chip switching power supply that generates the +-10 volts, and has 2 recievers and 2 transmitters per chip. BUT, each driver is also an inverter.

    So, when you put TTL 'high', aka +5, aka '1' into the driver gate, -10 volts comes out the TX pin. When you put TTL 'low', aka 0 volts, aka '0' into the driver gate, +10 volts comes out the TX pin.

    However, you CAN tie two BS2 units together, without any drivers. And you can recieve from the PC without a driver by using a 22 Kohm resistor instead of the driver. In these instances, the RS232 signal will look 'INVERTED' from normal, since you don't have that MAX232 driver/inverter in the circuit.

    Thus the need for the 'INVERT' flag on the baud-rate parameter.
Sign In or Register to comment.