[Icc-avr] Re: sprintf limitation?

Paul Mateer paul.aa9gg at gmail.com
Mon Jul 7 06:51:13 PDT 2008


Hello all....

Thanks for the responses.  I found the problem:

a = (VAL[0] - 48) * 10000;

for what ever reason it does not like this.  I had to split it up and all is
good now !?

a = (VAL[0] - 48);
a = a * 10000;

----------------------------------------------------------------------------------------------------------------------------------------

On Thu, Jul 3, 2008 at 9:25 AM, Paul Mateer <paul.aa9gg at gmail.com> wrote:

> I'm running into a strange problem.  Trying to adjust my var. "max_flow"
> from 0-99999.  This sort of works....but only up to 39999!!!  Anything 40000
> and above it returns me an "atof error - number to big" .  Why?  According
> to STDLIB.H max is 2147483520.  Ideas???
>
> //-----------------------------------------------------------------------
>    double max_flow;
>    unsigned long temp;
>    char VAL[15];
>
>    max_flow = 39999;
>
>    temp = (unsigned long)max_flow;
>    csprintf(VAL,"%05ld",temp);
>
>    dspsingle(0, 'M');
>    dspsingle(1, 'X');
>    dspsingle(2, '=');
>    dspsingle(3, VAL[0]);
>    dspsingle(4, VAL[1]);
>    dspsingle(5, VAL[2]);
>    dspsingle(6, VAL[3]);
>    dspsingle(7, VAL[4]);
>
>    VAL[0]= (adj_digit((VAL[0]-48), 3)) + 48;
>    wait_key();
>    VAL[1]= (adj_digit((VAL[1]-48), 4)) + 48;
>    wait_key();
>    VAL[2]= (adj_digit((VAL[2]-48), 5)) + 48;
>    wait_key();
>    VAL[3]= (adj_digit((VAL[3]-48), 6)) + 48;
>    wait_key();
>    VAL[4]= (adj_digit((VAL[4]-48), 7)) + 48;
>
>    a = (VAL[0] - 48) * 10000;
>    b = (VAL[1] - 48) * 1000;
>    c = (VAL[2] - 48) * 100;
>    d = (VAL[3] - 48) * 10;
>    e = (VAL[4] - 48);
>
>    temp = a+b+c+d+e;
>    max_flow = temp;
>
> //----------------------------------------------------------------------------------------
>
> --
> Paul Mateer, AA9GG
> Elan Engineering Corp.
> www.elanengr.com




-- 
Paul Mateer, AA9GG
Elan Engineering Corp.
www.elanengr.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20080707/3b9b1831/attachment.html


More information about the Icc-avr mailing list