Ok, Thanks ! With 16F648A works (in ISIS) great.
But...
I find in "Experimenting with the PicBasic Pro Compiler" by Les Johnson how to define subroutine "Pulse" ; so, I re-re-x-rewrite code for 12F675. I have some results but I don't understand how define the lenght of pulses. I put "?!" where I don't know if it's right.
Any advices ?
Code:' PIC12F675: +--U--+ ' +5V [ ] GND ' key 5 |---/--- >[ ]< ---/---| key 1 ' key 4 |---/--- >[ ]< ---/---| key 2 ' pull-up! key 3 |---/--- >[ ]>--[4K7]-- NPN Transistor, IR LED @ DEVICE PIC12F675, intrc_osc_noclkout, wdt_off, pwrt_on, mclr_off, bod_off INCLUDE "MODEDEFS.BAS" DEFINE OSC 4 CMCON=7 OPTION_REG.7=0 TRISIO = %00111011 WPU=%00111011 IOCB=%00111011 ANSEL=0 but1 var gpio.0 but2 var gpio.1 LED var gpio.2 but3 var gpio.3 but4 var gpio.4 but5 var gpio.5 delay var word BURST var word i var byte timeX var byte GIE var intcon.7 ' global interrupt enable 1=on ; 0=off gpie var intcon.3 ' port change interrupt enable 1=0n ; 0=off gpif var intcon.0 ' port change interrupt flag bit GIE=0 GPIE=1 '========================================= main: @ sleep pause 100 IF but1=0 then ; VOLUME UP DELAY=37 ; 970 us/ 26 us each pulse = 37 ?! GOSUB IR_REMOTE ENDIF IF but2=0 then ; VOLUME DOWN DELAY=1270 GOSUB IR_REMOTE ENDIF IF but3=0 then ; BUTTON UP DELAY=1570 GOSUB IR_REMOTE ENDIF IF but4=0 then ; BUTTON DOWN DELAY=1870 GOSUB IR_REMOTE ENDIF IF but5=0 then ; MUTE DELAY=2170 GOSUB IR_REMOTE ENDIF GPIF=0 'Clear port change interrupt flag PAUSE 50 Goto Main '========================================= ir_REMOTE: FOR BURST=1 TO DELAY GOSUB PULSE NEXT BURST pauseus (delay*26) ' ?! FOR BURST=1 TO 25 ' 660/26 ?! GOSUB PULSE NEXT BURST return '========================================= Pulse: ' 2+4+8+4+7+1=26 us HIGH LED ' Turn on LED (4 cycles) @ NOP @ NOP @ NOP @ NOP @ NOP ' each NOP takes 1 instruction cycle @ NOP ' assumig 4 MHz @ NOP @ NOP LOW LED ' turn off the LED (4 cycles) @ NOP @ NOP @ NOP @ NOP @ NOP @ NOP @ NOP RETURN ' return from the subroutine (1 cycle) '========================================= END ' of program


) great.


Bookmarks