[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] 24 bit integers
From: |
Carl Wall |
Subject: |
Re: [avr-gcc-list] 24 bit integers |
Date: |
Sun Jan 28 06:45:04 2001 |
User-agent: |
Mutt/1.2.5i |
Bernt
You might want to check out "inttypes.h" which is located in
/usr/local/avr/include/ on my machine, it has what int, etc
are being defined as. Looks like "long" is int32_t and "unsigned
long" is unit32_t, and "long long" is int64_t if you need a few
more bits ;-))
Carl
On Sat, Jan 27, 2001 at 04:09:13PM +0100, Bernt Hustad Hembre wrote:
>
> 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
>
>
> _______________________________________________
> avr-gcc-list mailing list
> address@hidden
> http://avr.jpk.co.nz/mailman/listinfo/avr-gcc-list
--
Carl A. Wall VE3APY Toronto, Ontario, Canada
"Created on DEBIAN 2.2, an alternative to Microsoft Systems
and a GNU/Linux distribution of Open Source programming"