View previous topic :: View next topic |
Author |
Message |
mewanchyna
Joined: 21 Nov 2005 Posts: 15 Location: Montreal, Canada
|
byte or int (int 8)?? |
Posted: Mon Apr 24, 2006 6:27 am |
|
|
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
|
|
Posted: Mon Apr 24, 2006 6:41 am |
|
|
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
|
|
Posted: Mon Apr 24, 2006 7:28 am |
|
|
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
|
|
Posted: Mon Apr 24, 2006 7:34 am |
|
|
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
|
|
Posted: Mon Apr 24, 2006 7:35 am |
|
|
The BYTE type is defined in the header file for your PIC processor. For example <pic18f458.h> defines:
|
|
|
mewanchyna
Joined: 21 Nov 2005 Posts: 15 Location: Montreal, Canada
|
|
Posted: Mon Apr 24, 2006 9:23 am |
|
|
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;
} |
|
|
|
|