Simple question - the BYTE data type?

Status
Not open for further replies.

deweyusa

Member
The MPLAB C18 Users Guide has quite a few data types listed, but BYTE isn't one of them. Yet, it's used by Microchip in some of their code. Is BYTE a compiler specific type or something? What did I miss?



P.S.: Is there a forum that's better for these coding types of questions anyone can recommend? It seems this one is best suited for hardware questions?
 
No, BYTE is not a standard type. Microchip will have defined it probably as an unsigned char.

Mike.
 
Thanks Mike! I also found a UINT8, which I'm guessing is an 8-bit unsigned integer...

Now I wonder why they want to call an unsigned char a "BYTE"...I thought they'd want to avoid using the word "byte" specifically because it's not always 8 bits on every machine. Hmm...
 
The word "BYTE" is 8 bits.. period... It's the integer that's ambiguous... The Int comes from the size of the working register. The C language, on the whole, is string driven.. hence the character definition...Personally I prefer,, Byte, Word, Longword, etc... Its more descriptive....

Nowadays, as you've seen we are defining Uint8,16,32 etc.. AND shorts as opposed to longs.....AARRGGH.
 
I always thought that Byte was a contraction of By Eight and always contains 8 bits.

Integers and words are a bit confusing. On the 16 series pics the program memory is 14 bit "words"!!

Mike.
 
The MPLAB C18 Users Guide has quite a few data types listed, but BYTE isn't one of them. Yet, it's used by Microchip in some of their code. Is BYTE a compiler specific type or something? What did I miss?

BYTE and other generics are defined in the GenericTypeDefs.h file in C18, ...
It's very useful for defining data structures that need to be networked with PIC chips with different word sizes.
https://tools.assembla.com/lfenc/browser/Microchip/Include/GenericTypeDefs.h
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…