diy aquarium controller

well the expensive part was the programer and im going to use these $1.70 chips for amny applications
the controller is just the first
the second will be a temp differential comparitor ( used on solar pool heaters and cost about 150 bucks) ill make one for CHEEP
 
ok guys need a lil help

any one who can figure out why the lights continue to flash at the same rate

#include <p16F690.inc>
__config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _BOR_OFF & _IESO_OFF & _FCMEN_OFF)

cblock 0x20
Delay1
Delay2
Tocc1
Tocc2
Toccc1
Toccc2
Tocccc1
Tocccc2
Ram1
Ram2
Outbit2 ; bit 1
Outbit1 ; bit 0
Foutbit
HZdelay1
HZdelay2
Hz1
Hz2
Toc1
Toc2

endc

org 0


Start:
bsf STATUS,RP0 ; select Register Page 1
clrf TRISC
bcf STATUS,RP0 ; back to Register Page 0

movlw b'00000001'
movwf Ram1
Mainreset1: ;reset hzdelays
movf Hz1,0
movwf HZdelay1

decf Ram2,f

decf Ram1,f
goto MainLoop
Mainreset2:
movf Hz2,0
movwf HZdelay2
decf Ram2,f
decf Ram1,f
goto MainLoop
MainLoop:
OndelayLoop ;Delay .197S
DECFSZ Delay1,f
GOTO OndelayLoop



decfsz Tocc1,f
goto Mainskip1
decfsz Toc1,f
goto Mainskip1
call Ramc1
Mainskip1:

decfsz Tocc2,f
goto Mainskip2
decfsz Toc2,f
goto Mainskip2
call Ramc2
;put ramdomizer here
Mainskip2:

;outputchanger
movf Outbit1,0
xorwf Outbit2,0
movwf Foutbit
movf Foutbit,0
movwf PORTC
;done with the output
;hzchanger
decfsz HZdelay1,f
goto HZS1 ;skip*****anger
call *****anger1

HZS1:
decfsz HZdelay2,f
goto HZS2
call *****anger2
HZS2:
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
BCF STATUS,C
decf Ram1,f

goto MainLoop

; start bit switcherfor port 1
Ramc1: ;make sure numberis above 128 for hz
movlw b'01111111'
btfss Ram1,7
addwf Ram1,0
movwf Hz1
movlw Ram2
movwf Toc1

return
Ramc2: ;make sure numberis above 128 for hz
movlw b'01111111'
btfss Ram1,7
addwf Ram1,0
movwf Hz2
movlw Ram2
movwf Toc2
return
*****anger1:
comf Outbit1,f
bcf Outbit1,1
bcf Outbit1,2
bcf Outbit1,3
return
; start bit switcherfor port 2
*****anger2:
comf Outbit2,f
bcf Outbit2,0
bcf Outbit2,2
bcf Outbit2,3
return
goto MainLoop
end
 
A.T.T.R

You still havent told us exatly what you are trying to do.

Comments like "rated for cycling at about 60 hz or more", leads me to believe that you are trying to control the speed of something like PWM ( pulse width modulating ) which could be used to control the speed of a DC motor. Or you could be trying to just turn power on & off using an SSR. Then you are talking about lights blinking

Stu
 
forgot i had two different threads lol

what im trying to do is vary the width of an ac pulse ( kinda like a seio controller)

each bit out will be able to controll one power head

so i just need to change the on off times of each bit
the leds blinking is just my temp output on a test board so i can see what is going on.. also i slowed it down alot so that i can see what is going on ( as 60 hz would be to fast to see)
 
grrrr i cant get this code to work ( insert string of curse words here)

looks like im going to need to start all over :((
 
#include <PIC.INC>
__config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _BOR_OFF & _IESO_OFF & _FCMEN_OFF)

cblock 0x20
Delay1 ; Assign an address to label Delay1
Delay1c
Delay1cc
Delay1ccc
Ram1
Ram2
Ram3
Hz1
Hzc1
Hzt1
Outbit2 ; bit 1
Outbit1 ; bit 0
Foutbit
De2
De1
endc

org 0
Start:

bsf STATUS,RP0 ; select Register Page 1
clrf TRISC
MOVLW b'00000111' ;configure Timer0. Sourced from the
;Processor clock
MOVWF OPTION_REG ;Maximum Prescaler
bcf STATUS,RP0 ; back to Register Page 0
MainLoop:
DECFSZ De2,1
goto MainLoop
DECFSz De1,1
goto MainLoop
BCF STATUS,C
BTFSC INTCON,T0IF ;test rollover
INCF Ram1
BCF INTCON,T0IF
BCF STATUS,C
BTFSS STATUS,C
INCF Ram2
BCF STATUS,C
Hzv1: ;time for bit change?
decfsz Hzc1
Goto Hzv2
Call Bitswitch1
Hzv2:

Bitwrite: ; write to port c
movlw Outbit1

movwf PORTC
Goto MainLoop
Bitswitch1:
comf Outbit1,f

movlw Hz1
movwf Hzc1
decfsz Delay1
return
decfsz Delay1c
return
decfsz Delay1cc
return
decfsz Hzt1
return
Call Timechange1
Return
Timechange1:
movlw Ram1
Movwf Hzt1
movlw Ram2
movwf Ram3
BSF Ram3,7
movlw Ram3
Movwf Hz1
return
Goto MainLoop
end
WHATS WRONG O_O help lol

not sure if i have too many calls and it is getting stuck

later ill set up the WDT and make an error interupt to see if it is stuck or if my code sucks
 
Man, I LOVE this stuff! I wish I would have found this thread a month ago! I could have saved myself a lot of money. I ordered a bunch of stuff from automatedaquariums.com. :(

I still get to do all the programming for it which I'm looking forward to doing but it's been a LONG time since I've delved into the low level stuff like you're doing.

I've been thinking of the VFD's because I screwed up BIG time and I have a 150g predator tank that I want to connect into my 330g sump BUT I need to pump the water in both directions. I figure that if I used VFD's with high quality flow meters I could adjust the flow rate on the fly from the pumps and keep them both equalled out.

They stuff you are doing matches perfectly with what I'm thinking of. Please excuse me for butting in and I know this is my first post but I figured this is a great thread to introduce myself. :)
 
Back
Top