Hey Everyone!
I have a small code and a big problem!
There is a TSOP IR receiver on the port B0, and a LED on the port A1.
What i want: when i press a button on the remote, the LED must be turned on, and by the next button press, turned off. The problem is, the IR signal is long, and the LED flashes. I want to use the Timer0 for this problem, but doesnt work.
Please help! Thank You!
I have a small code and a big problem!
There is a TSOP IR receiver on the port B0, and a LED on the port A1.
What i want: when i press a button on the remote, the LED must be turned on, and by the next button press, turned off. The problem is, the IR signal is long, and the LED flashes. I want to use the Timer0 for this problem, but doesnt work.
Please help! Thank You!
Rich (BB code):
LIST P= 16F627
#INCLUDE "P16F627.INC"
ERRORLEVEL 0, -302
__CONFIG _CP_OFF&_WDT_OFF&_LVP_OFF&_INTRC_OSC_NOCLKOUT
CBLOCK 0X70
W_TEMP
STATUS_TEMP
ENDC
ORG 0x00
GOTO MAIN
ORG 0x04
MOVWF W_TEMP
SWAPF STATUS,W
MOVWF STATUS_TEMP
BTFSC INTCON,T0IF
GOTO T0MEGSZ
BTFSC INTCON,INTF
GOTO MEGSZ_RB0
GOTO MEGSZKILEP
MEGSZ_RB0
BTFSS PORTA,1
GOTO BE
GOTO KI
BE
BSF PORTA,1
GOTO MEGSZKILEP
KI
BCF PORTA,1
GOTO MEGSZKILEP
MAIN
MOVLW 0x07
MOVWF CMCON
BANKSEL TRISA
MOVLW 0x00
MOVWF TRISA
MOVLW 0xFF
MOVWF TRISB
MOVLW B'00000111'
MOVWF OPTION_REG
BCF PCON,3
BANKSEL PORTA
BSF INTCON,INTE
BSF INTCON,GIE
LOOP
NOP
GOTO LOOP
MEGSZKILEP
BCF INTCON,INTF
BCF INTCON,INTE
BSF INTCON,T0IE
SWAPF STATUS_TEMP,W
MOVWF STATUS
SWAPF W_TEMP,F
SWAPF W_TEMP,W
RETFIE
T0MEGSZ
BCF INTCON,INTF
BSF INTCON,INTE
BCF INTCON,T0IE
BCF INTCON,T0IF
SWAPF STATUS_TEMP,W
MOVWF STATUS
SWAPF W_TEMP,F
SWAPF W_TEMP,W
RETFIE
END
Last edited by a moderator: