PDA

View Full Version : String Manipulation



Darrenmac
- 7th April 2008, 22:29
Hi all,
Just wondering if there is a way to manipulate string values for display? For example I am working on an A/D project and to overcome floating point issues I have calculated values based on the decimal point being 3 digits to the right making it an interger. What I am looking for is displaying the value in 2 parts. ! figure left of the decimal point followed by the point and then the figure right of the point. In VB I could use left$ or right $. is there any way to do this in PBP?


Thanks

mackrackit
- 7th April 2008, 22:49
You can do some math in the LCDOUT command and or use a number after the DEC like in the SEROUT2 command.


LCDOUT $FE,$C0,DEC numVar /100,".",DEC2 numVar //100

mister_e
- 7th April 2008, 22:54
There's also DIG in the list.

Darrenmac
- 8th April 2008, 02:02
Thanks Mackrackit,
Can you explain what you have suggested a little better so I can understand.

thanks
Darren

mackrackit
- 8th April 2008, 02:44
Thanks Mackrackit,
Can you explain what you have suggested a little better so I can understand.

thanks
DarrenI can try, but that cold med I took is having fun with with me :)

LCDOUT $FE,$C0,
display line two.

DEC numVar /100
displays the value of numVar

"."
makes a "."

DEC2 numVar //100
displays only two digits of the remainder of numVar divided by 100

The math section and SEROUT2 section of the manual will explain it better I am afraid.

Darrenmac
- 8th April 2008, 02:56
thanks
I will give it a go.

Darrenmac
- 8th April 2008, 11:22
can you explain the difference between dec and dec2?

mister_e
- 8th April 2008, 14:39
DEC will show the whole decimal number , while DEC2 will show only the 2 less significant one.

MyVar=1234

DEC MyVar =>1234
DEC2 Myvar => 34
DEC3 MyVar => 234
etc