RF UART Code for Transmitter
Jeff_5_
Posts: 36
I an having trouble sending a four byte data array wirelessly with my 433mhz transmitter and receiver. I want to send it at 9600kps. I can read one tag fine but my problem is when i try to read two tags at the same time. It seems the receiver just locks up. I have a pic programed with PIC basic for my transmitter. The reciever is connected right to my basic stamp . Here is the code for the transmitter.
TAG1
Include "modedefs.bas"
ANSEL = %00000000 '
SEND VAR PORTA.4
LED Var PORTA.2
Code Var Byte[4]
mainloop:
code(0)="!"
Code(1)="0"
Code(2)="0"
Code(3)="1"
high SEND
Serout2 PORTA.5, 9600, [str Code\4]
low SEND
Goto mainloop
End
TAG 2
Include "modedefs.bas"
ANSEL = %00000000 '
SEND VAR PORTA.4
LED Var PORTA.2
Code Var Byte[4]
mainloop:
code(0)="!"
Code(1)="0"
Code(2)="0"
Code(3)="2"
high SEND
Serout2 PORTA.5, 9600, [str Code\4]
low SEND
Goto mainloop
End
Tag1 is !001 Tag2 is !002
Here is the code to read the tag in to my basic stamp.
SERIN 3,9600,[ STR Tag\4]
DEBUG STR Tag, CR
My problem is i cant read both tags at the same time. It will read each tag by its self just fine, Also it acts kind of funny in the debug window at 9600 but works fine at 2400.
TAG1
Include "modedefs.bas"
ANSEL = %00000000 '
SEND VAR PORTA.4
LED Var PORTA.2
Code Var Byte[4]
mainloop:
code(0)="!"
Code(1)="0"
Code(2)="0"
Code(3)="1"
high SEND
Serout2 PORTA.5, 9600, [str Code\4]
low SEND
Goto mainloop
End
TAG 2
Include "modedefs.bas"
ANSEL = %00000000 '
SEND VAR PORTA.4
LED Var PORTA.2
Code Var Byte[4]
mainloop:
code(0)="!"
Code(1)="0"
Code(2)="0"
Code(3)="2"
high SEND
Serout2 PORTA.5, 9600, [str Code\4]
low SEND
Goto mainloop
End
Tag1 is !001 Tag2 is !002
Here is the code to read the tag in to my basic stamp.
SERIN 3,9600,[ STR Tag\4]
DEBUG STR Tag, CR
My problem is i cant read both tags at the same time. It will read each tag by its self just fine, Also it acts kind of funny in the debug window at 9600 but works fine at 2400.
Comments
Also, the transmitter / receiver pair is marginal at 9600 Baud. It works better at lower speeds (like 2400 Baud or 4800 Baud) and really requires some kind of error checking even at the lower speeds.