Fandom

Scratchpad

Microchip MPLAB C18

216,223pages on
this wiki
Add New Page
Discuss this page0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

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:

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

Discrepancies ANSI-C89/90

Inline Assembler

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

Integral Promotion

Resulting Problems With Constants

Other Resulting Problems And Workarounds

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;

Also on Fandom

Random wikia