70 likes | 178 Views
OVERALL PROCESS. LSTATUS = LED’s on (1) or off (0) STAGECNT = set how long light setting at each brightness level ON = length of time on OFF = length of time off COUNTLT= counter for light on or off ALARMFLAG = alarm going off BRT = brightness of light TWLGT= 1 for sunrise, 0 for sunset
E N D
OVERALL PROCESS LSTATUS = LED’s on (1) or off (0) STAGECNT = set how long light setting at each brightness level ON = length of time on OFF = length of time off COUNTLT= counter for light on or off ALARMFLAG = alarm going off BRT = brightness of light TWLGT= 1 for sunrise, 0 for sunset RAMPBUTN = ramp button was on RMPTIME = ramp length (minutes) RMPDIS = length of time ramp display is on FRSTPRES = flag to denote when ramp button pushed first time RMPCNT = length of time ramp button is pushed COUNTL = length of time light on button must be pressed before doing anything LDELAY = delay to slow rapid increase in light when switch pressed COUNTER1 = first stage counter in keeping time COUNTER2 = second, higher order counter for time MIN = minutes AMIN = alarm minute setting HOUR= hours AHOUR = alarm hour setting AMPM= am pm flag AAMPM = alarm am/pm setting PULSE = pulse state SCHMIDT = signal from schmidt trigger THOLD = delay timer for time setting TDELAY = delay timer for time setting (second timer) Set Initial Parameters: MIN=0 HOUR=6 AMPM=1 AMIN=0 AHOUR=12 AAMPM=0 PULSE=O COUNTER1=0 COUNTER2=0 ALARMFLAG=0 BRT=0 LEDSTATUS=0 TWLGT=0 ON=0 OFF=255 Display update process Alarm control, light ramp Brightness control Keep Time Process Set Time Alarm set process Set Alarm Alarm set process Set Ramp + sunset Ramp set process Light switch Dimmer process
SET TIME Power Up Set time 6 PM Set Alarm 12 am Alarm off pulse off Alarm flag off Hour Set Button Min Set Button Time set button pushed Time Set Input Hour set button pushed Yes Min set button pushed Yes Set time 6 PM THOLD= THOLD-1 THOLD=3 TDELAY=1 THOLD=3 TDELAY=1 Min set button pushed THOLD=200 Yes THOLD= THOLD-1 Yes TDELAY= TDELAY-1 THOLD=200 TDELAY=0 Yes TDELAY= TDELAY-1 Yes TDELAY=10 HOUR= HOUR+1 TDELAY=0 HOUR=12 AMPM=1 Yes TDELAY=10 MIN=MIN+1 Yes HOUR=13 AMPM=1 MIN=60 Yes Yes HOUR=1 AMPM=0 MIN=0
SETALARM TIME Hour Set Button Min Set Button Alarm set pushed Time Set Input Hour set button pushed Yes Min set button pushed Yes Set alarm 12 AM THOLD= THOLD-1 THOLD=3 TDELAY=1 THOLD=3 TDELAY=1 Min set button pushed THOLD=200 Yes THOLD= THOLD-1 Yes TDELAY= TDELAY-1 THOLD=200 TDELAY=0 Yes TDELAY= TDELAY-1 Yes TDELAY=10 AHOUR= AHOUR+1 TDELAY=0 AHOUR=12 AAMPM=1 Yes TDELAY=10 AMIN=AMIN+1 Yes AHOUR=13 AAMPM=1 AMIN=60 Yes Yes AHOUR=1 AAMPM=0 AMIN=0
KEEPING TIME COUNTER1 = first stage counter in keeping time COUNTER2 = second, higher order counter for time MIN = minutes AMIN = alarm minute setting HOUR= hours AHOUR = alarm hour setting AMPM= am pm flag AAMPM = alarm am/pm setting PULSE = pulse state SCHMIDT = signal from schmidt trigger THOLD = delay timer for time setting TDELAY = delay timer for time setting (second timer) No SCHMIDT=1 PULSE=1 PULSE=1 60 Hz Pulse PULSE=0 COUNTER2 =150 COUNTER2 =0 increment MINUTE COUNTER1 =200 COUNTER1 =0 Increment COUNTER1 MIN=60 MIN=0 inrement HOUR yes Toggle AMPM HOUR=12 No HOUR=13 HOUR=1 No Time equal Alarm time ALARMFLAG=1 BRT=1 STAGECNT=X LSTATUS=1 TWLGT=1
CONTROL BRIGHTNESS ALARMFLAG =1 Decrement STAGE- CNT STAGECNT = 0? No TWLGT=1? STAGECNT= X/2 Increase BRT ON=BRT OFF=255-BRT Set STAGECNT decrease BRT ON=BRT OFF=255-BRT Set STAGECNT BRT=0 BRT=255 No ALARMFLAG =0 TWLGT=0 No ALARMFLAG =0 LSTATUS=1 BRT > 100 STAGECNT =X STROBE=1 STAGECNT =X/2 No Decrement COUNTLT STROBEON=1 NEED STROBE!!! COUNTLT=0? LSTATUS=1? LSTATUS=0 COUNTLT= OFF No LSTATUS=1 COUNTLT= ON
CONTROL RAMP LENGTH AND SUNSET Yes Ramp button pushed RMPDIS=250 Ramp Input BUTTON HELD ON BUTTON RELEASED RAMPBUTN=1 BUTTON JUST TURNED ON No Yes RAMPDIS=0 RAMPBUTN=1 FRSTPRES=0 Don’t display RMPTIME NOT FIRST TIME BUTTON PRESSED RMPCNT<250 FRSTPRES=1 RMPCNT= RMPCNT+1 MEASURES HOW LONG BUTTON PUSHED yes No Rotate RMPTIME Display RMPTIME RMPDIS= RMPDIS-1 FRSTPRES=1 RMPCNT=1 RMPCNT<250 yes RMPCNT=250 TWLGT=0 ALARMFLAG=1 Display “SUNS” TURN ON SUNSET AFTER BUTTON HELD FOR A WHILE
LIGHT SWITCH AND DIMMER FUNCTIONS Light switch pressed COUNTL= COUNTL+1 COUNTL=5 Light Switch Yes COUNTL=0 LDELAY=0 LIGHTON=1 LIGHTON=1 Yes LIGHTON=0 LIGHT SWITCH OPERATION Variables: LIGHTON = 1 (on), 0 (off) LIGHTSW = light switch held on (1), off (0) LDELAY = delay to slow light getting brighter LIGHTON=0 Yes LDELAY<3 LDELAY= LDELAY+1 Yes LDELAY=0 ON=ON+1 OFF=OFF-1 xxx