ok, found problem, need to adjust timing now - water timer, no external osc
Hello,
I have a very crude version of a water timer, IE something that barley works for my purposes. Timing is inaccurate due to no external osc, but I did get in my timer chips with built in osc.
basiclly
do
run pattern 0 runs everything, then pauses for 12 hours
run pattern 1 runs only zone 3, then pauses for 12 hours
loop
one oddity, is although my PatternMode var is a bit, SXSim won't let me TOGGLE it. So I did a IF THEN ELSE kludge. I don't know if it would of downloaded with the toggle, but I don't have time right now.
Post Edited (Capdiamont) : 6/19/2008 12:54:23 AM GMT
I have a very crude version of a water timer, IE something that barley works for my purposes. Timing is inaccurate due to no external osc, but I did get in my timer chips with built in osc.
basiclly
do
run pattern 0 runs everything, then pauses for 12 hours
run pattern 1 runs only zone 3, then pauses for 12 hours
loop
one oddity, is although my PatternMode var is a bit, SXSim won't let me TOGGLE it. So I did a IF THEN ELSE kludge. I don't know if it would of downloaded with the toggle, but I don't have time right now.
Post Edited (Capdiamont) : 6/19/2008 12:54:23 AM GMT

Comments
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Did you know that 111,111,111 multiplied by 111,111,111 equals 12345678987654321 ?
www.iElectronicDesigns.com
·
Something went wrong, it didn't work. Problem is I'm miles from home to fully troubleshoot it. I'm just sxsiming it for now. Thus the need for the watch variables. I know the 24v power supply will power the valves, and the wiring is good. I jumpered one side of the power supply to each valve zone and they work. Reading specs, they are supposed to be 2 watts at 24vAC.
I used LAA710STR
Description: SOLID STATE DUAL POLE OPTOMOS RELAYS
Brand: CLARE
data sheet http://www.clare.com/home/pdfs.nsf/0/DEDCD3902414AD6185256D3500556911/$file/LAA710_R01_1.pdf
which is able to handle 1 amp up to 60v
What little I can tell, the code looks ok. Might be the the wiring to that part, or that part. I figure pins 2 and 4 go to ground. Pins 1 and three to output pin via 470 ohm resistor. I used 440 ohm(two 220 ohm in series) 1/4 watt. The other side. Pins 6 and 7 are tied together and ran to the supply side of the transformer. Pins 5 and 8 goes out to respective zone valves then returns on common black wire to other side of transformer.
My other thoughts is maybe the part is wired up right, and couldn't handle the startup amp surge, or collapsing voltage from the valve.
'very quick method, run pattern a, 'wait another 12 house run pattern b, wait 12 hours, repeat 'pattern 0 all zones 'pattern 1 only baby tears 'use arrays of constants in minutes for each pattern 5 min incraments 0 zone is off 'use look up index is pattern zone / 5 if > 0 'twoi lookups one for each timer temp word value 'timer temp is for both the off time and the on time ' ------------------------------------------------------------------------- ' Device Settings ' ------------------------------------------------------------------------- DEVICE SX48, OSC128KHZ IRC_CAL IRC_4MHZ FREQ 128_000 ' ------------------------------------------------------------------------- ' IO Pins ' ------------------------------------------------------------------------- ' PORT RA 4 bit reserve for serial on all programs, unused set to outout low ' port rb 8 bit, input ' port rc 8 bit, output ' port rd and re 8 bit, unused set to output, low RAUnused PIN RA OUTPUT ' serial network RBUnused PIN RB INPUT PULLUP 'buttons RCUnused PIN RC OUTPUT 'relays RDUnused PIN RD OUTPUT 'leds REUnused PIN RE OUTPUT 'unused Switch PIN RB.0 INPUT PULLUP 'start and stop 'SwitchL PIN RB.1 INPUT PULLUP 'learn cat tag, press, then cat btn to learn that cat's tag Transformer PIN RC.0 OUTPUT 'transformer on/off to save money during peak electric times Zone1 PIN RC.1 OUTPUT 'zone 1 on/off drip waterfall Zone2 PIN RC.2 OUTPUT 'zone 2 on/off drip roses Zone3 PIN RC.3 OUTPUT 'zone 3 on/off baby tears Zone4 PIN RC.4 OUTPUT 'zone 4 on/off rubarb AutoLED PIN RD.0 OUTPUT 'the only LED Zone1LED PIN RD.1 OUTPUT 'zone 1 status Zone2LED PIN RD.2 OUTPUT 'zone 2 status Zone3LED PIN RD.3 OUTPUT 'zone 3 status Zone4LED PIN RD.4 OUTPUT 'zone 4 status ' ------------------------------------------------------------------------- ' Constants ' ------------------------------------------------------------------------- 'on delay time, wait period between on/off, word size MaxTime CON 65535 'Debounce CON 1 'Pressed CON 0 ' ------------------------------------------------------------------------- ' Variables ' ------------------------------------------------------------------------- 'delaytemp var to measure time DelayTemp0 VAR WORD DelayTemp1 VAR WORD 'mode, auto, unlocked, locked, inonly, outonly 'ModeTemp Var Byte SwitchTemp VAR BIT IndexLookup VAR BYTE PatternMode VAR BIT Pattern0 VAR BYTE (4) Pattern1 VAR BYTE (4) DelayTemp VAR WORD Watch DelayTemp0, 16, udec Watch DelayTemp1, 16, udec Watch DelayTemp, 16, udec Watch PatternMode, 1, udec Watch IndexLookup, 8, udec 'mouse VAR Bit ' Value can be 0 or 1 'cat VAR Nib ' Value can be 0 to 15 'dog VAR Byte ' Value can be 0 to 255 'rhino VAR Word ' Value can be 0 to 65535 'max 17 bytes mem or about 8 word size variable ' ------------------------------------------------------------------------- ' INTERRUPT ' ------------------------------------------------------------------------- 'ISR_Start: ' ISR code here 'ISR_Exit: ' RETURNINT ' {cycles} ' ========================================================================= PROGRAM Start ' ========================================================================= 'Pgm_ID: ' DATA "CatdoorVbeta0.05", 0 ' ------------------------------------------------------------------------- ' Subroutines / Jump Table ' ------------------------------------------------------------------------- CountDown SUB 0 LookupTime SUB 0 RunPattern SUB 0 ' ------------------------------------------------------------------------- ' Program Code ' ------------------------------------------------------------------------- Start: ' initialization code here RA = 0 'set putput low RC = 0 'set output low RD = 0 'set output low RE = 0 'set output low IndexLookup = 5 PatternMode=0 'Pattern0 Pattern0(0)=15 Pattern0(1)=15 Pattern0(2)=15 Pattern0(3)=15 'pattern1 Pattern1(0)=0 Pattern1(1)=0 Pattern1(2)=15 'babytears Pattern1(3)=0 Main: DO ' DelayLoop ' DelayLoop ' UnlockI ' DelayLoop ' DelayLoop ' LockI ' DelayLoop ' main code here ' ModeTemp/DelayTemp/MaxDelay ' IF Switch = Pressed THEN, 'INC ModeTemp ' PAUSE Debounce ' DO ' LOOP UNTIL Switch <> Pressed ' PAUSE Debounce ' TOGGLE SwitchTemp ' ENDIF '2 modes ' IF SwitchTemp = 0 THEN ' ClearButton ' ENDIF ' IF SwitchTemp = 1 THEN ' CountButton ' ENDIF RunPattern RunPattern LOOP ' ------------------------------------------------------------------------- ' Subroutine Code ' ------------------------------------------------------------------------- SUB CountDown 'counts the time down LookupTime 'TheLED = 1 DO IF DelayTemp0 <> 0 THEN 'only if upper most varable can be decreased DEC DelayTemp0 ELSE 'advance DelayTemp7 when DelayTemp6 IF DelayTemp1 <> 0 THEN DEC DelayTemp1 DelayTemp0 = MaxTime ENDIF ENDIF DelayTemp = DelayTemp0 OR DelayTemp1 IF DelayTemp = 0 THEN EXIT LOOP ENDSUB SUB LookupTime ' Use IndexLookup /5 to put correct times in to DelayTemp 'lookup values are in inc of 5 min IF IndexLookup > 0 THEN IndexLookup = IndexLookup / 5 ENDIF ' Lookup IndexLookup=0 is off time '1st lookup is main DelayTemp(most used) '263,478.8 per min at 400_000 hz 'NOTE NOW AT 128KHZ 'divide by 65536 for a word var '12hours=1_952_868_240 '5min=1_317_394 LOOKUP IndexLookup, 19_182, 28_350, 0, 19_514, 0, 10_678, 0, DelayTemp0 '2nd lookup is 2nd DelayTemp LOOKUP IndexLookup, 926, 6, 13, 19, 26, 32, 39, DelayTemp1 ENDSUB SUB RunPattern 'execute pattern Transformer = 1 'Turn on 24vAC transformer IF PatternMode = 0 THEN IF Pattern0(0) >= 1 THEN Zone1LED = 1 Zone1 = 1 IndexLookup = Pattern0(0) CountDown Zone1LED = 0 Zone1 = 0 ENDIF IF Pattern0(1) >= 1 THEN Zone2LED = 1 Zone2 = 1 IndexLookup = Pattern0(1) CountDown Zone2LED = 0 Zone2 = 0 ENDIF IF Pattern0(2) >= 1 THEN Zone3LED = 1 Zone3 = 1 IndexLookup = Pattern0(2) CountDown Zone3LED = 0 Zone3 = 0 ENDIF IF Pattern0(3) >= 1 THEN Zone4LED = 1 Zone4 = 1 IndexLookup = Pattern0(3) CountDown Zone4LED = 0 Zone4 = 0 ENDIF ENDIF IF PatternMode = 1 THEN IF Pattern1(0) >= 1 THEN Zone1LED = 1 Zone1 = 1 IndexLookup = Pattern1(0) CountDown Zone1LED = 0 Zone1 = 0 ENDIF IF Pattern1(1) >= 1 THEN Zone2LED = 1 Zone2 = 1 IndexLookup = Pattern1(1) CountDown Zone2LED = 0 Zone2 = 0 ENDIF IF Pattern1(2) >= 1 THEN Zone3LED = 1 Zone3 = 1 IndexLookup = Pattern1(2) CountDown Zone3LED = 0 Zone3 = 0 ENDIF IF Pattern1(3) >= 1 THEN Zone4LED = 1 Zone4 = 1 IndexLookup = Pattern1(3) CountDown Zone4LED = 0 Zone4 = 0 ENDIF ENDIF PatternMode = NOT PatternMode Transformer=0 'Turnoff 24vAC transformer IndexLookup = 0 'Set delay time to off period CountDown 'delay time ENDSUBIt is on Gunther's "todo" list.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
That was on fire when I got here...
www.iElectronicDesigns.com
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Shawn Lowe
When all else fails.....procrastinate!
It doesn't matter where the WATCH statements are. They have no effect on the running of the program.
It only matters where the BREAK is.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Uhhhm, that was on fire when I got here...
www.iElectronicDesigns.com
·
Edit:Ok, so shouldn't there be a break in this program? I don't see one.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Shawn Lowe
When all else fails.....procrastinate!
Post Edited (Shawn Lowe) : 6/18/2008 1:27:24 PM GMT
Both power supplies are plugged in to wall. Check. I have one I use for programming, the other is 24vAC transformer. Will be making it all run off the 24vAC transformer.
Got out cheap multimeter, voltage good, 24vAC. The device can handle 60vAC or DC
Amperage, to low for cheap meter's 10a only range. Thus good.
Brought out better meter, max amperage measured on 2ma scale was 0.036 amps. Well under one amp the device can handle.
Time to open up the casing.
No LED lit on the SX protoboard.
Switch in in "0". Grumble
Moved switch to "1". Soon each zone activates in turn, though with only about 5 to 6 min on time, and shuts off.
Other than on time being off, it works great. Time to wire up the LED's and shove the programming I've done while gone to the SX.
My thinking on the BREAK is that it stops the program and I don't want to stop the program, just watch to make sure the variables are doing what I want them to do. Just poll once in a while.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Shawn Lowe
When all else fails.....procrastinate!
Dan
Edit: I don't see a POLL command in the help file Dan, am I missing it?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Shawn Lowe
When all else fails.....procrastinate!
Post Edited (Shawn Lowe) : 6/19/2008 6:35:45 PM GMT
That will update your watch variable values in the debug session.
Dan
I'm now thinking that I was seeing my watch variables in Debug, not SXsim.
SXsim, you have to hit run, then you can hit poll to see a snapshot of the state of the simulated sx, IO panel, etc.
I think I have the programming good. Problem was PG&E didn't complete their planned power outage past 9pm last night.