Bruce, you are right again.
After thinking about... lets say 2 minuteshere is the code, I hope you and everyone else help me to make it better, there are a couple of things that can be improved for sure.
Good thing about it is that you change the pulse train and bingo timelapse remote for another brand, or even better, add a dipswitch and make the remote multibrand.
Sorry for spanish comments, google translate is your friendCode:'**************************************************************** '* Name : pentax.BAS * '* Author : PEU based on examples from www.rentron.com * '* Notice : Copyleft (c) 2011 * '* : No Rights Reserved on derived work * '* Date : 05-ENE-11 * '* Version : 1.02 * '* Notes : pablou at gmail dot com * '**************************************************************** @ #define IRTX GPIO ; Define port to use for IR out @ #define PIN 2 ; Define port pin to use for IR out @ device pic12f683,INTRC_OSC_NOCLKOUT , wdt_on, mclr_off, protect_on DEFINE OSC 4 GPIO = 0 TRISIO.2 = 0 ' LED IR TRISIO.1 = 0 ' LED testigo TRISIO.5 = 1 ' Input para interruptor normal abierto (con pulldown) CMCON0 = 7 ' Comparadores deshabilitados ANSEL = 0 ' A/D deshabilitado GIE VAR INTCON.7 ' Global interrupt enable 1=ON, 0=OFF GPIE VAR INTCON.3 ' Port change interrupt enable 1=ON, 0=OFF GPIF VAR INTCON.0 ' Port Change Interrupt Flag bit Cycles VAR BYTE ' Number of carrier cycles ContaSec var word ' Contador de segundos TLFlag var byte ' Se programo el contador? IRLED var GPIO.2 ' alias LED IR LED var GPIO.1 ' alias LED testigo BOTON var GPIO.5 GIE = 0 ' Disable global ints GPIE = 1 ' Enable port change int IOC.5 = 0 ' Int-on-change for GPIO.5 disbled PAUSE 100 ' Pausita pa estabilizar todo al arranque GOTO OverFreq ' jump over pulse routines ' Generate "Cycles" number of ~38.4kHz pulses Bruce at www.rentron.com ASM _Pulse38 bcf IRTX,PIN ; 1uS, LED=on goto $+1 ; + 2uS = 3uS goto $+1 ; + 2uS = 5uS goto $+1 ; + 2uS = 7uS goto $+1 ; + 2uS = 9uS goto $+1 ; + 2uS = 11uS goto $+1 ; + 2uS = 13uS bsf IRTX,PIN ; 1uS, LED=on goto $+1 ; + 2uS = 3uS goto $+1 ; + 2uS = 5uS goto $+1 ; + 2uS = 7uS goto $+1 ; + 2uS = 9uS nop ; + 1uS = 10uS decfsz _Cycles,f ; + 1uS = 11S goto _Pulse38 ; + 2uS = 13uS return ; Return to caller ENDASM OverFreq: contasec=0 tlflag=0 'Si el micro arranca con el boton apretado contar segundos while boton=1 contasec = contasec + 1 high led pause 50 low led pause 950 tlflag=1 wend contasec = contasec - 1 ' descontar un segundo, algun dia mejorare la rutina 'Loop del TimeLapse if tlflag = 1 then while boton = 0 sleep contasec ' dormir por el tiempo programado gosub trigger ' disparar high led ' prende LED testigo pause 50 ' sisi agrega 50ms, no me calienta en lo mas minimo :) low led ' apaga LED testigo wend ' Se acabo el timelapse porque se apreto el boton for contasec = 1 to 15 ' avisarle al usuario parpadeando el LED testigo high led pause 100 low led pause 100 next endif IOC.5 = 1 ' Int-on-change for GPIO.5 enabled GPIO = 0 Main: ' Loop principal @sleep ' Dormir while boton=0 ' Mientras no se aprete el boton no dejar pasar wend GPIF = 0 ' Clear port change interrupt flag gosub trigger ' Disparar high led ' prende LED testigo pause 50 low led ' apaga LED testigo GOTO Main Trigger: ' Generar el pulso de disparo PENTAX Cycles = 255 CALL Pulse38 Cycles = 239 CALL Pulse38 pauseus 3000 cycles = 38 CALL Pulse38 pauseus 1000 cycles = 38 CALL Pulse38 pauseus 1000 cycles = 38 CALL Pulse38 pauseus 1000 cycles = 38 CALL Pulse38 pauseus 1000 cycles = 38 CALL Pulse38 pauseus 1000 cycles = 38 CALL Pulse38 pauseus 1000 cycles = 38 CALL Pulse38 pauseus 5000 ' Fin del tren de pulsos PENTAX return END ' Fin
Pablo


here is the code, I hope you and everyone else help me to make it better, there are a couple of things that can be improved for sure.


Bookmarks