Shop OBEX P1 Docs P2 Docs Learn Events
playing with SERIN — Parallax Forums

playing with SERIN

NR1XNR1X Posts: 111
edited 2008-10-09 01:23 in General Discussion
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
PS i found a short thread a few years old that kinna dead ended but nothing usefull
thanks in advance

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2008-09-13 02:21
    You may find one or more of these messages helpful, from when the Stamp Forum was on Yahoo Groups:
    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
  • NR1XNR1X Posts: 111
    edited 2008-09-13 12:29
    ok thanks bruce, will adjust my code to use bytes. went to link and did a search for basic stamp, found a post but not too helpful.. all i want to do for now is get the data to display in debug once i get that ill be on my way.
  • NR1XNR1X Posts: 111
    edited 2008-09-13 20:25
    iv updated my code :
    ' {$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 freaked.gif· hahaha. the goal of this all is to develope a digipeater daughterboard to install inside the tnc-x.. it will wait till it receives a packet addressed to a specific callsign then it will modify the packet and retransmit it. this expands the range of lower powered stations . the data packets are position,status, weather conditions, sometimes even telemetry from other ham stations..



    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
  • NR1XNR1X Posts: 111
    edited 2008-09-15 10:03
    now i feel like im getting somewhere. i have changed my code..
    ' {$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...
  • stamptrolstamptrol Posts: 1,731
    edited 2008-09-15 14:29
    Are you sure you're set for 2400 baud? 813 sets you for 1200 8N1.

    Cheers,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • NR1XNR1X Posts: 111
    edited 2008-09-15 18:54
    im sorry i misstated that earlier.. i am at 1200bps 8n1
  • NR1XNR1X Posts: 111
    edited 2008-10-07 21:37
    ok,this is still eating me... new question here .. how can i make data appear in debug just as it does in hyperterminal when connected to the tnc? once i figure out how to decode this data i will be well on my way ..


    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
  • NR1XNR1X Posts: 111
    edited 2008-10-09 01:23
    another thing i know is that this data is AX.25 ui frames "wraped in kiss ".. not so sure i totally get it but i have surely identified start byte and also a few other parts of the packet.. i have joined the yhoo group for the tnc-x and will try to update this thread if i get any further... this may be usefull to someone else later
Sign In or Register to comment.