Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
;***********************************************************************
;receiver code for RLP434A module
;this one works with Holtek decoder 12D
;
$mod51
;port 3 pinouts
LED equ p3.5 ;
BUZZ equ p3.6 ;buzzer
VT equ p3.2 ;if high, valid byte rec'd
count1 equ 09h ;
count equ 08h ;
;----------------------------------------------------
org 00000h
Reset:
sjmp Start ; reset vector
Start:
MOV SP,#30h ; Set up stack pointer
mov a,#0FFh ;
mov p1,a ;
mov p3,a ;
;----------------------------------------------
Main:
mov p1,#0FFh ;P1 = input
setb LED ;LED OFF
setb VT ;VT = input
;wait here until VT goes high
Main1:
jnb VT,$ ;if VT = high, valid byte rec'd
;----------------------------------------------
mov a,P1 ;read P1
xrl a,#0F0h ;only need low nibble
CJNE a,#05h,Main1 ;received a "5" ring buzzer
;else, discard byte and wait for another
;----------------------------------------------
clr LED ;LED ON
RX_OK:
mov count1,#5 ;ring buzzer 5 times
WaitLp:
clr BUZZ ;buzzer on
lcall Delay250 ;wait 1/4 second
setb BUZZ ;buzzer off
lcall wait ;wait 1 second
djnz count1,WaitLp
;----------------------------------------------
stop:
sjmp stop ;wait until hardware reset
;----------------------------------------------
;1 sec delay @11.0592MHz
wait:
mov count,#4
wait1:
lcall Delay250
djnz count,wait1
ret
;----------------------------------------------
; 250mS @11.0592MHz
Delay250:
MOV R3,#2
MOV R2,#194
MOV R1,#56
Del250:
DJNZ R1,Del250
DJNZ R2,Del250
DJNZ R3,Del250
RET
;----------------------------------------------
end