'Program Battery Tester 
main:						  
	let w6 = 80			  'Starting point for variable w6
calibrate:
	readadc10 2, w5		'Read the reference diode
	w2=w5*60/w6		     'Calculate reference voltage
	if w2 = 76 then VM  	     'If wrong goto next step, otherwise measure input
	inc w6				    'Increase the reference variable by 1
	goto calibrate		        'Try again
VM:
	readadc10 1, w1 		'Read the input voltage
	w2=w1*60/w6	  	    'Calculate for decimal readout

	w3=w2/100	  		 'Get the digit before the decimal point
	w4=w2//100  			'Get the decimal portion of the voltage
	serout 0, N2400, (#w3,".",#w4, " Volts",13,10)   'Display reading
nopush:
	if pin3=1 then yespush	 'Wait for next press of pushbutton

	goto nopush
yespush:
	if pin3=0 then VM	  	'When button is released do again
	goto yespush


