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 CCS Technical Support

byte or int (int 8)??

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



Joined: 21 Nov 2005
Posts: 15
Location: Montreal, Canada

View user's profile Send private message Send e-mail

byte or int (int 8)??
PostPosted: Mon Apr 24, 2006 6:27 am     Reply with quote

When it comes to data types, I've noticed that in some examples,the word "byte" is used as a data type specifier. I was unable to find the usage or definition of this data type in the manual or help file. The editor doesn't even highlight this keyword. I imagine the the identifier "byte" is simply an unsigned int 8. I just want to be sure before I make this conclusion.
rberek



Joined: 10 Jan 2005
Posts: 207
Location: Ottawa, Canada

View user's profile Send private message

PostPosted: Mon Apr 24, 2006 6:41 am     Reply with quote

You are probably thinking if #byte, which is described in the manual. It is used to attach a name to a memory address.
Charlie U



Joined: 09 Sep 2003
Posts: 183
Location: Somewhere under water in the Great Lakes

View user's profile Send private message

PostPosted: Mon Apr 24, 2006 7:28 am     Reply with quote

The byte type is defined in the device header files.

#define BYTE int
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Mon Apr 24, 2006 7:34 am     Reply with quote

Quote:

I imagine the the identifier "byte" is simply an unsigned int 8.


Yes you are right.
For the CCS Compiler a byte, int, int8, char have the same size: 8 bits.

Quote:

The editor doesn't even highlight this keyword.

I don�t know what editor are you using but highlighted words depends if they are included or not in a user accesible/modificable list.

Humberto


Last edited by Humberto on Mon Apr 24, 2006 7:35 am; edited 1 time in total
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Mon Apr 24, 2006 7:35 am     Reply with quote

The BYTE type is defined in the header file for your PIC processor. For example <pic18f458.h> defines:
Code:
#define BYTE int
mewanchyna



Joined: 21 Nov 2005
Posts: 15
Location: Montreal, Canada

View user's profile Send private message Send e-mail

PostPosted: Mon Apr 24, 2006 9:23 am     Reply with quote

Thanks for the replies in record time!. To clarify, I'm not talking about the "#byte". As mentioned, it's when a data type is specified (see sample code). Is "byte" leftover from another compiler? If it is defined in the header files, perhaps it's to maintain backwards compatability from a previous compiler. I'm using the CCS ver. 3.249 PCWH interface. If it is included in the header file, one would assume that they would have included int the list of recognized keywords. Nevertheless, these are minor points, my question has been answered and I'm happy again!
Code:
void lcd_send_nibble( BYTE n ) {
      lcd.data = n;
      delay_cycles(1);
      lcd.enable = 1;
      delay_us(2);
      lcd.enable = 0;
}
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