Shop OBEX P1 Docs P2 Docs Learn Events
newby noob (serial com & 433trainsceiver help) — Parallax Forums

newby noob (serial com & 433trainsceiver help)

DestinedtoFall12DestinedtoFall12 Posts: 4
edited 2009-02-27 20:03 in BASIC Stamp
Good morning, can someone help me better understand serial communication with basic stamp? Ive gone through whats a microcontroller, robotics with boe bot and read a ton of articles including serin & serout demystified in Nuts and Volts. Im having a tough time locking it down. Im trying to control a bot bots speed direction with 2 10k potentiometers via 433RF transceivers. Im familiar with how to use potentiometers ,however , i dont seem to understand how to transmit that data. Any help or push in the right direction also any reading recommendations would be much appreciated.

thanks,

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My brain hurts

Post Edited (DestinedtoFall12) : 2/27/2009 4:22:11 PM GMT

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-02-27 16:14
    Hello,

    I would recommend using the pencil icon to edit your message to provide a desriptive subject of what your message is about. This will enable other members to know what you need help with, and if they can provide it. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • Mike GreenMike Green Posts: 23,101
    edited 2009-02-27 16:24
    There are many ways to do what you want. For example:

    1) You have two numbers representing the position of the pots, say that they're approximately in percent so the values range from 0 to 127. You can transmit the values as 8 bit bytes using some kind of microcontroller and a standard asynchronous serial format that a Stamp can receive using the SERIN statement. If you use the 8th (sign) bit to indicate which pot value is which, that would help in decoding at the receiving end.

    2) You could transmit two pulses of variable length proportional to the value of the pot(s), just like what's used for control of servo motors (see the Robotics with the BoeBot tutorial for a more detailed description). You'd need some kind of synchronization method because you have two pots. You could use a pulse shorter than the minimum to mark the beginning of the two values or you could bias one pot's value, perhaps with one pot causing pulses from 1 to 2ms in length and the other pot causing pulses from 3ms to 4ms in length with the 1ms width range representing the pot value from 0 to 10K. This scheme could be done using 555 timers with the pots determining the pulse width. You'd need some external logic to trigger the timers in sequence and "or" the outputs together to drive the transmitter.

    Post Edited (Mike Green) : 2/27/2009 4:29:43 PM GMT
  • DestinedtoFall12DestinedtoFall12 Posts: 4
    edited 2009-02-27 18:55
    Ok so i came up with this just to transmit a single pot value. although i am receiving the value on my other stamp, as i adjust the pot the value will erratically skip around. my value range is 0 to 500 but as i said as i adjust it will suddenly skip to some random number. im quite sure my program is wrong in the serin/serout portion but this is the most stable syntax ive come up with. Can anyone help me out here or should i find a new hobby
    ' Transmitter
    xtime VAR Word

    DO


    HIGH 15
    PAUSE 5
    RCTIME 15, 1, xtime


    PAUSE 100
    DEBUG HOME, DEC3 xtime

    SEROUT 0, 16780, [noparse][[/noparse] "!", xtime.HIGHBYTE, xtime.LOWBYTE ]


    LOOP

    ' Receiver

    xtime VAR Word

    FREQOUT 4, 2000, 3000


    DO

    SERIN 11, 16780, [noparse][[/noparse] WAIT("!"),

    xtime.HIGHBYTE, xtime.LOWBYTE ]

    DEBUG HOME, DEC3 xtime

    LOOP

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My brain hurts
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2009-02-27 20:03
    Hi, looks pretty good, possibly try making the baud true instead of inverted (396) and a short pause between each debug and serial command (PAUSE 50)

    Jeff T.
Sign In or Register to comment.