Shop OBEX P1 Docs P2 Docs Learn Events
Basic Stamp with RF Receiver and RF transmitter like a tag — Parallax Forums

Basic Stamp with RF Receiver and RF transmitter like a tag

HENHEN Posts: 8
edited 2009-03-20 02:15 in BASIC Stamp
I have assembling RF Transmitter in a circuit that has a pic (16F84) and 2 condenser, the basic stamp 2 discovery kit has assembling with RF Receiver (Attached picture of both) and this was programmed with this code:

'{$STAMP BS2}
' {$PBASIC 2.5}

'---Set up Variables---
Value VAR Byte(12)
Cad VAR Byte (11)
'Holds data value being transmitted

'---Set up Constants---
Rx CON 15 'Receive I/O pin number
N9600 CON 9005 'Baud mode value for 1200 baud


'
Main Routine

'Receive data
ReceiverMain:
Value(11) = 0

SERIN Rx,N9600,[noparse][[/noparse]WAIT("****"), STR Value\10\"-"]
Cad(0) = Value(0)
Cad(1) = Value(1)
Cad(2) = Value(2)
Cad(3) = Value(3)
Cad(4) = Value(4)
Cad(5) = "L"
Cad(6) = "2"
Cad(7) = "3"
Cad(8) = "1"
Cad(9) = "3"
Cad(10) = 0

SEROUT 16,9005, 200, [noparse][[/noparse]STR Cad\11]
'DEBUG "Receiving: ", STR Value,CR
GOTO ReceiverMain 'Then start over again

After it, we trying the system and we received the information very good, but just at the first time. Now, when we try it, sometimes receive several characters but not what are really sending in the transmitter and sometimes receive the information good but incomplete.

For example:

RF Transmitter (PIC16F84): ****6851----

RF Receiver (BS2 Kit): 6851L2313

and this will be repeating all the time. That's we want to do the system, but was just at the first time.

Now, we have this problem:

RF Transmitter (PIC16F84): ****6851----

RF Receiver (BS2 Kit) when SERIN is executting: asdf
asdf
SEROUT: Not executed because SERIN was not good.
We tried without the command WAIT but its the same problem (sometimes characters or sometimes the information incomplete).

I don't know why this happens, we need that the system receive 6851 very good all the time. How can i synchronize it or how can i find a solution? Please, if someone had the same case or knows what it is happening, reply...
800 x 600 - 71K
1024 x 768 - 158K

Comments

  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2009-02-04 04:47
    Hi, try this baud setting , might be the problem. Cross check in the BS2 help file .

    SERIN Rx,17197,[noparse][[/noparse]WAIT("****"), STR Value\10\"-"]

    SEROUT 16,17197, 200, [noparse][[/noparse]STR Cad\11]

    Jeff T.
  • HENHEN Posts: 8
    edited 2009-02-04 18:12
    I tried with all baud in the help file. The pic of RF Transmitter was programmed to send within 1200 baud and using 9005 in the receiver we can see what the transmitter is sending, but just sometimes, is not always.
  • Craig EidCraig Eid Posts: 106
    edited 2009-02-04 22:46
    Transmitting data via a wireless link can be problematic since you do not have the ability to implement flow control that ensures that the data was received. Adding a sync pulse at the beginning of each transmission can increase the reliability of the communiation path - please read the application note for the Parallax transmitter and receiver for more information·- http://www.parallax.com/Store/Accessories/Communication/tabid/161/CategoryID/36/List/0/Level/a/ProductID/113/Default.aspx?SortField=ProductName%2cProductName.



    Craig
  • HENHEN Posts: 8
    edited 2009-02-05 01:18
    I read the application note, but i'm not using a BS2 in the transmitter. I need that the transmitter just sends a code (6851) for this reason made a circuit with a pic, now i don't know if in assembler language has a command like sync for programming this pic. Thanks, Craig
  • Craig EidCraig Eid Posts: 106
    edited 2009-02-05 02:20
    Hen,

    You should be able to generate a pulse of a fixed duration with your PIC. It has been many years since I programmed in assembly but the syntax for BASIC would look something like the following, using a 3 millisecond HIGH pulse for synchronization:


    I/O Definitions

    Tx CON 5 'Transmit pin


    HIGH Tx

    PAUSE 3 'The·app note suggests using a pulse width·= 2400 microseconds

    LOW Tx

    Add your Serial output transmit code here

    ·······························································································································································



    Craig
  • HENHEN Posts: 8
    edited 2009-02-05 03:04
    Oh ok ok, i was just looking about pulsout command, i'm understanding now. It's like establish connection. I'll try with your suggestion,

    Thank you so much Craig

    I'll tell you later if this is the solution.
  • HENHEN Posts: 8
    edited 2009-03-20 02:15
    Hi again,

    Craig, i tried adding a button in RF transmitter, when the person is into the environment click on this button and this will send the code that is in the transmitter's pic. I think this solution is more effective than just synchronization. Another one reason for choose this, it's because i need to register when the person go out the environment where the receiver is.

    I want know what do you think about it?
    This is my thesis and all the opinions are importants. The environment is the classroom and the persons that will get the transmitter are the teachers, we want register if the teacher went or not to the class and when finished it.
Sign In or Register to comment.