Basic Stamp with RF Receiver and RF transmitter like a tag
HEN
Posts: 8
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...
'{$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...
Comments
SERIN Rx,17197,[noparse][[/noparse]WAIT("****"), STR Value\10\"-"]
SEROUT 16,17197, 200, [noparse][[/noparse]STR Cad\11]
Jeff T.
Craig
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
Thank you so much Craig
I'll tell you later if this is the solution.
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.