Serial Comms Demo Example in BS Manual v2.2
I have tried to test on the·Demo program·on simple serial communication example in the Basic stamp manual v2.2 page 412-414. However, I could not get the communication to work.
Is there any thing wrong with my connections or code?
I have connected the flow control pin as shown in the attachment.
' SENDER
' {$STAMP BS2pe}
' {$PBASIC 2.5}
' {$PORT COM8}
SO PIN 1 ' serial output
FC PIN 0 ' flow control pin
#SELECT $STAMP
#CASE BS2, BS2E, BS2PE
T1200 CON 813
T2400 CON 396
T9600 CON 84
T19K2 CON 32
T38K4 CON 6
#CASE BS2SX, BS2P
T1200 CON 2063
T2400 CON 1021
T9600 CON 240
T19K2 CON 110
T38K4 CON 45
#CASE BS2PX
T1200 CON 3313
T2400 CON 1646
T9600 CON 396
T19K2 CON 188
T38K4 CON 84
#ENDSELECT
Inverted CON $4000
Open CON $8000
Baud CON T38K4 + Inverted
Main:
DO
· SEROUT SO\FC, Baud, [noparse][[/noparse]"Hello!", CR] ' send the greeting
· PAUSE 2500 ' wait 2.5 seconds
LOOP ' repeat forever
END
' RECEIVER
' {$STAMP BS2px}
' {$PBASIC 2.5}
' {$PORT COM5}
SI PIN 0 ' serial input
FC PIN 1 ' flow control pin
#SELECT $STAMP
#CASE BS2, BS2E, BS2PE
T1200 CON 813
T2400 CON 396
T9600 CON 84
T19K2 CON 32
T38K4 CON 6
#CASE BS2SX, BS2P
T1200 CON 2063
T2400 CON 1021
T9600 CON 240
T19K2 CON 110
T38K4 CON 45
#CASE BS2PX
T1200 CON 3313
T2400 CON 1646
T9600 CON 396
T19K2 CON 188
T38K4 CON 84
#ENDSELECT
Inverted CON $4000
Open CON $8000
Baud CON T38K4 + Inverted
letter VAR Byte
Main:
DO
· SERIN SI\FC, Baud, [noparse][[/noparse]letter] ' receive one byte
· DEBUG letter ' display on screen
· PAUSE 1000 ' wait one second
LOOP ' repeat forever
END
Is there any thing wrong with my connections or code?
I have connected the flow control pin as shown in the attachment.
' SENDER
' {$STAMP BS2pe}
' {$PBASIC 2.5}
' {$PORT COM8}
SO PIN 1 ' serial output
FC PIN 0 ' flow control pin
#SELECT $STAMP
#CASE BS2, BS2E, BS2PE
T1200 CON 813
T2400 CON 396
T9600 CON 84
T19K2 CON 32
T38K4 CON 6
#CASE BS2SX, BS2P
T1200 CON 2063
T2400 CON 1021
T9600 CON 240
T19K2 CON 110
T38K4 CON 45
#CASE BS2PX
T1200 CON 3313
T2400 CON 1646
T9600 CON 396
T19K2 CON 188
T38K4 CON 84
#ENDSELECT
Inverted CON $4000
Open CON $8000
Baud CON T38K4 + Inverted
Main:
DO
· SEROUT SO\FC, Baud, [noparse][[/noparse]"Hello!", CR] ' send the greeting
· PAUSE 2500 ' wait 2.5 seconds
LOOP ' repeat forever
END
' RECEIVER
' {$STAMP BS2px}
' {$PBASIC 2.5}
' {$PORT COM5}
SI PIN 0 ' serial input
FC PIN 1 ' flow control pin
#SELECT $STAMP
#CASE BS2, BS2E, BS2PE
T1200 CON 813
T2400 CON 396
T9600 CON 84
T19K2 CON 32
T38K4 CON 6
#CASE BS2SX, BS2P
T1200 CON 2063
T2400 CON 1021
T9600 CON 240
T19K2 CON 110
T38K4 CON 45
#CASE BS2PX
T1200 CON 3313
T2400 CON 1646
T9600 CON 396
T19K2 CON 188
T38K4 CON 84
#ENDSELECT
Inverted CON $4000
Open CON $8000
Baud CON T38K4 + Inverted
letter VAR Byte
Main:
DO
· SERIN SI\FC, Baud, [noparse][[/noparse]letter] ' receive one byte
· DEBUG letter ' display on screen
· PAUSE 1000 ' wait one second
LOOP ' repeat forever
END
Comments
Cheers,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk
http://www.siskconsult.com
·
Is there a mistake in the manual?
Cheers,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk
http://www.siskconsult.com
·
How can I·send a value that is larger than that (Word VAR·eg. 1800).
Have a look in the Help section of the development environment under "highbyte".
Cheers,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk
http://www.siskconsult.com
·