'{$STAMP BS2} '------------------------------------------ 'tlog.bs2 ' 'This program logs temperature data. 'Press Switch 1 to begin logging - 1 beep. 'Press Reset to stop - 2 beeps. 'Press Switch 2 to send the data to the serial port - 3 beeps. 'Jumper J6 to erase the data - 4 beeps. temp var word 'Temperature beeps var byte 'Beep count i var byte 'Misc addr var word 'Address of EEPROM samples con 100 'Number of samples storage data (samples) 'Storage for the samples start: beeps=2 '2 beeps gosub beep start1: if in14=0 then log 'Start logging if in15=0 then send 'Send data if in13=0 then erase 'Erase data goto start1 log: beeps=1 '1 beep gosub beep for addr = storage to storage + samples gosub gett 'Get the temperature temp=temp*42/100 'Adjust value to 1 byte write addr,temp 'Save the value in EEPROM gosub delay 'Delay next goto start 'Done delay: for i = 1 to 10 '10 minutes pause 60000 'Delay 60 seconds next return send: beeps=3 '3 beeps gosub beep for addr = storage to storage + samples read addr, temp 'Get the data debug dec temp, CR 'Send it out next send1: if in15=0 then send1 'Make sure switch off goto start1 'Done erase: beeps=4 '4 beeps gosub beep for addr = storage to storage + samples write addr,0 next erase1: if in13=0 then erase1 'Make sure switch off goto start1 'Done beep: for i = 1 to beeps 'Beep counting loop freqout 9,100,1500 'Beep pause 50 'Delay between beeps next low 9 return 'Done '------------------------------------------ 'gett 'Reads the temperature and sets variable temp gett: high 2 'Discharge cap pause 1 'Short delay rctime 2,1,temp 'Capture temperature return 'Done