![]() |
Forum Index : Microcontroller and PC projects : FORMAT$ ?
Author | Message | ||||
BobC Newbie ![]() Joined: 10/06/2017 Location: United StatesPosts: 9 |
All, My first post here since getting into MM. I've seen code posted on Fruit of the Shed that uses FORMAT$. I see that in later versions of MMBasic this seems to be gone. I'm trying to format some output from an 18B20 to be "xx.xx". My current code outputs up to 4 digits right of the DP. I'd like to trim that to just 2. I'm sure there is an easy way to do it, I've just not found it yet. Not an expert Basic programmer here, still getting my feet wet with MMBasic. I'm using Rob's E28 platform sampled by Stan/Rob and a few of Mick's MuP V2's that I've built. Great hardware! I am a convert from PICAXE and Arduino to MM's. Love them. Thanks! Bob WA1EDJ Monroe, GA USA |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
Welcome to the shed. You are correct, FORMAT$ is only in the maximites (V4.5 and earlier) Have a look at the options in STR$ That will do what you require and is a bit simpler to use. You probably want STR$(x,3,2) if you allow for negative numbers. Jim VK7JH MMedit |
||||
BobC Newbie ![]() Joined: 10/06/2017 Location: United StatesPosts: 9 |
Thanks Jim, I'll give it a try....Bob |
||||
palcal![]() Guru ![]() Joined: 12/10/2011 Location: AustraliaPosts: 1993 |
If you want it to stay as a numeric variable you can use, Temp = Int(Temp*100) Temp = Temp/100 Paul. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |