Serin Debug/Receive trouble
Wouter Bac
Posts: 4
Hi, I am trying to debug letters and numbers that are sent from the Windows HyperTerminal. The hardware is running correctly because I am measuring signals at the DATA pin of the receiver with scope when I type numbers of letters on the keyboard. The receiver is mounted on a Boe-Bot (USB connected to computer). How is it possible that I don't see anything in the Debug Terminal when I type something in the Hyperterminal?
My code is:
' {$STAMP BS2}
' {$PBASIC 2.5}
Rx PIN 15 ' 443 MHZ Receiver(27981)DATA pin
SerData VAR Byte 'Variable to store data that is sended from the hyperterminal on the PC
SERIN Rx, 16468, [noparse][[/noparse]DEC Serdata ]
DEBUG Serdata 'Debugs letters or numbers (that were sent by the PC) in the Debug Terminal
My code is:
' {$STAMP BS2}
' {$PBASIC 2.5}
Rx PIN 15 ' 443 MHZ Receiver(27981)DATA pin
SerData VAR Byte 'Variable to store data that is sended from the hyperterminal on the PC
SERIN Rx, 16468, [noparse][[/noparse]DEC Serdata ]
DEBUG Serdata 'Debugs letters or numbers (that were sent by the PC) in the Debug Terminal
Comments
Your SERIN· is looking for decimals and will terminate on non decimal character.
Are they the Parallax 433 MHz RF modules? Also, are you sending the data through a level shifter, like a MAX232 chip·to go from the PC to RF modules?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,
Joshua Donelson
www.parallax.com
Post Edited (Joshua Donelson (Parallax)) : 4/24/2009 7:09:59 PM GMT
Yes I am using the 433 MHz Rf modules. And I am also using a MAX 232 chip. I am using 9600 baud 8,1,N from the Hyperterminal in Windows.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
If you insert the serin into a do loop you would have a much higher chance of receiving the Byte in. Like Stephen explained, the BASIC Stamp is watching the I/O pin for only a moment of time before going on to another task. Also you can bring in the Byte as an ASCII format and then use a formatter to display what you would like in the terminal window.
For Example:
DO
SERIN Rx, 16468, [noparse][[/noparse]Serdata]
DEBUG DEC Serdata 'Debugs letters or numbers (that were sent by the PC) in the Debug Terminal
LOOP
I hope this helps,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,
Joshua Donelson
www.parallax.com
Please revise / explain need for loop in your post.
According to the manual the·DEC qualifier makes SERIN to collect decimals into an array until non-decimal character is received.
Than SERIN exits.
As written - no loop is necessary and the variable should contain LAST decimal character received.·
Cheeers· Vaclav
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
Wouter
Excellent, just let us know if there is anything else. Once you are all done, you can post it in the Complete Projects Forum. It's always great to see new projects posted.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,
Joshua Donelson
www.parallax.com