Hi all,
I wrote a little program to read NMEA HDG sentence and display the heading using SERTXD, this is the fo=irt step to create an autohelm for a boat.
It seems to read the NMEA value fine until I try to add the numbers and display the result as a word variable, using the DEBUG b0, b1, b2 are fine. the result from SERTXD is displayed as: 314 - 5642 (the compass course is 314)
Main:
serin c.0,n4800,("$HCHDG,"),b0,b1,b2,b3
pause 100
if b1="." then gosub one
if b2="." then gosub two
if b3="." then gosub three
goto main
one:
let w3=b0
sertxd (b0," - ",#w3,13,10)
return
two:
let w3=b0*10+b1
sertxd (b0,b1," - ",#w3,13,10)
return
three:
let w3=b0*100
let w3=b1*10+w3+b2
sertxd (b0,b1,b2," - ",#w3,13,10)
return
Initially I suspected the SERTXD, but the following code provides the correct 314 as an output:
main:
b0=3
b1=1
b2=4
let w3=b0*100
let w3=b1*10+w3+b2
sertxd (#w3,13,10)
goto main
Can someone help me understand what an I doing wrong with the w3 value in the first program?
Thanks
I wrote a little program to read NMEA HDG sentence and display the heading using SERTXD, this is the fo=irt step to create an autohelm for a boat.
It seems to read the NMEA value fine until I try to add the numbers and display the result as a word variable, using the DEBUG b0, b1, b2 are fine. the result from SERTXD is displayed as: 314 - 5642 (the compass course is 314)
Main:
serin c.0,n4800,("$HCHDG,"),b0,b1,b2,b3
pause 100
if b1="." then gosub one
if b2="." then gosub two
if b3="." then gosub three
goto main
one:
let w3=b0
sertxd (b0," - ",#w3,13,10)
return
two:
let w3=b0*10+b1
sertxd (b0,b1," - ",#w3,13,10)
return
three:
let w3=b0*100
let w3=b1*10+w3+b2
sertxd (b0,b1,b2," - ",#w3,13,10)
return
Initially I suspected the SERTXD, but the following code provides the correct 314 as an output:
main:
b0=3
b1=1
b2=4
let w3=b0*100
let w3=b1*10+w3+b2
sertxd (#w3,13,10)
goto main
Can someone help me understand what an I doing wrong with the w3 value in the first program?
Thanks