Piezo Siren,Piezo Siren 12V,120Db Piezo Siren,Loudest Piezo Siren NINGBO SANCO ELECTRONICS CO., LTD. , https://www.sancobuzzer.com
1, the query method, both software constantly query whether it is low (remote control signal) and then read the header code by precise delay. And data 0 or 1 code.
2. When the signal input is read, the timer counter is turned on, and then the number of interrupts of the timer is read to determine the header code and 0, 1.
3RB0 or ​​RB4-RB7 plus timer (or software delay) takes advantage of the input interrupt is real-time control.
as follows:
; *** emission is 6221, the received code value is sent to the ICD PORTC port display ******
;*******************************
Org0000h
Nop
Gotostart
Org0004h
Gotoserv
;************************************************* *
Start
Bsfstatus, rp0; body 1
MOVlw0000h
MOVwftrisc; C port output
MOVlw0ffh; B port RB0 input
MOVwftrisb
MOVlwB'00000100';1:64
MOVwfoption_reg; TMR0 timer
Bcfstatus, rp0; body 0
clrfiNTCon;10010000
Bsfintcon, 7; open INT falling edge interrupt
Bsfintcon, 4
Bcfintcon, 1
Clrfportc
Loop
Sleep
Nop
Gotoloop
;*************On-site protection********************************
Serv
MOVwfw_temp
Swapfstatus,0
Clrfstatus
MOVwfstatus_temp
MOVfpclath, 0
MOVwfpclath_temp
Clrfpclath
;***************Remote handling.******************************
Bcfintcon,1
Btfscportb, 0; detects if RB0 is 0.
Gotozdhh; RB0 is not 0, misinterrupted.
Calldelay8; call 8MS delay. Header detection.
Btfscportb, 0; detection header code
Gotozdhh; not interrupted
Calldelay5; data detection after 5MS delay.
Btfssportb, 0; detects if RB0 is high.
Gotozdhh; not to continue testing.
;*********************************************
Clrfdata1;20H
Clrfdata2;21H
Clrfdata3;22H
Clrfdata4;24H
Clrfjsp2; 32-bit counter
Clrfsj; received data register
Clrfjsp1; 8-bit counter
MOVlw0x20; 20H register to send W
MOVwffsr; send 20H to FSR by W
Jcbtfscportb, 0; detects if RB0 is low.
Gotojc; not to continue testing.
;**************0 and 1 data detection ******************************
Jscalldelay1; delay 1.3MS
Btfscportb, 0; whether the detection header code is 0 or 1,
Gotos1; the detected data is not "1"
;*************0Data Processing*****************************
Bcfsj,c; data is "0"
Rrfsj,1;0 data right shift to SJ register
Gotoj1
;**************1Data processing.*************************
S1bsfsj,c
Rrfsj,1
Ddpbtfscportb,0
Gotoddp
;**************RAM shift***************************
J1incfjsp1; 8-bit count register
Incfjsp2; 32-bit number, register.
Btfssjsp1,3; Is there 8 digits?
Gotojs
Clrfjsp1
MOVfsj, 0; shift 8 digits to W
MOVwfindf; W to DATA
Incffsr; RAM address plus 1
Clrfsj
;*****************************
Btfssjsp2, 5; detects whether 32 bits have been received.
Gotojs; no, retest.
MOVlwB'10001111'; send IC high 8-bit code
Xorwfdata1,0; subtraction (Z:1=result is 0; 0=result is not 0)
Btfssstatus, 2; the result is 0 and the next step.
Gotozdhh; subtraction result is not 0 interrupt return
MOVlwB '101010101'; low 8-bit IC code detection
Xorwfdata2,0
Btfssstatus, 2
Gotozdhh
;comfdata4,0; data inverse detection. No use.
;subwfdata3,0
;btfssstatus,2
;gotozdhh
MOVfdata3,0; send digital to C port
MOVwfportc
Gotozdhh; interrupted after receiving 32 bits
;****************zdhh interrupt return procedure *********************
Zdhh
MOVfpclath_temp,0
MOVwfpclath
Swapfstatus_temp, 0; exchange STATUS and W content, restore the body selection.
MOVwfstatus; send W content to the STATUS register
Swapfw_temp, 1; exchange w_temp
Swapfw_temp, 0; swap w_temp with w content, will w_temp inside?
Bcfintcon, 1
Retfie; interrupt returns,
;****************8ms******************************** *
Delay8bcfintcon,5
Bcfintcon, 2
MOVlwD'15'
MOVwftmr0
Loop1btfssintcon, 2
Gotoloop1
Return
;****************5ms******************************** *
Delay5bcfintcon,5
Bcfintcon, 2
MOVlwD'120'
MOVwftmr0
Loop2btfssintcon, 2
Gotoloop2
Return
;****************1.3ms*******************************
Delay1bcfintcon,5
Bcfintcon, 2
MOVlwD'240'
MOVwftmr0
Loop3btfssintcon, 2
Gotoloop3
Return
;*************
End
There may be two types of error codes: the prefix is ​​not good. The data transmission has errors, especially the timing errors. You can use the software to verify the headers. It is better to confirm that it is better to send more than one in the software. The bit method judges that there are multiple consecutive identical subheads that appear to be aligned. For example, 20 consecutive 10 transitions indicate that the data is ready to be sent and then wait for the end of 10 transmissions, followed by a header such as 11110000.
A. I bought a universal remote control outside. He used pic16c57c to make it. It shows that it is uninterrupted. I really don't understand how he did it. It does not have a decoding chip. Does anyone know? I am also doing this now, who can give me a hint, thank you.
B This is easy. Last time I used two PIC16C57C to make a small module with one transmission and one reception. Effective control, no garbled, but one drawback is that it will be interfered by other infrared products! !
C infrared accepts the external interrupt, and the timing can be detected, which is very accurate. I am using the PIC16F72 chip.
D I use the infrared receiving tube plus two-stage amplification to see the infrared output waveform. Use Changhong's remote control as the signal source. It takes 10ms on the oscilloscope to see the complete signal waveform, like a stabilized waveform. Something, I read the relevant book saying that the infrared signal is modulated on the 38kHz signal, then I can't see the waveform when I hit the oscilloscope to 50ns, so the program is not impossible to edit, which one is high. Help me, thank you
E can use the input capture function in CCP, it is very easy to use, carefully read the inputcapture related content, it is easy to have an event on the CCP pin (can be set to rising edge, falling edge or other way) ), the content of TMR1 is recorded back, so it is very accurate, even if the interrupt response is slow, it is no problem, such a function to do infrared remote control is the most appropriate! !
F replies to the infrared timing receiving principle using RB0 as an interrupt (FIRST: RISINGTRIG, SECOND: FALLINGTRIG), and simultaneously starts TIMER2 timing 100US) counting. When the next interrupt comes, there are 88 numbers in TIMER2, and 9MS detects it. The rest of the time,
analogy. Note that the interrupt edge of RBO is changed according to the timing. According to this principle, it is easy to program the code.
There is another place worth noting; the attenuation of the infrared signal is very powerful, so we must consider the choice of its acceptance range. It can be used in practical ways. It has enough time in terms of receiving data, so that there is a correct reception data. benefit