Sony IR Remote


Closed Thread
Results 1 to 40 of 41

Thread: Sony IR Remote

Hybrid View

  1. #1
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Unhappy ?!?

    I try to simulate this remote using 12F683 (because of PWM) :
    Code:
    @ device  pic12F683, intrc_osc_noclkout, wdt_off, pwrt_on, mclr_off, protect_off, bod_off
    
    INCLUDE "MODEDEFS.BAS" 
    
    
    GPIO      =       %00000010
    TRISIO    =       %00000010
    CCP1CON   =       %00001100  ' Mode select = PWM
    T2CON     =       %00000100  ' Timer2 ON + 1:1 prescale (last two bits)
    CCPR1L    =       %00001101  ' pwm duty 50%
    PR2       =       %00011001  ' Set PWM frequency to +/- 40kHz, set to 26 for 38kHz or 28 for 36kHz
    ANSEL     =       %00000000
    CMCON0    =       %00000111
    
    led   var GPIO.5
    but1 	var GPIO.1
    
    LED=0
    
    delay		var word
    i 		var byte
    timeX       var byte
    '=========================================
    main:
     pause 100
    
    if but1=0 then  vol_up
    vol_up:
        delay = 970 '(970 us low + 970 us high + 660 us low = 2600 us pulse total time)
    	while but1=0
    		gosub ir_out
    		gosub debounce
    	wend
    PAUSE 50
    
    Goto Main
    '=========================================
    ir_out:
            led=1
            pauseus delay
    
            led=0
            pauseus delay
    
            led=1
            pauseus 660
    
            led=0
            pause 10    'wait 10ms before repeating
    return
    '=========================================
    Debounce :
    For timeX= 1 to 50
    Pause 5
    next timeX
    Return
    '=========================================
    
    END         ' of program
    But the results are similarly ; I really don't understand what I do wrong ...
    Attached Images Attached Images  

  2. #2
    Join Date
    Oct 2007
    Location
    The Netherlands
    Posts
    45


    Did you find this post helpful? Yes | No

    Default

    Instead of led = 1 or led = 0 use this: TRISIO.2 = 0 or TRISIO.2 = 1
    You have to connect your IR led to GPIO.2, not GPIO.5
    Toggling TRISIO.2 will modulate your IR led

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts