Pascal style LCD Out (variable:2:2)

Post your requests and ideas on the future development of mikroPascal PRO for AVR.
Post Reply
Author
Message
corado
Posts: 399
Joined: 28 Mar 2009 11:03

Pascal style LCD Out (variable:2:2)

#1 Post by corado » 26 Mar 2013 20:35

Now there are many new Versions, but and old wish isn't come true :-(
Normaly in Pascal I can write LCD_out(Variable:2:2)
and then I get a number like 2,35 or LCD_out(Variable:1:32) i get 2,234
At this moment, it is realy complicate to do this with Mikroe, i have to put all into an array and then put every number to its place :-( Thats not, why I use Pascal...
Thing like this, show that the programmers are C or C++ people but has less knowing about Pascal..
Pascal is such a nice language!

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Pascal style LCD Out (variable:2:2)

#2 Post by filip » 27 Mar 2013 12:54

Hi,

You can use FloatToStr routine for this purpose :

Code: Select all

FloatToStr(123.567,txt);
Lcd_Out(1, 3, txt);
Regards,
Filip.

corado
Posts: 399
Joined: 28 Mar 2009 11:03

Re: Pascal style LCD Out (variable:2:2)

#3 Post by corado » 27 Mar 2013 13:40

Ah, ok, thats great :-)
Thanks

corado
Posts: 399
Joined: 28 Mar 2009 11:03

Re: Pascal style LCD Out (variable:2:2)

#4 Post by corado » 27 Mar 2013 16:13

nonon, with 1,3 ein can say row 1 and so one..
I don't want say row and colum!!
I want like this si normal is Pascal...
LCDOut(1,3, Variable,:2:2) then I get in row 1 colum 3 a number like xx,xx with two number before and after the pont!
The stringconversion ist not my problem..

corado
Posts: 399
Joined: 28 Mar 2009 11:03

Re: Pascal style LCD Out (variable:2:2)

#5 Post by corado » 27 Mar 2013 17:51

If I use Float2Str I get
2 / 3 = 0,6666666
But on display I need 0,66 That mean LCD_out(variable:1:2) or I need on display 0,666 that mean ( LCD_out(variable:1:3) this is the way I like from PAscal

See here
http://www.ousob.com/ng/pascal/nge0b2.php

NUMERIC DATA:

# digit: # indicates a digit position. If the field specifier contains no
@ or * characters then unused digits are returned as blanks. If
the specifier is without a sign position (+-) a floating minus sign
will be returned in front of a negative number.
A number greater than the field specifier will be returned as all *.

Example: Form ('####',34.567) = ' 35'
Form ('###.##',12.345) = ' 12.35'
Form ('####.##',-12.3) = ' -12.30'
Form ('###.##,1234,56) = '***.**' { overflow }

Real1 := 1234567.890123456
Real2 := 1.1
StrVar := Form ('############.##',RealVar); { ' 1234567.89' }
WriteLn (Real1:7:2); { '1234567.89' }
WriteLn (Real2:7:2); { ' 1.10' }


@ digit: @ indicates a digit position. If the field specifier contains
one or more of these, then all blanks are returned as leading zeros.
The sign will not be returned unless the + symbol is present.

Example: Form ('@###',34.567) = '0035'
Form ('###.#@',12.345) = '012.35'

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Pascal style LCD Out (variable:2:2)

#6 Post by filip » 28 Mar 2013 09:59

Hi,

I understand what are you trying to achieve.
You can, for example, terminate a constant with a zero after a number of digits, like this :

Code: Select all

FloatToStr(123.567,txt);
txt [7] = 0;
This will write 123.56 on the screen.

Regards,
Filip.

corado
Posts: 399
Joined: 28 Mar 2009 11:03

Re: Pascal style LCD Out (variable:2:2)

#7 Post by corado » 28 Mar 2013 10:11

ah, ok, but then the number is wron..because it have to be 123.57 because it have to be round up...

Post Reply

Return to “mikroPascal PRO for AVR Wish List”