~output stop XX1XXXXX ~output pump X1XXXXXX ~output system off XXX1XXXX ~ ~ ~input 1 start 0= start ~input 2 stop 0= stop ~ ~feed cuttoffs V30-35 ~current preset pointer V20 ~current preact V21 ~start pump delay value V22 ~start delay w1 ~wait for product delay value V23 ~start delay w2 ~start out weight V24 ~case variable V10 ~input variable V1 ~working status variable V7 ~zero interlock V70 ~interlock time out V71 ~working variable V11 ~minus 1 V12 ~zero tolerance V15 ~display preset variable V17 ~check motion flag V18 ~paused flag V19 ~junk V50 ~ D51.Z1E ~zero scale one ~ ~ D52. (V7=S1&256) ~assign zero in process status to variable 7 iV7=256{} ~if zero in process (do nothing) e{x80.}E ~ ~ D49.T1E ~Tare scale one ~ ~ D50. (V7=S1&512) ~assign tare in process status to variable 7 iV7=512{} ~if tare in process (do nothing) e{x80.}E D53.(V6=S1&2)iV6=2{x80.}E ~if stable true increment state ~ ~ D70. P0@" "@ ~blank big display P1@" "@ P1@"ENTER PRESET 1"@V30=k1.8 ~get presets P1@" "@ P1@"ENTER PRESET 2"@V31=k1.8 P1@" "@ P1@"ENTER PRESET 3"@V32=k1.8 P1@" "@ P1@"ENTER PRESET 4"@V33=k1.8 P1@" "@ P1@"ENTER PRESET 5"@V34=k1.8 P1@" "@ P0@"\0"@P1@" "@ ~release big display E ~ ~ D71. P0@" "@ ~blank big display P1@" "@ (V23=V23/10) (V22=V22/10) P1@"PUMP ON DELAY (SECONDS)"@V22=k1.8 ~pump on time in 0.1 sec. P1@" "@ P1@"PRODUCT TIMEOUT (SECONDS)"@V23=k1.8 ~get time out abort time ~ (V23=V23*10) ~adjiust for 0.1 second intervals (V22=V22*10) P1@" "@ P0@"\0"@P1@" "@ ~release big display E ~ ~ D80. (V10++) ~inc. state counter E ~ ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~First start init. D10. V10=0 V1=0 m1=2 ~set scale motion limit to 1d (1/4 * 4) O00010000 ~status on V15=10 ~zero tolerance V12=0 (V12=V12-1) ~create a -1 variable V20=30 ~int. for first preset V18=0 V19=0 ~ ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Start loop D12. P1@"*0=PRESETS *1=TIMERS *2=RESET"@ ~prompt user for action ~ ~ iI2=1 ~stop off { iI1=0 ~if start input 0 and stop=1 start fill { G15. } } e { O00010000 ~STOP V10=0 V1=0 iV18>0 { V19=1 } V18=0 (V17=V20-29) iV17=6 { P2@"CLEAN STOPPED"@ } e { P2@"PRESET "V17.0.1" STOPPED"@ } V50=K G12. } ~ ~ V1=K ~read keypad to variable 1 CV1 ~go to case assigned by variable 1 (1 (key 1) or 2 (key 2) [ c0.x70. ~case 0 get feed b c1.x71. ~case edit timers b c2. P0@" "@ ~blank big display P1@" "@ V1=0 P1@"****** ENTER 1 TO RESET ******"@ P0@"\0"@ V1=k0.2 iV1=1 { V20=30 V19=0 V18=0 P2@"PRESET 1 READY"@ OXX0XXXX } iV1=99 { U7 } b c3. V35=10000 V20=35 ~empty hopper weight for cleaning P2@"CLEAN READY"@ ~make it big so only no product flow stops it b ] G12. ~Go to label definition 12 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ End Start loop ~ ~ D15. ~label 15 ... main fill loop iI2=0 ~stop ? { O00010000 ~STOP V10=0 V1=0 iV18>0 { V19=1 } V18=0 (V17=V20-29) iV17=6 { P2@"CLEAN STOPPED"@ } e { P2@"PRESET "V17.0.1" STOPPED"@ } V50=K G12. } V11=W1.0 iV11 < 0 { (V11=V11 * V12) ~abs V11 } iV17=6 { } e { iV240 { iw2=0 { O00110000 ~NO FLOW STOP V10=0 V1=0 V19=1 V18=0 P2@"PRESET "V17.0.1" STOPPED"@ V50=K G12. } } } } CV10[ ~case variable 10 ... state machine c0. ~*0 iV19=0 { ~if not paused t1=0L7 ~Assign 0 to tare. Lock all contol keys O00010000 ~outputs off status on P1@" "@ P2@"TARING"@ x80. } e { V10=4 V19=0 } b c1. ~*1 x49. ~tare scale x80. b c2. ~*2 x50. ~wait for tare w3=20 ~zero stable delay b c3. ~*3 iw3=0{ ~stable delay satisfied? ~yes check for zero iV11 = 0{ x80. ~if zero go else tare again } e{ iV11V11{} ~ wait for feed cutoff e {OX00XXXXX V10 = 8 ~off feed and pump } b c7. ~*7 x80. b c8. ~*8 iVV20>V11{} ~ wait for final cutoff e {OX00XXXXX ~off final and pump x80. } b c9. ~*9 O00010000 ~make sure all off but status and go wait for a start V10=0 V1=0 (V20++) iV20>34 { iV20>35 { P2@"CLEAN READY"@ V20=35 } e { V20=30 P2@"READY PRESET 1"@ } } e { (V17=V20-29) P2@"PRESET "V17.0.1" READY"@ } V18=0 V50=K d20 G12. b c99. ~end state ... all stop and release keys O00010000 V10=0 V1=0 P1@"*Fill Aborted"@ d20 G12. E b ] G15. ~go to top of fill loop