If we assume you have a value between 0 and 3000 in your WORD variable (representing 0-30.00 volts), you can use DIG (see PBP manual) to outout and format your data. Here's a couple of examples...
Example 1 (Data Formatted from "Volts=0.00 " to "Volts=30.00 ")
in the above example, we don't print the leading figure if the voltage is less than 10.00. To prevent the LCD 'blinking' when the voltage is updated, we don't clear the display, but overwrite the previous content. You need a trailing Blank to remove the least significant figure from the previous display if your voltage drops below 10.00. As you will know, $FE,$80 just positions the cursor at the start of Line 1, Column 1.Code:LCDOut $FE,$80,"Volts=" If MyWord>999 then LCDOut #MyWord DIG 3 LCDOut #MyWord DIG 2,".",#MyWord DIG 1,#MyWord DIG 0," "
Example 2 (Data is Fixed in the same spot Formatted " 0.00v" to "10.00v" with leading zero surpession - note here the leading figure is this time replaced by a blank)
Code simple enough?Code:LCDOut $FE,$80 If MyWord<1000 then LCDOut " " else LCDOut #MyWord DIG 3 endif LCDOut #MyWord DIG 2,".",#MyWord DIG 1,#MyWord DIG 0,"v"




Bookmarks