Hi Pablo,
Thats a nice idea; a sort of semi-universal (Pentax/Nikon/Canon) time lapse trigger.
The Canon trigger is perhaps the simplest to encode. I'm pasting my code, of which you could delete the delayed-trigger related lines. These a re used on the remote to trigger the shutter 2 seconds after the signal is sent.
Code:
Main:
NAP 0 ; Reduce consumption in standby from 900uA to 116uA (cost of 18ms delay)
IF SW1 = 0 THEN GOSUB NO_DLAY
IF SW2 = 0 THEN GOSUB DLAY
GOTO MAIN
NO_DLAY:
HIGH LED
CYCLES = 16 ; COUNTER HAS TO BE RESET TO DEFAULT!
Gosub Pulse
PAUSEUS 7300
CYCLES = 16 ; COUNTER HAS TO BE RESET TO DEFAULT!
GOSUB PULSE
PAUSE 50 ; Prevent inadvertant double triggerPAUSE 500
LOW LED
PAUSE 500
RETURN
DLAY:
HIGH LED
CYCLES = 16 ; COUNTER HAS TO BE RESET TO DEFAULT!
Gosub Pulse
PAUSEUS 5300
CYCLES = 16 ; COUNTER HAS TO BE RESET TO DEFAULT!
GOSUB PULSE
PAUSE 50 ; Prevent inadvertant double triggerPAUSE 500
LOW LED
PAUSE 500
RETURN
Pulse: ' THIS GENERATES "Cycles" number of 40kHz pulses (if total delays are 25)
' So, for Canon, 16 Cycles of 31 uS (32.6 KHz) => Demodulated pulse of 0.496 mS
ASM
bsf 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
goto $+1 ; + 2uS = 15uS
goto $+1 ; + 2uS = 17uS
bcf IRTX,PIN ; 1uS, LED=off
goto $+1 ; + 2uS = 3uS
goto $+1 ; + 2uS = 5uS
goto $+1 ; + 2uS = 7uS
goto $+1 ; + 2uS = 9uS
goto $+1 ; + 2uS = 11uS
decfsz _Cycles,f ; + 1uS = 12S ; This decrements in a loop till 0; then goes to next line
goto _Pulse ; + 2uS = 14uS
return ; Return to caller
ENDASM
END
Would be nice to have your feedback on the finished product.
BTW, in your schematic you have a pullup on the switch input; cant you just enable the internal pullup?
Regards,
Anand
Bookmarks