'Program Data Logger
main:
		setint 8, 8                                    'Set interupt to read data when button pushed
		read 48, b13                               'Get data last stored area
		if b13 > 46 then label_full           'If 6 hours are stored goto full data
label_55:
		for b0 = 1 to 15                          '15 minute counter
		for b1 = 1 to 10                          'Flashes light and records data every 6 seconds
		pause  5994                                'Make 5994 = 5 for testing  & 5994 for 6 seconds
		readadc  2, b2                           'Read light level
		if b2< 120 then                          'Check for light
			inc w4                                  'Increment the 6 second counter
			toggle 4                              'Toggle red LED
			low 1                                    'Make sure green LED is off
		else                                              'If no light
			toggle 1                              'Toggle green LED
			low 4                                    'Make sure red LED is off
		endif                                            'End of light check
		write b13, word w4                  'Store data gathered thu far
		next b1                                        'Next 6 second period
       	 next b0                                        'Next minute
		let b13=b13+ 2                          'Set next memory location                           
		write 48, b13                               'Save record number
                if b13> 46 then label_full            'If memory full quit
label_A7:   
        	w4=0                                             'Reset 6 second counter
		goto label_55                                'Start new count

label_full:
               pause 500                                     'Wait .5 seconds
               toggle 4, 1                                    'Change both LEDs
               goto label_full                                'Repeat flashing
interrupt: 
		b3 = 0                                           'Initialize counters
		w5 = 0
		do                                                  'Data loop start
			read b3, word w3               'Get data
			w5 = w5 + w3                      'Add minutes for total minutes
			w2 = w3//10                         'Get decimal part of minutes
			w3 = w3/10                           'Get whole part of minutes
			serout 0,N2400,(#w3,".",#w2,"  ")    'Send data to terminal
			b3 = b3 + 2                           'Go to next memory point
		loop while b3 < b13                    'Loop until end of data
		w2 = w5//10                                  'Get decimal of total minutes
		w3 = w5/10                                    'Get whole part of total minutes
		serout 0,N2400,(13,"Total Time = ",#w3,".",#w2," minutes",13)  'Display total
                pause 500                                       'Wait for .5 seconds
                setint  8, 8                                      'Reset interupt
                return                                             'Return to counting from point at interupt


