Here's the output circuit from the PIC. The MOSFET is plenty good for the small 6 volt motor. All is powered by a 6 volt SLA gel battery. The PIC circuit is simple as can be and uses the sqaure 1/2 can, 4 pin oscillator. I've also attached the complete code but it may be full of my own notes and reminders. The motor runs right away when powered up or reset then supposed to repeat after 24 hours. Inside on my work bench I tested 3 days and it was accurate to within a few seconds. It had been outside last week and acted the same way. I took it inside to check everything and was good so tested 3 days, flawless but when it gets out in the cold the long delay gets longer.
;=============================================================================
; TITLE BLOCK
; Project Name...TestFeeder (12F629) Date...11/15/2011
;This project is...Test program. Turns on GPIO,1 for 3 secons then off for 24 hours
;Lessons Learned.. internal oscilator is not very acurate! 4Mhz can oscilator was installed to get seconds/day accuracy
;This was originaly written for 12F629 but converted (in program) to 12F675 by changing list and #include
;============================================================
;Instuctions 1...save file as .asm in c:/d&s/T/my docs/A/pic
; 2...PROJECTS>ADD FILES TO PROJECT
; 3...PROJECT>BUILD OPTIONS>PROJECT MPASM TAB Disable
; case sensitivity
;============================================================
list p=12F675 ;select device in configuration tab
#include <p12F675.inc>
radix hex
__config _XT_OSC & _WDTE_OFF & _PWRTE_ON & _MCLRE_ON & _BODEN_OFF & _CP_OFF & _CPD_OFF
;-----------------------------------------------
; Pin assignments: EQU
;gpIO,1 is output to motor circuit
;-----------------------------------------------
; Constants: EQU
;------------------- VARIABLE DEFINITIONS------------------------
cblock 0x20
endc
;===========================================================
org 0x00
goto start
; org 0x04 ;DELETE IF NO ISERV (with ;)
; goto iserv
;========================================================================
; Here is where to put CONDITIONAL ASSEMBLY instructions
; i.e. #define NAME
; at the code location ifdef debug
; #####
; else
; use {;} to include or not #####
; endif
;#define debug ;add or remove parenthesis from this line
;===========================================================
; Initialisation no ANSEL on 12F629 because no A-D
Start
banksel GPIO
clrf GPIO ;init gpio all outputs
banksel osccal
movlw b'10000000'
movwf osccal ;center oscillator frequency
banksel cmcon
movlw b'00000111' ;comparators off if not needed
movwf cmcon ; or configure comparators if using
banksel trisio
clrf trisio ;gpio all outputs
banksel gpio
clrf gpio ;all outputs low
;================ Main loop==================================
;calibrate oscilator if using internal
;bsf status,rp0
;call 3ffh
;movwf osccal
;bcf status,rp0
;main loop
again bsf gpio,1
call Delay3Secs
bcf gpio,1
call Delay24Hours
goto again
;continue forever
;=================Sub routines here=========================
;=================DELAYS here===============================
; DO NOT allow interrupts while in timing loops
; bcf intcon,gie ;disable interrupts
; bsf intcon,gie ;enable interrupts
Delay3Secs
; Delay = 3 seconds
; Clock frequency = 4 MHz
; Actual delay = 3 seconds = 3000000 cycles
; Error = 0 %
cblock
d1
d2
d3
endc
Delay
;2999995 cycles
movlw 0x1A
movwf d1
movlw 0x8B
movwf d2
movlw 0x07
movwf d3
Delay_0
decfsz d1, f
goto $+2
decfsz d2, f
goto $+2
decfsz d3, f
goto Delay_0
;1 cycle
nop
;4 cycles (including call)
return
Delay24Hours
; Delay = 86397 seconds
; Clock frequency = 4 MHz
; Actual delay = 86397 seconds = 86397000000 cycles
; Error = 0 %
cblock
c1
c2
c3
c4
c1_4
endc
Delayc
;86396999995 cycles
movlw 0xD6
movwf c1
movlw 0xB1
movwf c2
movlw 0x27
movwf c3
movlw 0xD5
movwf c4
movlw 0x02
movwf c1_4
Delay_0c
decfsz c1, f
goto $+2
decfsz c2, f
goto $+2
decfsz c3, f
goto $+2
decfsz c4, f
goto $+2
decfsz c1_4, f
goto Delay_0c
;1 cycle
nop
;4 cycles (including call)
return
;=================ISERV here================================
;------------SAVING context, W AND PCLATH REGISTERS
cblock
w_temp
status_temp
pclath_temp
endc
MOVWF W_TEMP ;Copy W to TEMP register
SWAPF STATUS, W ;Swap status to be saved into W
CLRF STATUS ;bank 0, regardless of current bank, Clears IRP,RP1,RP0
MOVWF STATUS_TEMP ;Save status to bank zero STATUS_TEMP register
MOVF PCLATH, W ;Only required if using page 1
MOVWF PCLATH_TEMP ;Save PCLATH into W
CLRF PCLATH ;Page zero, regardless of current page
iserv ;(Insert user code here )
;-------------Restore context--
MOVF PCLATH_TEMP, W ;Restore PCLATH
MOVWF PCLATH ;Move W into PCLATH
SWAPF STATUS_TEMP, W ;Swap STATUS_TEMP register into W
MOVWF STATUS ;Move W into STATUS register
SWAPF W_TEMP, F ;Swap W_TEMP
SWAPF W_TEMP, W ;Swap W_TEMP into W
retfie
END
Thanks for trying to help.
Aaron