Serial communication
fma38
Posts: 42
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
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
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.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Fr
Does someone know if it is the case of Palm devices (Old ones, like Palm Vx)? Or is a MAX233 needed?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Fr
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Fr