TRISA= %00000100
Set_Defaults PROTON_4
Device 16F877A
DEFINE LOADER_USED 1
DEFINE OSC 20
'dim VARIABLE AS WORD
dim HEADER as word ' Header pulse length
dim PACKET as Word ' 12-bit IR information
dim P_VAL as Byte ' The bit length 60us = 0, 120us = 1
dim IR_BUT as Byte ' The BUTTON code returned
dim IR_DEV as Byte ' The DEVICE code returned
dim SONY_LP as Byte ' Temporary loop variable
symbol GREENLED= Porta.5 ' Assign the red LED to this pin
symbol REDLED = Porta.0
'VARIABLE=PULSIN PORTA.2,LOW
IRIN:
PACKET=0
IR_DEV=255
IR_BUT=255
HEADER=PULSIN PORTA.2,LOW
IF HEADER<1000 THEN RETURN
IF HEADER>1350 THEN RETURN
for SONY_LP=0 TO SONY_LP=11
P_VAL=PULSIN PORTA.2,LOW
IF P_VAL>=600 THEN PACKET.11=1 ENDIF
PACKET=PACKET>>1
'INC SONY_LP
'UNTIL SONY_LP=11111
NEXT
IR_BUT =PACKET& 01111111
IR_DEV=%00011111 & (PACKET >>7)
AGAIN:
LOW GREENLED
LOW REDLED
IF IR_DEV=255 THEN AGAIN
IF IR_DEV<>0 THEN AGAIN
IF IR_DEV =116 THEN HIGH GREENLED
IF IR_DEV=117 THEN HIGH REDLED
PAUSE 300
GOTO IRIN
im very new to the world of pics and new to the forum as well. i dont know why the above code is not working.im using pic16f877a and tsop 1238 and trying to decode sony 12 bit signals.if any one can point any mistake in the code it will be greatly appreciated....
Bookmarks