avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] 24 bit integers


From: Bernt Hustad Hembre
Subject: [avr-gcc-list] 24 bit integers
Date: Sun Jan 28 04:02:04 2001

Hi.

I've tried to find out how int, char, long etc. is defined in gcc for avr.
I'm preaty sure char is 8 bit,
quite sure int is 16 bit
not at all sure that long is 32 bit.

I have a 24bit ADC (HI7191). It return either a 24bit signed or unsigned
integer. And I want to expand it to a 32 bit integer (long?).

Ie. I get adc_data[3] returned from the measuring routine.

I think this is right for unsigned:
thirtytwobit = adc_data[0] + (adc_data[1]*256) + (adc_data[2]*65536);

But how can I get it right for signed values?
Something like this?:
thirtytwobitsigned = (adc_data[0] + (adc_data[1]*256) +
((adc_data[2]&0x7f)*65536)) * (adc_data[2]&0x80) * (-1);

What is the size/accurancy of float, double etc.?
Where are these defined?

Thanks in advance.

Bernie
Tlf.: 92648923
address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]