Hi
How can i define int24 variable ? (with structure or another way) . I mean the 23th bit of this variable must be the sign bit !
Last edited by ROBOTICAR on Mon Mar 28, 2011 4:46 am; edited 1 time in total
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Sun Mar 27, 2011 1:41 pm
Why do you need a 'signed int24' ? Why can't you use a 'signed int32' ?
Where does the signed 24-bit data come from ? Is it from an A/D chip ?
Does it come in by SPI ?
ROBOTICAR
Joined: 28 Aug 2007 Posts: 45
Posted: Sun Mar 27, 2011 2:11 pm
yes. It's from AD chip and comes in by spi. I used 'signed int32' for that and i know we must use this type. But i think there is a way that we can make signed int24. My friend said you can use :
Code:
typedef struct _byte
{
unsigned int a : 8;
unsigned int b : 8;
unsigned int c : 8;
} int24;
void main()
{
int24 *K;
.
.
.
.
}
I think it isn't a good way ...
Is there any way for make it ?
By the way I'm searching about ways for making unusual types.
another question. Is there way for making 64-bit variables in 8-bit structure pic microcontroller ?
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum