Microchip MPLAB C18

Microchip MPLAB C18 is a C-Compiler. It supports all PIC18 Devices. It can run standalone from the Commandline or in the Microchip MPLAB IDE.

Students Edition
There is a free Students Edition, which must not be used for commercial projects. It has only 2 minimal restrictions:
 * the so called Procedural Abstraction is deactivated.
 * the so called Extended Instruction Set, which is present at some microcontrollers is not available.

In particular for hobbyists this restrictions are nonserious. Many other compilers do not have this features at all.

Inline Assembler
If only 1 Assembler instruction is included into the C-Code, then the whole optimizing will be deactivated.

Anonym Structures in Unions
An Union supports anonym (unnamed) structures, which helps to keep names short and which is an extension to the ANSI-C89/90 Standard.

Example ANSI complient
union {  struct {     unsigned char x;      unsigned char y;   } placeholder2; unsigned int z; } placeholder1;

Access of an element: unsigned int w; placeholder1.placeholder2.a = 0xE5; placeholder1.placeholder2.b = 0x3B; w = placeholder1.z;

vs. Example anonym structures
union {  struct {     unsigned char x;      unsigned char y;   }; // no name! unsigned int z; } placeholder;

Access of an element: unsigned int w; placeholder.x = 0xE5; placeholder.y = 0x3B; w = placeholder.z;

Bit Variable
typedef struct {   unsigned flag0:1; unsigned flag1:1; unsigned flag2:1; unsigned flag3:1; unsigned flag4:1; unsigned flag5:1; unsigned flag6:1; unsigned flag7:1; } Byte;