Shop OBEX P1 Docs P2 Docs Learn Events
Help with RS232C on SX28 — Parallax Forums

Help with RS232C on SX28

John WhitfieldJohn Whitfield Posts: 42
edited 2005-05-28 07:55 in General Discussion
I was wondering if anyone knew of a good method for doing RS232C communication using the SSX28?

Comments

  • kjennejohnkjennejohn Posts: 171
    edited 2005-05-25 05:57
    Hello, John.
    Help us minimize covering all the possibilities. What are trying to do? Does it involve multi-drops (more than two devices on the network, usually a master-slave setup)? Can you do assembly, or do you prefer BASIC? Are you aware Ubicom has several Virtual Peripherals? One of these is an 8-channel UART!

    Later!
    kenjj
  • BeanBean Posts: 8,129
    edited 2005-05-25 10:42
    John,
    If you care to use the SX/B compiler, there is SERIN and SEROUT commands.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95 http://www.parallax.com/detail.asp?product_id=30012


    Product web site: www.sxvm.com

    "It's not getting what you want, it's wanting what you've got."
    ·
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-05-25 12:36
    As Bean pointed out, SX/B has SERIN and SEROUT commands, and by adding a MAX232 to your circuit you should be ready to go.· The Professional Development Board has a socket for the SX28 and a MAX232 (with DB9) right on the board -- this is a perfect setup for the experiments you're looking to do.

    http://www.parallax.com/detail.asp?product_id=28138

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • James NewtonJames Newton Posts: 329
    edited 2005-05-25 20:36
    Jon Williams (Parallax) said...
    As Bean pointed out, SX/B has SERIN and SEROUT commands, and by adding a MAX232 to your circuit you should be ready to go.· The Professional Development Board has a socket for the SX28 and a MAX232 (with DB9) right on the board -- this is a perfect setup for the experiments you're looking to do.

    http://www.parallax.com/detail.asp?product_id=28138
    For your existing projects, you can use an external·level converter like the RCL-1
    http://www.sxlist.com/techref/io/serial/RCL1.htm

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ---
    James Newton, Host of SXList.com
    james@sxlist.com 1-619-652-0593 fax:1-208-279-8767
    SX FAQ / Code / Tutorials / Documentation:
    http://www.sxlist.com Pick faster!



  • Andrew BellingerAndrew Bellinger Posts: 7
    edited 2005-05-26 00:39
    I am currently trying to control the 4x20 matrix orbital LCD which is working ok with serout from an SX28. I am able to send characters, move curser, turn backlight on/off etc. . . The only problem Im having is that the Serout command only sends one byte at a time and each instance of it takes up quite a bit of space in the SX. Does anyone know any efficient loops or code for building strings of IO to be sent and recieved with Serin/Serout?

    It seems most of the LCD control programs out there are for the hitachi compatible 4 pin and 8 pin LCDs.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "Real Programmers always confuse Christmas and Halloween because Oct31 == Dec25· !" ····Andrew Rutherford.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-05-26 01:30
    Don't use more than one instance of SEROUT in your program -- embed it into a subroutine so that it's only compiled once.· I use something like the routine below which let's me send a character and an optional number of repeats.

    TXCHAR:
    · temp1 = __PARAM1
    · IF __PARAMCNT = 1 THEN
    ··· temp2 = 1
    · ELSE
    ··· temp2 = __PARAM2
    · ENDIF
    · DO WHILE temp2 > 0
    ··· SEROUT Sout, Baud, temp1
    ··· DEC temp2
    · LOOP
    · RETURN

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • John WhitfieldJohn Whitfield Posts: 42
    edited 2005-05-26 05:43
    Sorry I didn't get back with you earlier since I had to leave town today, but while I appreaciate the advice I am using assembly. I have attached the file I am working with, which was rewritten earlier for another reason by Gunther Daubach. The second UART, which operates at·9600 baud,·is functioning properly with the device to which it is attached. The first device, according to the logic analyzer, uses two pins at constant voltages, two for I/O, and a ground. The voltage levels appear to correspond to rs232, sort of. The original problem was that the first device was 1200 baud, 7 data bits, 2 stop bits, but the second was 9600, 8, 1. I think Gunther fixed this with his program rewrite, however until I can get the hardware to function together properly, I can't be entirely sure. Please excuse the grammer, I'm tired.

    -John Whitfield
  • John WhitfieldJohn Whitfield Posts: 42
    edited 2005-05-28 01:21
    I think maybe I should clarify what I am asking. How do connect the other pins besides the I/O pins?

    GND = pin 5
    +11V = pin 4
    input = pin 3
    output = pin 2
    -11V = pin 7

    It is not necessary to connect the other pins when using a computer with realterm to send and receive data from the device. The only thing that is confusing is that realterm must be set to flow control rs485 to send and receive data, yet the voltages appear to be rs232C, the devices manual claims it is rs232C, and the logic analyzer only shows changes on it the input and output pins, the other voltages appear to be constant.
    When no data is being sent across the input pin (3) its voltage is -11V, and when no data is being sent the output·pin (2) its voltage is -3V. I tried just setting the constant voltage pins to those voltages, and then running the input and output pins through a max233, just to·see if I can get it to work under the no flow control mode of the terminal program.·If anybody has any ideas I could really use some.
  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2005-05-28 07:55
    John,

    in the code you have posted, you use instructions like

    not TxHigh1
    not TxLow1

    for negated output, and in Transmit1, you use

    movb TxPin1, TxLow1.6

    twice (once on the negated data, and one more time after negating TxLow1 again).

    IMO, this can't work properly.

    I would remove the not instructions and use

    movb TxPin1, /TxLow1.6

    for negating the output, instead.

    In Transmit2, you only have one

    movb TxOin2, TxLow.6

    instruction plus not instructions before and after the movb. Again, I would remove the not instructions, and use

    movb TxOin2, /TxLow.6

    when yoou need inverted output.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    G
Sign In or Register to comment.