PIC or PICAXE Temperature Data Logger tool (in work)
This is my second logger program and is still under development. It still needs serial program to collect and analyse the temp data in the PC (and take any action needed). Still, it does work, in a crude way and could be used as basis for more elegant work. I am planing to continue this effort. I have just recieved a working Visual Basic program that apears to meet my needs to modify for use here. Stay tuned.
#com1
#picaxe 18M2
;TempLoger2.bas program to collect temperatures
; 4 Analog to Digital Converters (ADC) on pins B.1 to B.4
; use debug for output, need 5.12 volt supply for accuracy
symbol DELAY = b0 ;set aside a general delay var
symbol i = b1 ;set aside a general counter var
symbol addr = b2
symbol dat = b3
symbol RAM = b4 ;begining EERAM location
symbol temp = b5
symbol HalfDay = w3 ;time counts 12hrs so count her
; w3 is a 2 byte word using b5 + b7
symbol indx = b8 ;temperary index, curent RAM address
symbol temp2 = b9
; b10-b13 read in and out vars
; b14-b16 used for conversion to ascii
symbol LED = C.6 ;let an LED be here
symbol SW1 = pin4 ;Switch 1 for user interaction
init:
let Delay = 50 ;50 milloseconds
let RAM = 0 ;start loc in RAM if not always 0
let Halfday = 43200;count of sec in 12 hr
high LED ;blink LED half a sec
pause 500
low LED
; read out using button detect and debug (on reset only)
if SW1 = 1 then ;=Vcc, (button pressed)
goto plybk ; so go to debug and output data
else endif ;else start collecting the data.
let indx = RAM ;where in RAM curent pointer
main:
readadc b.1,b10 ;get 4 valuse of temp into vars
readadc b.2,b11
readadc b.3,b12
readadc b.4,b13
write indx,b10,b11,b12,b13
indx = indx + 4
write 255,indx
if indx > 255 then: stop: endif
if time => HalfDay then: time = 0: endif
goto main
plybk:
read 255,indx
if indx = 255 then: inc indx: endif
for i = 0 to indx ;NEXT at line 60
read i,b10 ;read addr at i and put in variable bx...
; to make a byte display as ASCII degree C # ...
; byte - 50 = deg C, IE byte = 50 = zero C
if b10 > 50 then: gosub pos ;positive deg C. take b10 & return w/3 #
else : gosub negi ;less than zero deg C (negitive).ret 3 #
endif
; Need to send to Serial temperatures(3 digits ea w/ comma) + CRLF
serout 1,N2400,(b14,b15,b16,44) ;send temp to ser realpin 17
next i
end
pos: b10 = b10 - 50
bintoascii b10,b14,b15,b16
return
negi:
bintoascii b10,b14,b15,b16
b14 = "-"
return
end
;Notes:
;0. Not done- Time between samples ***
;1. Need to examine FVR for ADC voltage reference
;2. Look at using EEPROM to increase data density
;3. With more data storage, increase dat pin count
;4 Also increase data sampling rate
;
#com1
#picaxe 18M2
;TempLoger2.bas program to collect temperatures
; 4 Analog to Digital Converters (ADC) on pins B.1 to B.4
; use debug for output, need 5.12 volt supply for accuracy
symbol DELAY = b0 ;set aside a general delay var
symbol i = b1 ;set aside a general counter var
symbol addr = b2
symbol dat = b3
symbol RAM = b4 ;begining EERAM location
symbol temp = b5
symbol HalfDay = w3 ;time counts 12hrs so count her
; w3 is a 2 byte word using b5 + b7
symbol indx = b8 ;temperary index, curent RAM address
symbol temp2 = b9
; b10-b13 read in and out vars
; b14-b16 used for conversion to ascii
symbol LED = C.6 ;let an LED be here
symbol SW1 = pin4 ;Switch 1 for user interaction
init:
let Delay = 50 ;50 milloseconds
let RAM = 0 ;start loc in RAM if not always 0
let Halfday = 43200;count of sec in 12 hr
high LED ;blink LED half a sec
pause 500
low LED
; read out using button detect and debug (on reset only)
if SW1 = 1 then ;=Vcc, (button pressed)
goto plybk ; so go to debug and output data
else endif ;else start collecting the data.
let indx = RAM ;where in RAM curent pointer
main:
readadc b.1,b10 ;get 4 valuse of temp into vars
readadc b.2,b11
readadc b.3,b12
readadc b.4,b13
write indx,b10,b11,b12,b13
indx = indx + 4
write 255,indx
if indx > 255 then: stop: endif
if time => HalfDay then: time = 0: endif
goto main
plybk:
read 255,indx
if indx = 255 then: inc indx: endif
for i = 0 to indx ;NEXT at line 60
read i,b10 ;read addr at i and put in variable bx...
; to make a byte display as ASCII degree C # ...
; byte - 50 = deg C, IE byte = 50 = zero C
if b10 > 50 then: gosub pos ;positive deg C. take b10 & return w/3 #
else : gosub negi ;less than zero deg C (negitive).ret 3 #
endif
; Need to send to Serial temperatures(3 digits ea w/ comma) + CRLF
serout 1,N2400,(b14,b15,b16,44) ;send temp to ser realpin 17
next i
end
pos: b10 = b10 - 50
bintoascii b10,b14,b15,b16
return
negi:
bintoascii b10,b14,b15,b16
b14 = "-"
return
end
;Notes:
;0. Not done- Time between samples ***
;1. Need to examine FVR for ADC voltage reference
;2. Look at using EEPROM to increase data density
;3. With more data storage, increase dat pin count
;4 Also increase data sampling rate
;