I try to simulate this remote using 12F683 (because of PWM) :
But the results are similarly ; I really don't understand what I do wrong ...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




Bookmarks