[Icc-avr] sprintf limitation?
Byron Loader
byron at inhep.com
Thu Jul 3 07:51:18 PDT 2008
-----Original Message-----
From: icc-avr-bounces at imagecraft.com [mailto:icc-avr-bounces at imagecraft.com]
On Behalf Of Paul Mateer
Sent: Thursday, July 03, 2008 4:25 PM
To: Discussion list for ICCAVR and ICCtiny Users. You do NOT need
tosubscribe to icc-announce if you are a member of this.
Subject: [Icc-avr] sprintf limitation?
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://dragonsgate.net/pipermail/icc-avr/attachments/20080703/5a26649d/attachment.html
More information about the Icc-avr
mailing list