CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

int24

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ROBOTICAR



Joined: 28 Aug 2007
Posts: 45

View user's profile Send private message

int24
PostPosted: Sun Mar 27, 2011 7:33 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Mar 27, 2011 1:41 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Mar 27, 2011 2:11 pm     Reply with quote

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 ?

thanks again ...
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group