Kalkulate with Float und convert in String

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

Kalkulate with Float und convert in String

#1 Post by corado » 24 Dec 2009 14:26

I want to make things like this

With Float...

BEGIN
A_tick:=(A_tick1)*(1/100)*(1/3600);
A_tick2:=A_tick2 + A_tick;
Ah:=INTEGER (A_tick2);
Ah_invert:=Ah;
END;

Then I want to convert it from Float To String with an logikal output on LCD!

User avatar
tihomir.losic
mikroElektronika team
Posts: 2138
Joined: 02 Dec 2009 14:16
Location: Serbia
Contact:

#2 Post by tihomir.losic » 25 Dec 2009 13:33

Hello,

please, create a support ticket and attach complete problematic project archived in zip or rar format and we will inspect it.
http://www.mikroe.com/en/support

Thanks.

Best regards,

Losic Tihomir
mikroElektronika [Support team]

User avatar
tihomir.losic
mikroElektronika team
Posts: 2138
Joined: 02 Dec 2009 14:16
Location: Serbia
Contact:

#3 Post by tihomir.losic » 25 Dec 2009 16:44

Then I want to convert it from Float To String with an logikal output on LCD!
Hi corado,

in mikroPascalPRO for AVR we have procedure "FloatToStr", which converts a floating point number to a string.

Parameters :
input: floating point number to be converted
output: destination string

The output string is left justified and null terminated after the last digit.
Note: Given floating point number will be truncated to 7 most significant digits before conversion.

Example:

Code: Select all

var ff1, ff2, ff3 : real;
    txt : array[23] of char;
  ...  
  ff1 := -374.2;
  ff2 := 123.456789;
  ff3 := 0.000001234;

  FloatToStr(ff1, txt);  // txt is "-374.2"
  FloatToStr(ff2, txt);  // txt is "123.4567"
  FloatToStr(ff3, txt);  // txt is "1.234e-6"
Best regards,

Losic Tihomir
mikroElektronika [Support team]

Post Reply

Return to “mikroPascal PRO for AVR Wish List”