I just tossed this code together to see if I could make a simple on-off remote for my Sony TV, but it doesn't seem to want to work. I used an IR receiver module to compare my PIC produced signal with two different remotes that work with the TV, and the signals are very, Very close, but something still isnt right. I can't really see a make or break difference with my analog scope, but I have an LED connected to the IR receiver and it flashes, where as my signal seems to make it stay on, or at least its blinking fast enough to make it seem that way. I'm using HPWM (I know, I know.. ) to modulate the signal by using its pin as the low side of the LED and using RB0 as the highside and output. Can anyone offer corrections on the code (or my method)? Thanks ahead of time!
Code:@ DEVICE pic16F648A, INTRC_OSC_NOCLKOUT, WDT_OFF, PWRT_OFF, MCLR_OFF, BOD_OFF CMCON = 0 CCP1CON.2 = 1 CCP1CON.3 = 1 PORTB.3 = 0 Timingvar VAR WORD HPWM 1,127,40000 Main: Timingvar = 2704 GOSUB Header: SELECT CASE Timingvar.11 CASE 0 GOSUB sZERO: CASE 1 GOSUB sONE: END SELECT SELECT CASE Timingvar.10 CASE 0 GOSUB sZERO: CASE 1 GOSUB sONE: END SELECT SELECT CASE Timingvar.9 CASE 0 GOSUB sZERO: CASE 1 GOSUB sONE: END SELECT SELECT CASE Timingvar.8 CASE 0 GOSUB sZERO: CASE 1 GOSUB sONE: END SELECT SELECT CASE Timingvar.7 CASE 0 GOSUB sZERO: CASE 1 GOSUB sONE: END SELECT SELECT CASE Timingvar.6 CASE 0 GOSUB sZERO: CASE 1 GOSUB sONE: END SELECT SELECT CASE Timingvar.5 CASE 0 GOSUB sZERO: CASE 1 GOSUB sONE: END SELECT SELECT CASE Timingvar.4 CASE 0 GOSUB sZERO: CASE 1 GOSUB sONE: END SELECT SELECT CASE Timingvar.3 CASE 0 GOSUB sZERO: CASE 1 GOSUB sONE: END SELECT SELECT CASE Timingvar.2 CASE 0 GOSUB sZERO: CASE 1 GOSUB sONE: END SELECT SELECT CASE Timingvar.1 CASE 0 GOSUB sZERO: CASE 1 GOSUB sONE: END SELECT SELECT CASE Timingvar.0 CASE 0 GOSUB sZERO: CASE 1 GOSUB sONE: END SELECT goto main: Header: LOW 0 pauseus 2400 high 0 Pauseus 600 Return sONE: HIGH 0 pauseus 1200 LOW 0 Pauseus 600 Return sZERO: HIGH 0 pauseus 600 LOW 0 Pauseus 600 Return




Bookmarks