Receptor de Control Remoto TV con PicBasicPro

Espero les sea de utilidad este codigo para receptor de controles remoto de TV, probado con Samsung, digix y los controles de los transmisores de FM (chinos)

esquema:
Dibujo.JPG

Codigo:
Código:
@ DEVICE Pic16F628A,Intrc_Osc, WDT_Off , PWRT_Off,BOD_Off, MCLR_Off, LVP_Off, CPD_Off , PROTECT_Off

define osc 4

DEFINE LCD_RSREG PORTB 
DEFINE LCD_RSBIT 1 
DEFINE LCD_RWREG PORTB 
DEFINE LCD_RWBIT 2 
DEFINE LCD_EREG PORTB 
DEFINE LCD_EBIT 3 
DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 4
DEFINE LCD_BITS 4 
DEFINE LCD_LINES 2 
DEFINE LCD_COMMANDUS 2000 
DEFINE LCD_DATAUS 50 
 
IR_Min    Con 300
IR_Max    Con 2500
IR       Con 700
  
IR_Dato      var byte 
Lapso        Var Word
led          var porta.0

TR           var word
CM           var Word

TrisA=%00000000
TrisB=%00000001
CMCON=7
Option_reg.6=0
INTCON=%11010000
T1CON.5=0:T1CON.4=0
T1CON.0=1
PIE1.0 =1

CM=0:TR=0:IR_Dato=0
on interrupt goto IntON
portb=0
porta=0
high led
pause 1000
low led

Main:
  
 if IR_Dato=32 then
  INTCON.7=0
  lcdout $FE,$01,hex tr," ", hex CM
  if TR=$e0e0 then 
   select case CM
    case $40bf:toggle led:pause 100
   end select
  endif
  CM=0:TR=0:IR_Dato=0
  INTCON.7=1
 endif  
 
goto main

Disable Interrupt
 IntOn: 

 'int_timer1
 if PIR1.0 then
  if IR_Dato<>32 then CM=0:TR=0:IR_Dato=0
  PIR1.0=0
 endif

 'int_ext
 if INTCON.1 then
  if not option_reg.6 then 
   lapso.highbyte=Tmr1H
   lapso.lowbyte=Tmr1L
   if (Lapso>IR_Max) or (Lapso<IR_Min) then  
    IR_Dato=0:TR=0:CM=0           
   else
    if Lapso<IR then
     if IR_Dato<16 then 
      TR=TR<<1:TR.0=0
     else
      CM=CM<<1:CM.0=0
     endif 
     IR_Dato=IR_Dato+1
    endif
    if Lapso>IR then
     if IR_Dato<16 then 
      TR=TR<<1:TR.0=1
     else
      CM=CM<<1:CM.0=1
     endif 
      IR_Dato=IR_Dato+1 
    endif
   endif
  else 
   TMR1H=0:TMR1L=0  
  endif
  INTCON.1=0
  toggle option_reg.6
 endif 
 resume
 enable interrupt

Video del circuito:

Lo que hace es poner en pantalla el identificador del control y la tecla pulsada

en el video muestra E0E0 que es el codigo de mi control samsumg y 48b7 que es la tecla de encendido. (el LCD esta de cabeza :LOL:)

ese dato se pone en esta parte del codigo:
if TR=$e0e0 then
select case CM
case $48b7:toggle led:pause 100
end select
endif
 
Última edición:
Gracias por el aporte, muy interesante. ¿Que receptor IR usas?
receptor tsop1838 a 38Khz
detector_proximidad_infrarrojo_receptor_tsop_1838.png


o ir5040 tambien a 38Khz
ir5040_t.jpg
 
Atrás
Arriba