>mpbwork wrote:
>
>> Thank you that is likely the problem.
>> However if I set to large then I exceed the limits for this kickstart
>> package.
>> full printf is large.
>> Is there a smaller direct code option? maybe a tight float library?
>
>Hi Mpb!
>
>No, only the large printf formatter can handle floating-point output.
>
>However, it's not that difficult to hand-craft an output routine for
>floating-point numbers, for a given format.
If need be and if precise specs (with a few examples included) can be
provided and if I'm allowed to work at it as I feel the mood, I'd
be
willing to write the output code without charge and provide it.
> Thank you that is likely the problem.
> However if I set to large then I exceed the limits for this kickstart
> package.
> full printf is large.
> Is there a smaller direct code option? maybe a tight float library?
Hi Mpb!
No, only the large printf formatter can handle floating-point output.
However, it's not that difficult to hand-craft an output routine for
floating-point numbers, for a given format.
-- Anders Lindgren, IAR Systems
--
Disclaimer: Opinions expressed in this posting are strictly my own and
not necessarily those of my employer.
Reply by mpbwork●August 5, 20082008-08-05
--- In m..., Anders Lindgren
wrote: >
> mpbwork wrote:
> > I use sprintf to fill a character array then send it to a LCD.
> > It works with int but not float
> > same for printf and the i/o window in IAR
> > Any ideas?
> > in the declerations i made
> >
> > static long a2dresult,temptest;
> > float datafloat;
> >
> > if (present)
> > {
> > //sprintf(TxData3," S%d= %ld
> > uV ",sensor2+1,a2dresult);
> > // the above line works (when not commented out) and
> > displays "S1= 250465 uV"
> >
> > datafloat = a2dresult * .001; // eg was 250465uV int, now
> > 250.465mV float
> > sprintf(TxData3," S%d= %9.2f mV",sensor2+1,datafloat); //mV +
> > decimal so float
> > // the above line does not and displays "S1= 9.2f mV"
> > // I don't see anything wrong. Any ideas?
> > }
> >
> > printf(" S%d= %9.2f mV\n",sensor2+1,datafloat); //also wrong in io
> > debug window
>
> Hi Mpb!
>
> The IAR libraries contain a number of different "printf" formatters, you > need to use the large variant to get support for
printing floating- point > numbers. See the Options->General Options->Library
Options->Printf
> formatter.
>
> -- Anders Lindgren, IAR Systems
> --
> Disclaimer: Opinions expressed in this posting are strictly my own and > not necessarily those of my employer.
> Thank you that is likely the problem.
However if I set to large then I exceed the limits for this kickstart
package.
full printf is large.
Is there a smaller direct code option? maybe a tight float library?
Reply by Anders Lindgren●August 4, 20082008-08-04
mpbwork wrote: > I use sprintf to fill a character array then send it
to a LCD.
> It works with int but not float
> same for printf and the i/o window in IAR
> Any ideas?
> in the declerations i made
>
> static long a2dresult,temptest;
> float datafloat;
>
> if (present)
> {
> //sprintf(TxData3," S%d= %ld
> uV ",sensor2+1,a2dresult);
> // the above line works (when not commented out) and
> displays "S1= 250465 uV"
>
> datafloat = a2dresult * .001; // eg was 250465uV int, now
> 250.465mV float
> sprintf(TxData3," S%d= %9.2f mV",sensor2+1,datafloat); //mV +
> decimal so float
> // the above line does not and displays "S1= 9.2f mV"
> // I don't see anything wrong. Any ideas?
> }
>
> printf(" S%d= %9.2f mV\n",sensor2+1,datafloat); //also wrong in io
> debug window
Hi Mpb!
The IAR libraries contain a number of different "printf" formatters, you
need to use the large variant to get support for printing floating-point
numbers. See the Options->General Options->Library Options->Printf
formatter.
-- Anders Lindgren, IAR Systems
--
Disclaimer: Opinions expressed in this posting are strictly my own and
not necessarily those of my employer.
Reply by michelqv●August 3, 20082008-08-03
Sometimes, you have to explicitly enable support for floats in
sprintf, because sprintf is usually a memory hog, especially for
floats. Not sure what the default is for IAR.
--- In m..., "mpbwork" wrote: >
> I use sprintf to fill a character array then send it to a LCD.
> It works with int but not float
> same for printf and the i/o window in IAR
> Any ideas?
> in the declerations i made
> static long a2dresult,temptest;
> float datafloat;
>
> if (present)
> {
> //sprintf(TxData3," S%d= %ld
> uV ",sensor2+1,a2dresult);
> // the above line works (when not commented out) and
> displays "S1= 250465 uV"
> datafloat = a2dresult * .001; // eg was 250465uV int, now
> 250.465mV float
> sprintf(TxData3," S%d= %9.2f mV",sensor2+1,datafloat); //mV +
> decimal so float
> // the above line does not and displays "S1= 9.2f mV"
> // I don't see anything wrong. Any ideas?
> }
>
> printf(" S%d= %9.2f mV\n",sensor2+1,datafloat); //also wrong in io > debug window
>
Reply by mpbwork●August 1, 20082008-08-01
I use sprintf to fill a character array then send it to a LCD.
It works with int but not float
same for printf and the i/o window in IAR
Any ideas?
in the declerations i made
static long a2dresult,temptest;
float datafloat;
if (present)
{
//sprintf(TxData3," S%d= %ld
uV ",sensor2+1,a2dresult);
// the above line works (when not commented out) and
displays "S1= 250465 uV"
datafloat = a2dresult * .001; // eg was 250465uV int, now
250.465mV float
sprintf(TxData3," S%d= %9.2f mV",sensor2+1,datafloat); //mV +
decimal so float
// the above line does not and displays "S1= 9.2f mV"
// I don't see anything wrong. Any ideas?
}
printf(" S%d= %9.2f mV\n",sensor2+1,datafloat); //also wrong in io
debug window