'DATA08M.BAS = NTC temp.datalogger-Picaxe-08M version Ver 1.0 30/08/04 Stan. SWAN 'Program a "hi res" enhancement of lo res datalog8.bas shown Sept.'03 SiChip article 'NB-this further enhances orig.08 version with 08M "SERTXD" cmd feeding serial data 'out via normal 3 wire progr.lead @ 4800bps & displays via editor F8 inbuilt terminal '=================================================================================== 'When "08M" powered up,any prior stored EEPROM values sent SERTXD pin 0 serial data '-also suit 4800bps display via any term. program -LCD,F8,StampPlot- or.csv Excel too. 'NB-Gives you 30secs to turn unit OFF before fresh storage begins & thus progressively 'wiping existing values ! For security however this data can't easily be bulk erased '***BUT CARE - BE PROMPT ! REPROGRAMMING/RELOADING "08M" TOTALLY WIPES DATA TOO ****. 'As set up logs NTC temp every 60 secs for ~2 hrs.Alter WAIT value (or SLEEP)to suit? '------------------------------------------------------------------------------------- 'PICAXE08M has hi-res data values 0-255(via "readadc" command),but also READTEMP for 'direct DS18B20 Celsius readings! Both 08 & 08M values stored in program space. Care ! 'If power saving needed use SLEEP instead of WAIT ex. 26x2.3secs ~1min delay (+/- 1% ) 'Alter to suit.Ex. Sleep 391 =128 x 1/4 hr =32 hrs.Some interpreter o'head/drift noted '128 readings,so @ 1/min ~2 hrs, /5 min ~10 hrs, /30 min ~2.5 days,& /60 min ~5 days 'NB- sensor thermal lag means there's little point sampling faster than every minute ! 'Solderless "PICNIK" mini breadboard setup pix => www.picaxe.orcon.net.nz/pcxs08m.jpg 'Program hosted=> www.picaxe.orcon.net.nz/data08m.bas. ASCII art schematic below '------------------------------------------------------------------------------------- ' SERTXD Typical temp. readings/readadc values ' & piezo - - - - - -ve rail 0 Celsius 11 ' Ch.0 _____ Ch. | | 4 21 ' - | ___ | 2 LED 47k 8 32 ' ------ | |_______| | 12 43 ' |Picaxe| |_______________| 16 53 ' | 08M | Ch.1 ADC | 20 64 ' ------ 100k 24 75 ' + NTC 28 86 etc '||| 3-5 V 'Usual 3 wire + + + + + + +ve supply NOTE - Temp values approximate 'prog.input & may need calibration your NTC '--------------------------------------------------------------------------------------- 'READ/PLAYBACK ROUTINE pause 100 'needed to wake up sertxd & avoid initial junk? sertxd(" PICAXE-08M NTC Temp.Datalogger ") ' Title header for b0=0 to 127 'stored data values readout to terminal or LCD read b0,b1 'polls & reads out stored EEPROM values ( .csv) sertxd (#b0,44,#b1," ") 'Values @ prog.pin,+ ASCII comma(44) for Excel .csv high 2 'LED at output 2 on to confirm data readout next b0 'read next stored EEPROM value as SERTXD serial out wait 30 '30 secs "reading" delay -modify if too short etc low 2 'LED off shows reading over, & new data run starting '---------------------------------------------------------------------------------------- 'WRITE/DATA LOGGING ROUTINE for b0= 0 to 127 'begin 128 data readings @ time set by SLEEP/WAIT sound 0,(75,10) 'Beep to alert data logging commencing pulsout 2,500 'brief flash from pin 2 LED indicates datalogging readadc 1,b1 'Hi Res (8 bit) read NTC at Pin 1 Voltage divider sertxd (" ") 'gap as usual 10=CR,12=FF(=cls),13=LF nogo with F8? sertxd(#b0,44,#b1) 'Now allows data display (via F8 ?) as gathered too! write b0,b1 'sequentially write values to 08M EEPROM locations wait 60 'Checks every 60 secs -alter to suit or use SLEEP etc next b0 'Gathering automatically stops after 128 samples high 4 'Ch.4 green LED on to show data run ended (optional) '----------------------------------------------------------------------------------------