[Company Logo Image]        IronCam-2 

Home Up Contents Search Articles Caveat Purpose Notice                                                           

'****************************************************************
'* Name : IronCam-2 *
'* Author : Ironsides *
'* Notice : Copyright (c) 2004 C *
'* : All Rights Reserved *
'* Date : 04 Feb 2004 *
'* Version : 1.0 *
'* Notes : Triggers still camera with left stick and video *
'* : video for right stick - video toggles ON/OFF *
'* : Stills will sequence shot if stick held full left *
'* : For PIC 12F675 *
'* : Version hits camera ON/OFF button to keep alive *
'* : Credit to Zagisrule! for coaching *
'****************************************************************

;The 12F675 has both analog converters and analog comparators.
;You must disable both to use the I/O pins for digital functions.
;In addition, the register that controls the analog converters
;has been named ANSEL, and it has a different format that the ADCON1
;register found on most PICmicro MCUs
PCON.3 = 1
ANSEL = 0 ;needed as as above
CMCON = 7
ASM
errorlevel -302 ; Suppress message 302
bcf STATUS,RP0 ; Bank 0
clrf GPIO ; Init GPIO
movlw 07h ; Set GP<2:0> to
movwf CMCON ; digital IO
bsf STATUS,RP0 ; Bank 1
clrf ANSEL ; Digital IO
movlw 0Ch ; Set GP<3:2> as inputs
movwf TRISIO ; and set up GP<5:4,1:0> as outputs
endasm

DEFINE OSC4 ;sets up 4 meg internal oscillator

SHUTTER VAR GPIO.0 ;LED on GP0 - simulates shutter On/Off - Pin 2
FLASH VAR GPIO.1 ;LED on GP1- hi-intensity LED to show shot - Pin 3
RADIO VAR GPIO.3 ;Input from receiver - Pin 4
MUSTEK VAR GPIO.2 ;Pulse to Mustek On/Off switch - Pin 5


INIT Var WORD ; This is used in the initialization loop
TIME var word ; This is used to time the stay awake 60 seconds
P VAR WORD ; This stores the PULSIN value
TOGLE VAR WORD ; Stores ON/OFF value for video
;*******************************************************************
;Initialize the PIC and blip the LED three times to show it is working.
clear ; Set all variables to zero
;Initialize the PIC and blip each LED three times to show it is working.
INITIALIZE:
FOR INIT = 1 to 3
HIGH SHUTTER
PAUSE 100 ;Pause of 20 milliseconds
LOW SHUTTER
HIGH FLASH
PAUSE 100 ;Pause of 20 milliseconds
LOW FLASH
Next INIT
goto RX
;*********************************************************************
RX: ; This is where we wait for a signal from the Tx
PULSIN RADIO,1,P ; With 4 meg oscillator, PULSIN measures at 10
; microsecond increments. 100 = Left/Off & 200 = Right/On
pause 20 ; This is a pause of 20 milliseconds
; GPIO.3 is physical pin 4 on the PIC
;*********************************************************************
;Test to determine the transmitter stick position.
IF (P < 50) then goto INITIALIZE ; Reminds you to turn on Tx
IF (P > 75) and (P < 125) THEN GOTO SINGLE ;Trips the shutter once
IF (P > 175) and (P < 225) THEN GOTO VIDEO ;Shoot continuously
;Many digital cameras require a shot every 60 secs to stay alive
IF (P > 130) and (P < 170) THEN TIME = TIME + 1 ; Stick in center = no action
IF TIME = 1600 then goto MUSTEK_SW ; computed count of 1600 ~ 1 minute
goto RX ; Go back and read the incoming signal
;*******************************************************************
;This trips the shutter for a single shot
SINGLE:
HIGH SHUTTER ;Turn ON LED (Shutter)
HIGH FLASH ;Turn on the hi-intensity LED to show shot taken
PAUSE 20 ;Wait to make sure it tripped (in milliseconds)
LOW SHUTTER ;Turn OFF LED (Shutter)
LOW FLASH ;Turn off the hi-intensity LED
PAUSE 2000 ;Let go of the stick here or you get multiples
TIME = 0 ;Reset the keep alive timer
GOTO RX ;Go to receiver to wait for the next command

VIDEO:
IF TOGLE = 0 THEN GOTO VIDEO_ON ; The zero means it was off
GOTO VIDEO_OFF ; Must have been 1 so toggle it off
VIDEO_ON:
HIGH SHUTTER
HIGH FLASH
PAUSE 1000 ; Move the stick off full right
TOGLE = 1 ; Set the toggle to on
GOTO RX ;Go to receiver to wait for the next command
VIDEO_OFF:
LOW SHUTTER
LOW FLASH
PAUSE 1000 ; Move the stick off full right
TOGLE = 0 ; Set the toggle to off
GOTO RX ;Go to receiver to wait for the next command
MUSTEK_SW:
HIGH MUSTEK
PAUSE 20
LOW MUSTEK
TIME = 0
GOTO RX
;********************************************************************

END ;Terminate the program

 

Home ] Up ]                                                                                                                                               

Send mail to ironsidz@hotmail.com with questions or comments about this web site.
Copyright © 2003 
Last modified: March 18, 2004