Shop OBEX P1 Docs P2 Docs Learn Events
Need HELP with Serial Port — Parallax Forums

Need HELP with Serial Port

carodccarodc Posts: 3
edited 2007-11-15 17:01 in BASIC Stamp
Hi let me start by saying: yes i'm a newbie.

This is my problem:

i have a BS2p and a Parallax Professional Development Board (item code 28138).

I need to send and receive data using a serial port (RS232) with this conection spesification:

bit per second = 19200
data bits = 8
parity = none
stop bits = 1
flow control = none

if i use hyperterminal and send the command to start the device im working with, it send me back a serial number.

i've been trying to do tha using the BS2p but nothing seems to work.

i don't know wich serial port of the development board is the one for comunicating with the device, and i think a cannot use the sameone im using to configure it.

any ideas of how i can do this, code or suggestions or both ?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-11-14 04:49
    Look in the PBasic Manual in the section on the SEROUT/SERIN commands. There are an number of examples for connecting a Stamp to an RS232 serial port. Notice that the constants used to set the Baud vary from Stamp model to Stamp model.

    You can use the programming port ("pin 16") for this, but the Baud is fixed at 9600 for this "pin". You can use any other pins (0 to 15) and you will need to use a protective series resistor on the receive side (see the description in the Manual). This is not "correct" RS232 voltage levels, but probably will work with most devices. If you need a "proper" RS232 port, you would need to use something like a MAX232 to do the voltage translation for you.
  • allanlane5allanlane5 Posts: 3,815
    edited 2007-11-15 03:11
    No, the 'baudmode' is not fixed at 9600 for the "Programming Port". It would be, if you were using "DEBUG" statements, but you can look at the "SERIN" or "SEROUT" keywords in the "Help" to see what baudmode constant you need for 19200 baud.

    And yes, a "SEROUT 16, 16468, [noparse][[/noparse]"Hi!", CR] " should appear on Hyperterminal. That's assuming you're using a BOE, or some other board with the two decoupling capacitors on the ATN line. Otherwise, Hyperterminal will hold your BS2 in 'reset' all the time.
  • carodccarodc Posts: 3
    edited 2007-11-15 17:01
    Thanks. Everything you've told me is true.

    I can comunicate using the same serial port that is use to configure it with serout or serin 16.

    alanlane5 said i could yous a RS232 with a max232, i hava that to in the profesional development board.

    The thing is a don't know how to make the conection, so that it would work with my I/O pins instead of the normal serial pins that come with the BS2p.

    Im putting the diagram of the Max232 RS232 port in this page: http://anouk130.googlepages.com/homepage

    Maybe you could tell me how to make the conection and if i need any special code to make it work.
Sign In or Register to comment.