Good morning from California:
Sorry, I forgot to mention that was my attempt at pseudo code. I'm =
printf correctly, I believe. =20
I'm using C. Data is a binary. =20
Here's the weird thing: Program would run...I add a printf line...data =
over wrong, but consistently wrong. That is, the two-byte ID at the
beginning of the packet changes from 0x55 0x55 to 0x75 0x75. In binary,
[mailto:gumstix-users-bounces@...] On Behalf Of Dave
Sent: Wednesday, June 21, 2006 8:45 PM
To: General mailing list for gumstix users.
Subject: Re: [Gumstix-users] casting problem and soft-float
> Has anyone ever had issues with type casting? I'm using soft-float to
> compile for the gumsitx and weird things are happening when I cast =
> unsigned int to float.
> I'm getting data from a serial port casting that data into floats. =
> following works fine (example):
> Unsigned int num1, num2;
> Num3 =3D (float)num1;
Is this C? If so, the firist argument to printf needs to be a format
string. To print an unsigned int, you would so something like:
printf( "nunm3 =3D %d\n", num1 );
and to print a float, you would use:
printf( "num3 =3D %f\n", num3 );
%e %f and %g are all floating point style format specifiers which do
different formats (you can play with the width fields and stuff too,
> Note: It's the data from the serial port that becomes corrupted (bits
> turned on and off, consistently!)
The data from the serial port is 8 bits of data at a time. Are you
receiving binary or ASCII data?
> I'm sure it's not the way I'm reading the data. I can print out the =
> in the stream: first case stream is correct, second case stream is
Can you show me the code?
Vancouver, BC, Canada
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications =
the hosting industry. Fanatical Support. Click to learn more
gumstix-users mailing list