Shop OBEX P1 Docs P2 Docs Learn Events
Serial communication — Parallax Forums

Serial communication

fma38fma38 Posts: 42
edited 2007-06-17 21:13 in BASIC Stamp
Hi,

I'm writing a BS2px program in order to communicate with a host, through serial line. The host will be, in the final design, a Palm, but I will use my PC at first. I have several questions about serial com with BS2:

1) In SERIN examples, I don't understand the use of Flow Control (FPin). What kind of flow control is it? Is it designed only to be used between BS2, or is it possible to use it with a classic RS232 line (through a MAX233)?

2) For my app, is it possible to use the SIN/SOUT/ATN pins to communicate with the host? My first idea was to use the DEBUG/DEBUGIN commands. But is it a good idea? Are all features of SERIN available with DEBUGIN?

3) If I user SERIN/SEROUT commands, it is a good idea to use pins 1 and 2 (by setting pin number 16 to SERIN/SEROUT)? In this case, is it possible to use ATN? What about FPin?

As you can see, this is not very clear to me how to use all these serial features.

About the protocol I plan to use, the BS2 will wait for 2 ascii chars commands. Then, depending of the command, it will get more params (in ascii), and convert them. This way, it can be easily driven from a VT100-like terminal. I also want to wait for async commands, ie a command can start a motor positionning, and the BS2 will have to poll the serial line to see if a stop command is sent. Don't know if it is possible.

Thanks,

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Fr

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-06-17 14:38
    1) The flow control is pretty standard serial flow control and can be used with a MAX233 with a classic RS232 line.

    2) You can use the programming connection (SIN/SOUT/ATN) for communication with a host using DEBUG/DEBUGIN or SERIN/SEROUT (with pin 16 specified). Restrictions are: The Baud is fixed at 9600, 8-bit, no-parity. There are no provisions for flow control. All characters sent from the host are echoed back to the host (an artifact of the way the hardware is connected). ATN is connected to DTR and, when the port is opened from the host side, DTR is toggled and this will force a reset of the Stamp.

    3) A lot of people use the programming connection for Stamp-host communications. It has a built-in RS232 level converter and, on the Board of Education, can have a built-in USB to serial adapter. For a lot of uses the restrictions don't matter very much.

    In any Stamp communications protocol, you need to account for the limitation of the Stamp ... that it is a "single threaded" processor ... it can do only one thing at a time and none of the I/O is buffered. If the host is sending data when the Stamp is sending a pulse to a motor, the Stamp will ignore it. The Stamp could poll the host between pulses to the motor. Often there is enough time to do this.
  • fma38fma38 Posts: 42
    edited 2007-06-17 15:07
    Ok, I see. Thanks for you answer [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Fr
  • fma38fma38 Posts: 42
    edited 2007-06-17 18:23
    Another question: I've just read that a BS2 can be connected to a RS232 serial port, if using a 22kOhm resistor on the SERIN pin. On the other direction, it will work only if the host port can understand 0-5V signal level.

    Does someone know if it is the case of Palm devices (Old ones, like Palm Vx)? Or is a MAX233 needed?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Fr
  • Mike GreenMike Green Posts: 23,101
    edited 2007-06-17 18:37
    It should work. Even if it doesn't, it shouldn't harm either the Palm or the BS2 (as long as you use the resistor). The older Palms would use 5V logic in any event.
  • fma38fma38 Posts: 42
    edited 2007-06-17 21:13
    Ok, so I'll try!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Fr
Sign In or Register to comment.