Symbol NUM = b2 'variable holding MUX switch A/D reading Symbol OPT = b3 'variable to hold the MUX switch OPT (option) value Symbol M = b4 'variable to hold the minutes count Symbol S = b5 'variable to hold the seconds count Symbol T = b6 'variable to hold loop counter in the timing loop Symbol AD = w4 'WORD variable holding A/D reading on MUX line ;222222222222222222222222222222222222222222222222222222222222222222222222 ;2 2 ;2 MULTI FUNCTION TIMER with 5 USER DEFINED PRESETS 2 ;2 2 ;222222222222222222222222222222222222222222222222222222222222222222222222 ;Exposure or general purpose timer ; This program uses the MUX switches to set custom user supplied times ; and controls an A/C device connected to the optocoupler #1 ; The pushbutton switch starts the timer and the piezo announces the ; end of the cycle TIMEIT: NUM=0 BUTN: Button 4,0,255,255,NUM,1,DOIT Goto Butn DOIT: Sound 1,(122,10,0,5,122,10) High 0 ;turn on the exposure lamp etc. Gosub MUX ;read the MUX switches Lookup OPT,(1,1,2,5,10),M 'lookup minutes values Lookup OPT,(0,45,0,0,0),S 'lookup seconds settings ; POSITION TIME USE ; 0 1 MIN 0 SEC GENERAL 1 MINUTE TIMER ; 1 1 MIN 45 SEC EXPOSURE TIME ON MY PCB EXPOSURE LITE FRAME ; 2 2 MIN 0 SEC DEVEOPER BATH TIME ; 3 5 MIN 0 SEC ETCHANT TANK TIMER?? ; 4 10 MIN 0 SEC ID TIMER High 0 'turn on OPTO1 (exposure lamp or ext. indicator) MINS: If M=0 then SECS 'any minutes in the time period? For T = 1 to M 'loop for the number of minutes desired Pause 60000 'pause 60,000 milliseconds Next SECS: If S=0 then OVER 'if no seconds needed then Interval is DONE! For T = 1 to S 'loop for the number of seconds desired Pause 1000 'pause 1,000 milliseconds Next OVER: Low 0 'turn OFF the device connected to Opto1 Sound 1,(70,50,0,50,70,50) 'make a turn off sound Goto TIMEIT ; ;MUX SWITCH INPUT ; This subroutine reads an analog voltage on logical pin 2. ; The 4 MUX DIP switches are used to create an analog voltage ; based on which switch is closed. Each switch controls a weighted ; resistor to create 4 unique voltage readings for the 4 switches. ; The max reading is 255 (8 bits) so dividing the reading by 52 ; will produce a whole number between 0 and 4 based on which switch ; is closed... MUX: ReadADC 2,AD 'read the MUXed switch voltage (8 bits) OPT = AD/52 'normalize it to 5 readings Return 'we are done!