Shop OBEX P1 Docs P2 Docs Learn Events
RF basic stamp link communication problem — Parallax Forums

RF basic stamp link communication problem

MLunsfoMLunsfo Posts: 2
edited 2007-04-18 01:59 in BASIC Stamp
I am attempting to turn on two led's remotely using an rf link between a bs1 and a bs2. I am using an RWS 434 receiver with my bs1 and a TWS 434 transmitter with my bs2. The transmitter and receiver use A.M. and operate at 434 MHZ. The transmitter receives·a transmit command·via an RS232 serial connection and a visual basic·program.··So basically, my setup is seen below:

VB-->rs232-->bs2-->tws434-->rws434-->bs1-->led's

The problem is that the·led's·are·energizing on their own even when I am not transmitting anything.·What can i do to prevent this?··I have attached my·code for the bs1, bs2 and vb.·Any information would be greatly appreciated.

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-04-03 15:29
    Hello,

    The following thread may help you out. Andy Lindsay has posted some code using CRC checksum to prevent errors from interfering with your transmission. I hope this helps. Take care.


    http://forums.parallax.com/showthread.php?p=611353


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support


    Post Edited (Chris Savage (Parallax)) : 4/3/2007 3:35:38 PM GMT
  • MLunsfoMLunsfo Posts: 2
    edited 2007-04-04 21:58
    Thanks Chris for pointing me in the right direction. I am using the CRC and my receiver is·responding wonderfully·but I·have a new issue with the data that i am receiving.

    I am trying to·light·up the appropriate led based on the data that i am sending from my transmitter that is connected to·the BS2.·I am continously sending a checksum and a·1 or a·2·to my receiver·with the serout command. The serout command·from my transmitter·code is shown below

    BS2 Transmitter·Sending a 2

    up:

    x = x + 1
    y = y + 1
    z = z + 1
    checksum = x + y + z

    PULSOUT 15, 2000
    SEROUT 15,16780,[noparse][[/noparse]junk,"ABCD",x,y,z,checksum,updat]
    PAUSE 50

    GOTO up

    In the case above,·the updat value that is being continuously sent·to the receiver·is 2.·My serout·code for sending·a 1 is exactly the same. ·The problem is that only one of the led's connected to pin 0 or 1·will energize based on the data.·The receiver will not differientiate between·the data being sent (1 or a 2)·and·will only light up·one of the led's.·I have used the debug command to view the dat that i am receiving and it seems to be receiving the correct data, but·will not jump to the·appropriate·label. Is their an obvious explanation for·this or an error in my code? I am kinda new to serial comm so any information will be helpful.·A portion of my receiver code·is shown below: (I have attached my complete code for the transmitter and receiver)

    BS1 Reciever Code

    START:

    SERIN 4,N2400,("ABCD"), x, y, z, sum, dat
    checksum = x + y + z

    IF checksum = sum AND dat = 1 THEN down
    down:
    HIGH 0
    GOTO down

    IF checksum = sum AND dat = 2 THEN up
    up:
    HIGH 1
    GOTO up

    GOTO START
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-04-06 20:21
    While this isn’t necessarily the answer to your problems I would consider not sending so much padding with your data. It complicates the code and it may be too much for the BS1 to process at once, which may be causing your problems. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • Ray0665Ray0665 Posts: 231
    edited 2007-04-16 16:38
    It seems to me that with the code shown, once you light either LED your program is stuck in either the "UP" or "DOWN" loop forever.
    The obvious thing to do is change the goto up/down in these loops to goto start.
  • swriderswrider Posts: 16
    edited 2007-04-17 04:43
    I think your receiver code might need some modifications, otherwise those IF's aren't doing much:

    IF checksum = sum AND dat = 1 THEN down
    GOTO nextled
    down:
    HIGH 0
    GOTO START

    nextled:
    IF checksum = sum AND dat = 2 THEN up
    GOTO START
    up:
    HIGH 1
    GOTO START
  • Rob311Rob311 Posts: 83
    edited 2007-04-18 01:59
    Throw out your RF stuff and buy the eb500 and a pocket pc with bluetooth. Its probably the coolest thing Parallax has to offer...
Sign In or Register to comment.