Shop OBEX P1 Docs P2 Docs Learn Events
DEBUG works, but equivalent SEROUT does not — Parallax Forums

DEBUG works, but equivalent SEROUT does not

Jim RothrockJim Rothrock Posts: 2
edited 2007-03-22 01:12 in BASIC Stamp
I am running the folllowing code on my BASIC Stamp 2sx:

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

DIRS = $ffff
i VAR Byte

sendBytes:
FOR i = 32 TO 128 - 1
' DEBUG i
SEROUT 16, 84,
PAUSE 1000
NEXT
GOTO sendBytes


The BoE's serial connector is connected to my PC's COM port, and I'm running HyperTerminal at 9600 bps on the PC. If the DEBUG line is uncommented and SEROUT is commented out, the ASCII character set is displayed in HyperTerminal. If SEROUT is used instead of DEBUG, however, unexpected characters are displayed in HyperTerminal, mostly periods and square root signs. I have used 84 and 16468 as baudmodes, but they both result in the same problem. What is the difference between DEBUG and SEROUT that is causing the different output?

P.S. I've also tried minicom on Linux, and I've run SEROUT out pin 15, then through a MAX233A, with no improvement.

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-03-22 00:27
    Jim,

    The baud rate is incorrect for the BS2sx…Please see the SEROUT command in the Help File or the BASIC Stamp Manual for getting the correct value there. Also, you should use inverted baud mode since that is what the DEBUG command uses (Port 16 is locked that way). Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • Jim RothrockJim Rothrock Posts: 2
    edited 2007-03-22 00:28
    The brackets in SEROUT didn't show up in my message. I've attached the source code to this message.
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-03-22 01:12
    Hi Jim, what Chris is saying is you have the wrong value for SEROUT

    you should have SEROUT 16,16624,[noparse][[/noparse]i]

    Jeff T.
Sign In or Register to comment.