Shop OBEX P1 Docs P2 Docs Learn Events
RS232 on the STAMP PDB — Parallax Forums

RS232 on the STAMP PDB

AristotleAristotle Posts: 9
edited 2010-10-21 18:59 in BASIC Stamp
I have been trying (for some time now) to connect an old TRS-80 Model 100 PC running the old DOS Microsoft BASIC to a STAMP using the on-board DP9 RS232 DCE (with MAX232). I have the PDB and the PC connected via a NULL modem (DB25 on the PC side, DB9 on the Stamp PDB side). I have PIN 6 connected to the TX pin. Here is my simple code:

' {$STAMP BS2sx}
' {$PBASIC 2.5}

TXpin PIN 6
BaudMode CON 25597 ' 2400, 7, E, 1, Inverted (for the BS2sx)
serDataOut VAR Byte

Main:
' -- Sending to the RS TRS-80 --
FOR idx = 1 TO 20
serDataOut = "A"
SEROUT TXpin, BaudMode, [serDataOut]
PAUSE 2000
NEXT
END

- On the PC side, I have setup the serial port to receive at 2400 baud/7 bits/Even Parity/1 stop bit/Disable Line Status.
- On the Stamp side, I use 2400/7/E/Inverted.

The PC is sitting there receiving nothing, while the Stamp transmits "A" 20 times.

Any suggestions as to what I am missing?

Thank you,
A.

Comments

  • $WMc%$WMc% Posts: 1,884
    edited 2010-10-20 17:56
    Aristotle wrote: »
    I have been trying (for some time now) to connect an old TRS-80 Model 100 PC running the old DOS Microsoft BASIC to a STAMP using the on-board DP9 RS232 DCE (with MAX232). I have the PDB and the PC connected via a NULL modem (DB25 on the PC side, DB9 on the Stamp PDB side). I have PIN 6 connected to the TX pin. Here is my simple code:

    ' {$STAMP BS2sx}
    ' {$PBASIC 2.5}

    TXpin PIN 6
    BaudMode CON 25597 ' 2400, 7, E, 1, Inverted (for the BS2sx)
    serDataOut VAR Byte

    Main:
    ' -- Sending to the RS TRS-80 --
    FOR idx = 1 TO 20
    serDataOut = "A"
    SEROUT TXpin, BaudMode, [serDataOut]
    PAUSE 2000
    NEXT
    END

    - On the PC side, I have setup the serial port to receive at 2400 baud/7 bits/Even Parity/1 stop bit/Disable Line Status.
    - On the Stamp side, I use 2400/7/E/Inverted.

    The PC is sitting there receiving nothing, while the Stamp transmits "A" 20 times.

    Any suggestions as to what I am missing?

    Thank you,
    A.
    '
    Can you post the code your using on the TRS-80? I don't think the Stamp is at fault here.
    '
    I had a TRS-80 back-in-the-day. I used 9600 Baud 8 N 1. But you can use the other.
    '
    Details,details,details..........
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2010-10-20 18:53
    I venture that it is your baudmode. "True" is for use with a MAX232 (level-changer) or one of the Parallax serial devices, "Inverted" is for connecting to a 232-device without using a level-changer.

    [If your trs80 requires handshaking, that's another matter (just jumper it.)]
  • AristotleAristotle Posts: 9
    edited 2010-10-20 18:57
    The TRS-80 code is as follows:

    10 OPEN "COM:67E1D" FOR INPUT AS 1
    20 INPUT #1, A$
    30 PRINT A$
    40 GOTO 20

    Where:
    6 = 2,400 baud
    7 = 7 bit
    E = Even Parity
    1 = 1 stop bit
    D = Disable Line Status (not sure what that means, but I tried E=enable too).

    Thank you.
  • AristotleAristotle Posts: 9
    edited 2010-10-20 19:09
    PJ Allen wrote: »
    I venture that it is your baudmode. "True" is for use with a MAX232 (level-changer) or one of the Parallax serial devices, "Inverted" is for connecting to a 232-device without using a level-changer.

    [If your trs80 requires handshaking, that's another matter (just jumper it.)]

    Thank you. That is useful information! I wasn't sure how to treat that. But I tried non-inverted too.
  • AristotleAristotle Posts: 9
    edited 2010-10-21 14:48
    Well, I hooked up the Oscilloscope to the transmitting pin on the TRS-80 serial port and it turns out that the TRS-80 transmits at +5V/-5V with minus being the "1". So, it seems that the MAX232 is not needed. I hooked up the Stamp's pins to the serial port directly (outside of the PDB) and this thing worked like a charm. Here is the code (switched back to 8N1, but all other modes would work):

    ' {$STAMP BS2sx}
    ' {$PBASIC 2.5}

    TXpin PIN 6
    BaudMode CON 17405 ' 2400, 8, N, 1, Inverted (for the BS2sx)

    Main:
    ' -- Sending to the RS TRS-80 --
    FOR idx = 1 TO 20
    SEROUT TXpin, BaudMode, [idx, CR]
    PAUSE 500
    NEXT
    END

    The PAUSE 500 is needed, because the TRS-80 cannot catch up, if it receives without a break.

    Thank you both. Now on to controlling the Boe-Bot with an old TRS-80!
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2010-10-21 15:58
    Right, that's standard RS232: the transmitter's idle state is -V; a start bit is +V; and 1's are -V and 0's are +V

    N.B. -- use/keep that 22K resistor between the Stamp and the trs80, that -V will be winding out that I/O clamping diode.
  • AristotleAristotle Posts: 9
    edited 2010-10-21 18:59
    PJ Allen wrote: »
    Right, that's standard RS232: the transmitter's idle state is -V; a start bit is +V; and 1's are -V and 0's are +V

    N.B. -- use/keep that 22K resistor between the Stamp and the trs80, that -V will be winding out that I/O clamping diode.

    Thank you for pointing that out. I would not have thought of that. I already added the resistor and it works just great.
Sign In or Register to comment.