You can have a problem with leading zeros in the part after the decimal point, not sure if it effects PBP but it certainly effects picaxe basic.
Example
I want to display 102 as decimal with the . between 1 and 0
1.02
If you use the method suggested I expect the display will actually show
1.2 and not 1.02
It probably works correctly as long there is a number other than 0 present.
i.e.
122 would work and display 1.22
102 would not and would display 1.2 not 1.02.
Anyone care to comment.
Here is some picaxe code I use which can probably be adapted for this issue in PBP
Code:
VarC = Soc / 100 ;Get first part of value (Before decimal point)
VarA = Soc // 100 ;Get second part of value (After decimal point)
serout Video,BaudT9600,(27,83,0,5,"Soc ",#VarC,".") ;Video Display
if VarA < 10 then ;If Leading zero reqd in display due to Value <10 then
serout Video,BaudT9600,("0",#VarA," % ") ;Video Display
else
serout Video,BaudT9600,(#VarA," % ") ;Video Display
endif
Bookmarks