The transmitter being used is the TLP-434 and the receiver used is the RLP-434
A link to the data sheet is: http://www.sparkfun.com/datasheets/RF/TLPRLP.pdf
Code:
B2 VAR PORTB.0 'Variable B2 set to pin 0
Serin 0,N2400,B2 'Serial in to pin 0
RX1 VAR PORTB.0 'Variable RX1 set to bit 0 (address)
RX2 VAR PORTB.1 'Variable RX2 set to bit 1 (address)
RX3 VAR PORTB.2 'Variable RX3 set to bit 2 (mode)
RX4 VAR PORTB.3 'Variable RX4 set to bit 3 (mode)
action VAR PORTB.4 'Variable action set to bit 4
alert VAR PORTB.5 'Variable alert set to bit 5
PORTB.0=1 'Set bit 0 of Port B = 1 (address)
PORTB.1=0 'Set bit 1 of Port B = 0 (address)
PORTB.2=0 'Set bit 2 of Port B = 0 (mode)
PORTB.3=1 'set bit 3 of Port B = 0 (mode)
B0 VAR PORTB.6 'Set B0 to bit 6
B1 VAR PORTB.7 'Set B1 to bit 7
PORTB.6=1 'Set bit 6 to 1 (hard wired address to compare to)
PORTB.7=0 'Set bit 7 to 0 (hard wired address to compare to)
B0=1
B1=0
'Tracking
If (RX3==0) && (RX4==0) Then 'Check if only tracking mode
If (RX1==B0) && (RX2==B1) Then 'Check if the address matches
RX3=1 'Convert third bit to 1 and send
action = RX3
High 0
alert = 0
Low 1
Else 'back to transmitter
action = RX3 'No matches. third bit remains 0 to send
Low 0
alert = 0
Low 1
Endif 'back tor transmitter
Endif
'Track and Find
If (RX3==0) && (RX4==1) Then
If (RX1==B0) && (RX2==B1) Then 'The receiver will take action to find the child
RX3=1
action=RX3
High 0
alert=1
High 1
Else
action=0
Low 0 'If no match will send 0 to transmitter
alert=0
Low 1
Endif
Endif
Bookmarks