After thousands of re-writing this code, I've got finally results :
This is command for Volume Up only ; instead 102 cycles * 26 uS = 2650 uS, I put 112 * 26 = 2912, etc. So, the lenght of one pulse is 23.5 uS ?! Maybe with this PIC... Anyway, it's good to see that working, after hard work... Thank You all for support; every advice it's further wellcome !Code:@ DEVICE PIC12F675, INTRC_OSC_NOCLKOUT, wdt_off, pwrt_off, mclr_off, bod_off DEFINE OSC 4 CMCON = 7 ' Comparators disabled ANSEL = 0 ' A/D disabled @ #define IRTX GPIO ; Define port to use for IR out @ #define PIN 1 ; Define port pin for IR out Puls_a CON 112 ' 112 x 26uS = 2912 mS ( pulse with carrier ON) InterPulse CON 2800 ' 2.80mS (delay between pulses with carrier OFF) Puls_b CON 28 ' 28 x 26uS = 728 uS ( pulse with carrier ON) X VAR BYTE ' Data bit loop counter & bit index pointer Duration VAR BYTE ' Duration of button press Loops VAR BYTE ' Loop count Cycles VAR BYTE BANK0 SYSTEM' Number of carrier cycles to generate trisio=%11111101 option_reg.7=0 wpu =%11111101 but var gpio.5 GOTO Main ' Jump over pulse routine to Main Pulse: ' Generate "Cycles" number of 40kHz pulses ASM ; Keep this routine in code page 1, and jump over to Main BSF IRTX,PIN ; 1 MAKE IR HIGH 35% Duty cycle = 9 uS GOTO $+1 GOTO $+1 GOTO $+1 GOTO $+1 BCF IRTX,PIN ; 1 MAKE IR LOW 17 uS GOTO $+1 GOTO $+1 GOTO $+1 GOTO $+1 GOTO $+1 GOTO $+1 DECFSZ Cycles,F GOTO _Pulse ; 2 26 uS ENDASM return ' Return to caller Main: Duration = 2 ' Send it twice IF BUT=0 THEN For Duration = 1 to 2 Cycles = Synch ' carrier on Call Puls_a ' Send pulse PAUSEUS InterPulse ' Pause (carrier off) Cycles = Logic0 ' carrier on Call Puls_b ' Send pulse Pauseus 50000 Pauseus 50000 Next Duration ENDIF GOTO Main ' Return for more END




Bookmarks