playing with SERIN
hi all, this ones a little over my head but hopefully not for long.. i have been playing with a device called· a "tnc" (terminal node controller).. basicly a modem that converts serial data into audible tones and tones back to serial data.. the particular tnc im using is pic based and called TNC-X.. the developer did a beutifull thing when he designed an expantion header into the device.. at this header you can send and receive serial data at ttl or rs232 levels.. also +5v and grnd are availible at this header.. a perfect cannidate for a basic stamp.. now to my troubles the code iv tried looks like this:
' {$STAMP BS2}
' {$PBASIC 2.5}
packet VAR Word
DO
SERIN 0,84, [noparse][[/noparse] packet]
DEBUG packet, CR
LOOP
all that i get in debug terminal is strange charecters like a y with 2 dots over it, a funny looking b, and a square...
·· I have attached a document that is intended to explain how the divice works and at the very end of it, it gives info on expantion.. take a look and feel free to enlighten me![smilewinkgrin.gif](http://forums.parallax.com/images/smilies/smilewinkgrin.gif)
PS i found a short thread a few years old that kinna dead ended but nothing usefull
thanks in advance
' {$STAMP BS2}
' {$PBASIC 2.5}
packet VAR Word
DO
SERIN 0,84, [noparse][[/noparse] packet]
DEBUG packet, CR
LOOP
all that i get in debug terminal is strange charecters like a y with 2 dots over it, a funny looking b, and a square...
·· I have attached a document that is intended to explain how the divice works and at the very end of it, it gives info on expantion.. take a look and feel free to enlighten me
![smilewinkgrin.gif](http://forums.parallax.com/images/smilies/smilewinkgrin.gif)
PS i found a short thread a few years old that kinna dead ended but nothing usefull
thanks in advance
Comments
http://groups.yahoo.com/group/tnc-x/messages/4
As noted in the message, make sure you have the baud rate configured properly on both the TNC and the Stamp. Presently the Stamp is expecting data at 9600 baud.
Additionally SERIN and SEROUT operate with bytes. If you need to send a WORD then you must send it as packet.highbyte and packet.lowbyte.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Involvement and committment can be best understood by looking at a plate of ham and eggs. The chicken was involved, but the pig was committed. ANON
' {$STAMP BS2}
' {$PBASIC 2.5}
packet VAR Byte(20)
DO
SERIN 0,813, [noparse][[/noparse]STR packet\20]
DEBUG STR· packet, CR
LOOP
this is getting better results i get a string of charecters !! notice that i changed the baudmode to 2400.. read in another post that the BS2 has trouble keeping up with the 4800 and faster modes.. my question now is this.. What are these charecters in my debug terminal, and can i use a formatter to make them understandable?
for now ill keep changing my code until i see something i recognize.. i love this super high speed stuff
UPDATE... I figured out that alla of thes funny charecters are ASCII.. also foud that every packet begins with a u withh two dots over it (hex 76)
Post Edited (kb1nrb) : 9/14/2008 1:10:52 AM GMT
' {$STAMP BS2}
' {$PBASIC 2.5}
packet VAR Byte(20)
DO
SERIN 0,813, [noparse][[/noparse]WAIT ($FC,$FB,$7E),SKIP 14]
SERIN 0,813, [noparse][[/noparse] STR packet\20]
DEBUG STR packet , CR
PAUSE 1000
LOOP
i should be seeing alfa numeric data in this part of the string... i guess my trouble now is getting these symbols converted to a format that i can understand.. i figured that [noparse][[/noparse]WAIT($FC,$FB,$7E),SKIP14] waits for a flag to identify start of data and then skips 14 bytes of data that i dont need to see at this time.. i have tried to adjust code so i could see the whole packet by changing the skip.. i did move down the string but still see nothing recognizable in debug...
Cheers,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk
http://www.siskconsult.com
·
maybe it would help if i could show what my debug receives?? is ther a way to copy out of debug and paste in here?? or would ther be control charecters that would do bad things here??
Post Edited (kb1nrb) : 10/8/2008 11:11:27 PM GMT