Hi can anyone see why this code will not run it’s an experiment from David Lincolns
Book programming and customizing the picaxe Microcontroller any help will be appreciated
'picaxe-18x quad temperaturelogger
'options picaxe-18x 4 mhz 16x gosubs
symbol lcdlatch = 2
symbol lcddata = 1
symbol lcdinst = 0
symbol setcursor = 8
symbol lcdon = 4
symbol cursoron = 2
symbol blink = 1
symbol cleardisplay = 1
symbol lcdline1 = $80
symbol lcdline2 = $c0
symbol outbyte = b0
symbol nblcount = b1
symbol rs = b2
symbol counter = b3
symbol reading = b3
symbol tempsign = b4
symbol temp100 = b5
symbol temp10 = b6
symbol temp1 = b7
symbol temp0 = b8
symbol temp00 = b9
symbol wwork = w5
symbol wworkhi = b11
symbol wworklo = b10
symbol temperature = w6
symbol positivesign = "+"
symbol negativesign = "-"
symbol decimalchar = "."
symbol separatorchar = ","
rs = lcdinst
for counter = 0 to 5
lookup counter, ($33, $32, $28, $0c, cleardisplay, $06), outbyte
gosub lcdout
next counter
loop:
debug w0
reading = $31
readtemp12 2, temperature
gosub prosesstemp
reading = $32
readtemp12 1, temperature
gosub prosesstemp
reading = $33
readtemp12 0, temperature
gosub prosesstemp
pause 500
reading = $34
readtemp12 7, temperature
gosub prosesstemp
pause 500
goto loop
prosesstemp:
tempsign = positivesign
w0 = temperature
if bit11 = 0 then postemp
tempsign = negativesign
temperature = 4096 - temperature
postemp:
wwork = temperature & $000f
wwork = wwork * 625
wwork = wwork + 55 / 100
temp00 = wworklo // 10 + $30
if temp00 <> $30 then ptt0
temp00 = " "
ptt0:
temp0 = wworklo / 10 + $30
wwork = temperature / 16
temp1 = wwork // 10 + $30
wwork = wwork / 10
temp10 = wwork // 10 + $30
temp100 = wwork / 10 + $30
if temp10 <> $30 or temp100 <> $30 then ptt10
temp10 = " "
ptt10:
if temp100 <> $30 then ptt100
temp100 = " "
PTT100:
IF READING = "4" THEN DISPLAY4
IF READING = "3" THEN DISPLAY3
IF READING = "2" THEN DISPLAY2
OUTBYTE = lcdline1
goto movecursor
display2:
outbyte = lcdline1 + 9
goto movecursor
display3:
outbyte = lcdline2
goto movecursor
display4:
outbyte = lcdline2 + 9
movecursor:
rs = lcdinst
gosub lcdout
sertxd (reading)
b0 = separatorchar
if b0 = 0 then dtnosep
sertxd (separatorchar)
dtnosep:
rs = lcddata
outbyte = tempsign
gosub lcdout
sertxd (tempsign)
outbyte = temp100
gosub lcdout
sertxd ( temp100)
outbyte = temp10
gosub lcdout
sertxd (temp10)
outbyte = temp1
gosub lcdout
sertxd (temp1)
outbyte = decimalchar
gosub lcdout
sertxd (decimalchar)
outbyte = temp0
gosub lcdout
sertxd (temp0)
outbyte = temp00
gosub lcdout
sertxd (temp00)
b0 = separatorchar
if b0 = 0 then dtnosep1
sertxd (separatorchar)
dtnosep1:
return
lcdout:
for nblcount = 1 to 2
if bit4 = 0 then nob4
pins = outbyte & $E0 | 8 | 4 | rs
goto latchout
nob4:
pins = outbyte & $E0 | 4 | rs
latchout:
low lcdlatch
pause 500
outbyte = outbyte * 16
next nblcount
return
Book programming and customizing the picaxe Microcontroller any help will be appreciated
'picaxe-18x quad temperaturelogger
'options picaxe-18x 4 mhz 16x gosubs
symbol lcdlatch = 2
symbol lcddata = 1
symbol lcdinst = 0
symbol setcursor = 8
symbol lcdon = 4
symbol cursoron = 2
symbol blink = 1
symbol cleardisplay = 1
symbol lcdline1 = $80
symbol lcdline2 = $c0
symbol outbyte = b0
symbol nblcount = b1
symbol rs = b2
symbol counter = b3
symbol reading = b3
symbol tempsign = b4
symbol temp100 = b5
symbol temp10 = b6
symbol temp1 = b7
symbol temp0 = b8
symbol temp00 = b9
symbol wwork = w5
symbol wworkhi = b11
symbol wworklo = b10
symbol temperature = w6
symbol positivesign = "+"
symbol negativesign = "-"
symbol decimalchar = "."
symbol separatorchar = ","
rs = lcdinst
for counter = 0 to 5
lookup counter, ($33, $32, $28, $0c, cleardisplay, $06), outbyte
gosub lcdout
next counter
loop:
debug w0
reading = $31
readtemp12 2, temperature
gosub prosesstemp
reading = $32
readtemp12 1, temperature
gosub prosesstemp
reading = $33
readtemp12 0, temperature
gosub prosesstemp
pause 500
reading = $34
readtemp12 7, temperature
gosub prosesstemp
pause 500
goto loop
prosesstemp:
tempsign = positivesign
w0 = temperature
if bit11 = 0 then postemp
tempsign = negativesign
temperature = 4096 - temperature
postemp:
wwork = temperature & $000f
wwork = wwork * 625
wwork = wwork + 55 / 100
temp00 = wworklo // 10 + $30
if temp00 <> $30 then ptt0
temp00 = " "
ptt0:
temp0 = wworklo / 10 + $30
wwork = temperature / 16
temp1 = wwork // 10 + $30
wwork = wwork / 10
temp10 = wwork // 10 + $30
temp100 = wwork / 10 + $30
if temp10 <> $30 or temp100 <> $30 then ptt10
temp10 = " "
ptt10:
if temp100 <> $30 then ptt100
temp100 = " "
PTT100:
IF READING = "4" THEN DISPLAY4
IF READING = "3" THEN DISPLAY3
IF READING = "2" THEN DISPLAY2
OUTBYTE = lcdline1
goto movecursor
display2:
outbyte = lcdline1 + 9
goto movecursor
display3:
outbyte = lcdline2
goto movecursor
display4:
outbyte = lcdline2 + 9
movecursor:
rs = lcdinst
gosub lcdout
sertxd (reading)
b0 = separatorchar
if b0 = 0 then dtnosep
sertxd (separatorchar)
dtnosep:
rs = lcddata
outbyte = tempsign
gosub lcdout
sertxd (tempsign)
outbyte = temp100
gosub lcdout
sertxd ( temp100)
outbyte = temp10
gosub lcdout
sertxd (temp10)
outbyte = temp1
gosub lcdout
sertxd (temp1)
outbyte = decimalchar
gosub lcdout
sertxd (decimalchar)
outbyte = temp0
gosub lcdout
sertxd (temp0)
outbyte = temp00
gosub lcdout
sertxd (temp00)
b0 = separatorchar
if b0 = 0 then dtnosep1
sertxd (separatorchar)
dtnosep1:
return
lcdout:
for nblcount = 1 to 2
if bit4 = 0 then nob4
pins = outbyte & $E0 | 8 | 4 | rs
goto latchout
nob4:
pins = outbyte & $E0 | 4 | rs
latchout:
low lcdlatch
pause 500
outbyte = outbyte * 16
next nblcount
return