Serial in out question with Reynolds Xmit and Rec
tigershark35
Posts: 60
Hi
I have a problem I need some help on. I am sending 2 changing values from one Basic Stamp 2 to another via xmitter and receiver.·I used the TWS-434 and RWS-434 from Trynolds Electronics.·Attached are the two programs.
The range for the two values is from 500 to 1000.· The initial values are received by the receiving Stamp and are displayed. These values are 750. Then the values after that do not make sense.
For example with no input from the Joy Stick that will change the values sent, the next received values after the initial 750, 750 are diffent.· Like 1148, 218.
Any ideas. If there is more I can provide to help on this, let me know. Is it baud rates or something like that.
Any help will be appreciated, I want to expand the programs to control a number of servos, motors and lights.
Thanks.
I have a problem I need some help on. I am sending 2 changing values from one Basic Stamp 2 to another via xmitter and receiver.·I used the TWS-434 and RWS-434 from Trynolds Electronics.·Attached are the two programs.
The range for the two values is from 500 to 1000.· The initial values are received by the receiving Stamp and are displayed. These values are 750. Then the values after that do not make sense.
For example with no input from the Joy Stick that will change the values sent, the next received values after the initial 750, 750 are diffent.· Like 1148, 218.
Any ideas. If there is more I can provide to help on this, let me know. Is it baud rates or something like that.
Any help will be appreciated, I want to expand the programs to control a number of servos, motors and lights.
Thanks.
Comments
JG
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
SoftwareFlowControlExample.bs2
' {$STAMP BS2}
' {$PBASIC 2.5}
'
' Software Flow Control Example Snippit
'
' This example lays out the basic framework for implementing software
' flow control on the basic stamp.
'
' Author: Christopher Chess Ellsworth
'
SerialInPin CON 16
SerialOutPin CON 16
T2400 CON 396
T19K2 CON 32
T38K4 CON 6
Inverted CON $4000
Baud CON T2400 + Inverted
'Timeout for reading from the serial port
SerialInTimeout VAR Word
SerialInTimeout = 1000
command VAR Byte
Init:
'Tell the host that we are not ready to recieve data
GOSUB X_OFF
Main:
GOSUB Read_Message
'Do something if command is not 0
'SELECT command
'ENDSELECT
GOTO Main
'Read a message from the server machine.
Read_Message:
GOSUB X_ON
SERIN SerialInPin, Baud, SerialInTimeout, Read_Message_Time_Out, [noparse][[/noparse]command]
GOSUB X_OFF
RETURN
'END Read_Message
'If no message can be read from the serial port.
Read_Message_Time_Out:
GOSUB X_OFF
command = 0
RETURN
'END Read_Message_Time_Out
'Send software flow control bytes
X_ON:
SEROUT SerialOutPin, Baud, [noparse][[/noparse]17]
RETURN
X_OFF:
SEROUT SerialOutPin, Baud, [noparse][[/noparse]19]
RETURN