Shop OBEX P1 Docs P2 Docs Learn Events
BS2 with Hyperterminal question — Parallax Forums

BS2 with Hyperterminal question

TTSTTS Posts: 4
edited 2006-08-11 16:10 in BASIC Stamp
HI;

I'm new to the Basic stamp and I have a question about using the Serout/Serin
commands to communicate with Hyperterminal. I just want basic functionality
but I can't get it·to work. The very simple one-line·program·below illustrates the issue.

SEROUT 16,16468,[noparse][[/noparse]65]

I also tried sending the info formated in ASCII.
It should send an "A" to the screen and works fine with the Debug screen in the
BS2 editor. But, when I close the debug window and run Hyperterminal set up like
the Debug terminal (i.e: Com 4, 9600 baud, 8N1, no flow control, VT100, or even TTY)
and press the 'Reset' button on the BS2, the screen shows nothing. I know it has to be
something very simple I'm overlooking.

Any thoughts?·Again, it works fine in the Debug window of the editor.

Thanks

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2006-07-04 11:47
    TTS,

    Change your baudmode parameter from 16468 to 84. Normally, inverted mode would be for using a regular Stamp pin to talk to a PC-type device.
    Also, you may need pins 7-8 of the serial connector jumpered together at the PC end to let Hyperterminal know to pay attention!

    Cheers
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-07-04 14:27
    Hyperterminal will ALWAYS raise DTR, which resets the BS2. There are 2 capacitors in the DTR line on the BOE board, which de-couples this signal -- otherwise, the BS2 is held in the reset state.

    One way to determine what's going wrong is:

    MyVal VAR BYTE

    MyVal = 0
    MAIN:
    SEROUT 16, 84, [noparse][[/noparse]"Hi. ", DEC MyVal, CR]
    MyVal = MyVal + 1
    pause 1000 ' Needed to prevent FLOOD of data
    GOTO MAIN
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-07-04 16:11
    TTS and Allan -

    Just a couple of hopefully helpful comments on the test program. This is how it appears now:

    MyVal VAR BYTE

    MyVal = 0
    MAIN:
    SEROUT 16, 84, [noparse][[/noparse]"Hi. ", DEC MyVal, CR]
    MyVal = MyVal + 1
    pause 1000 ' Needed to prevent FLOOD of data
    GOTO MAIN

    Might I suggest the following:

    MyVal VAR BYTE

    MyVal = 0
    DEBUG "RESET"

    MAIN:
    SEROUT 16, 84, [noparse][[/noparse]"Hi. ", DEC MyVal, CR]
    MyVal = MyVal + 1
    pause 1000 ' Needed to prevent FLOOD of data
    GOTO MAIN

    With this updated test program, you should ONLY see the word "RESET" appear once during any iteration of the program. If you see it more than once, the PBASIC Stamp is being RESET. If this is the case, please see Allan's explicit comments about the DTR line.

    Second, if the test program works as expected, it will transmit sequential numbers (0-255) to the connected terminal program, be it Hyperterminal, or any other.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2006-07-04 16:19
    Also, tell HTPE in terminal properties to add LF after CR, or add it in the SEROUT .... CR, LF]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-07-04 16:21
    Just to clarify for everyone...If you use virtual port 16 (the dedicated/programming port), the interpreter will always use inverted baud mode, regardless of what you specify.· I hope this helps.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • TTSTTS Posts: 4
    edited 2006-07-05 17:54
    Hello Stamptrol, Chris, Allan and Bruce.

    Thanks to all for the help! The·BS2 is working with Hyperterminal

    now. Details of fix follows:

    1. The code given by Allan and Bruce could not work to debug this

    ·· problem because the problem was that the communications to

    ·· Hyperterminal was not working. Therefore no messages at all could

    ·· be received.

    2. Chris is correct in that Stamp virtual port 16 will always use Inverted

    ··· signals, since this is the convention for RS232 levels as opposed to TTL

    ··· levels. (i.e: "1" = -12V, "0" = +5V for RS232)

    3. Stamptrol was on the right track about connector jumpers, but the pertinent

    ··· connection is DB9-6 (DSR) and DB9-7 (RTS). These should be connected, and

    ····on the BS2 Carrier Board they are.

    3. Allan hit it on the head with the DB9-4 (DTR) signal. Hyperterminal will send DTR on

    ··· DB9-4 which will hold the BS2 on the Carrier Board in reset. This line between DB9-4

    ··· and BS2-3 must be cut and a 0.1uF cap connected from DB9-4 to BS2-3. Also, another

    ··· 0.1uF cap should be added from BS2-3 to Vss.

    The development boards have these caps in place but the Carrier Board does not. That is

    why the communications would work with the Homework Board, etc. but not with the

    Carrier Board.

    Thanks again to all.

    RDT
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2006-07-05 18:22
    The following code:

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    
    DO
      SEROUT 16, 16468, [noparse][[/noparse]"Hello World",CR,LF]
    LOOP
    
    



    Works for a hyperterm test.

    Settings: No flow control, 9600 baud (all other settings default).

    Make sure you close any open Stamp IDE debug windows first.


    Ryan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ryan Clarke
    Parallax Tech Support

    RClarke@Parallax.com
  • TTSTTS Posts: 4
    edited 2006-07-05 18:32
    Hi Ryan;

    Thanks for the reply. The code is fine.My problem was getting the BS2 mounted on
    a carrier board to talk to Hyperterminal. The solution was to add some caps in the
    DB9-4 (DTR) circuit to prevent DTR sent by Hyperterminal from holding the BS2 in
    "Reset". Apparently, the development boards have these caps in place but the
    BS2 Carrier Board does not, so they must be added.

    Thanks again.

    RDT
    ·
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-07-05 19:12
    The newer Carrier Boards (less than 1 year) have them...I am guessing you have an older one?


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • TTSTTS Posts: 4
    edited 2006-07-05 19:45
    Yeah...I believe my board is more than a year old. It came with a BS2 package I bought
    a while ago but I just got around to using it last week. It makes sense they added them
    to the new boards because the carrier board is great for small projects and most of those
    will need to communicate to a dumb terminal for a simple human interface.

    TTS
  • bennettdanbennettdan Posts: 614
    edited 2006-07-06 00:45
    Hey guys,
    I have been following along and was curious if you can send ASCII or other data from hyperterminal to the BS2?
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-07-06 01:06
    Yes, you can send anything you can type in the terminal, including control characters (non-printable) and even binary codes (using a special key input mode).· The Stamp can receive any data you can send via the serial port from Hyperterminal.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • bennettdanbennettdan Posts: 614
    edited 2006-07-06 01:23
    Is their any tutorials on how to send it to the stamp?
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-07-06 01:24
    Not sure what you mean...If you mean are there any tutorials on how to use Hyperterminal, a Google search might yield some results.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • taboadataboada Posts: 4
    edited 2006-08-10 22:20
    I am having trouble sending the Stamp data using Hyperterminal.· I suspect that it is due to DTR being held high.· How do I fix this problem?· Thanks for your help!
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-08-11 01:06
    I suggest that you make up your own cable with only RD, TD, and GND (2, 3, 5).
  • taboadataboada Posts: 4
    edited 2006-08-11 16:10
    GREAT!· It works after I made the cable with only 3 connections RD, TD, and GND.

    Thanks for your help.
Sign In or Register to comment.