This is what I got so far, I need to test it tomorrow with a camera, in simulation it looks OK, but I'm open to suggestions for improvement.
I need to code the operator input side of the program where the user selects with a pot the interval, now it just triggers once a second
Code:
'****************************************************************
'* Name : pentax.BAS *
'* Author : PEU based on examples from www.rentron.com *
'* Notice : Copyleft (c) 2011 *
'* : No Rights Reserved on derived work *
'* Date : 04-Jan-11 *
'* Version : 1.0 *
'* Notes : *
'****************************************************************
@ #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_off
DEFINE OSC 4
GPIO.2 = 1 ' IR LED off -----|<|----/\/\/\----+5
TRISIO.2 = 0 ' Output for IR signal
CMCON0 = 7 ' Comparators disabled
ANSEL = 0 ' A/D disabled
' IR carrier generator routines. Freq.inc.
Cycles VAR BYTE ' Number of carrier cycles
PAUSE 100
GOTO OverFreq ' jump over pulse routines
' Generate "Cycles" number of ~38.4kHz pulses
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:
Main:
sleep 1 'sleep one second
gosub trigger 'send trigger pulse
GOTO Main
Trigger: 'generate pentax trigger pulse
Cycles = 255
CALL Pulse38
Cycles = 244
CALL Pulse38
pauseus 3000
cycles = 37
CALL Pulse38
pauseus 1000
cycles = 37
CALL Pulse38
pauseus 1000
cycles = 37
CALL Pulse38
pauseus 1000
cycles = 37
CALL Pulse38
pauseus 1000
cycles = 37
CALL Pulse38
pauseus 1000
cycles = 37
CALL Pulse38
pauseus 1000
cycles = 37
CALL Pulse38
pauseus 5000 'end of stream
return
END
Bookmarks