Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to write float to string function using mikroC?

Status
Not open for further replies.

youstron

Newbie level 6
Joined
Mar 5, 2012
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,372
when i'm displaying float result on lcd, when the number is less than one ,lcd showing result interms of 'e' .. can any one know how to display 0.(zero point something) values.Can any one says the logic to write the own float to string function using mikroC .. hoping for the best answer
 

Re: floattostr() problem

i heard that it takes more than 40% of the memory if we use sprintf..
 

Re: floattostr() problem

if you are using is an AVR core must include libprintf_flt.a, libprintf_min.a, and flags-Wl,-u, vfprintf-lprintf_flt-lm, of course this is for AVRStudio. Mind you I'm just guessing that you are using AVR is not clear in your post
 

Re: floattostr() problem

i'm writing prog for Pic using mikroC
 

Re: floattostr() problem

Similar to the standard C sprintf() function but safer, since it calculates the maximum space required and allocates memory to hold the result. The returned string should be freed with g_free() when no longer needed.

If possible, use snprintf -- it gives an easy way to measure the size of data that would be produced so you can allocate space.
If you really can't do that, another possibility is printing to a temporary file with fprintf to get the size, allocate the memory, and then use sprintf. snprintf is definitely the preferred method though.

- - - Updated - - -
 
Last edited:

d=(tanA*tanB/(tanA+tanB))
i want to write this equation using mikroc.how can i write this?plz help me.
(in here A=motor1*0.1 & B=motor2*0.1)
motor1 & motor2 are variables.
 
Last edited:

There is tan() function which needs rad value. If you use trigonometry library then you can use sinE3()/cosE3() for getting tan value. These two functions take arguments in degrees.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top