Difference between revisions of "Compiling PIC projects"

From LinkSprite Playgound
Jump to: navigation, search
(C compiler)
 
Line 23: Line 23:
  
 
[[File:Pickit3.JPG | 500px]]
 
[[File:Pickit3.JPG | 500px]]
 +
 +
 +
==Notes==
 +
 +
The position and size of the supported config identifiers should be
 +
defined. This enables the identifiers to be used in #pragma config
 +
statements in an application.
 +
 +
    #pragma config_def [=] value
 +
 +
  value:
 +
  0x0001:  FOSC in bit 0,1  : 0 - 3, LP, XT, HS, RC
 +
  0x0002:  FOSC in bit 0,1,2 : 0 - 7, LP, XT, HS
 +
  0x0004:  FOSC in bit 0    : 0, 1
 +
  0x0008:  FOSC in bit 0,1,4 : 0 - 7, LP, XT, HS
 +
 +
  0x0010:  WDTE in bit 2: off (0), on (1)
 +
  0x0020:  WDTE in bit 3: off (0), on (1)
 +
 +
  0x0100:  PWRTE in bit 3 (inverted):    on (0), off (1)
 +
  0x0200:  PWRTE in bit 4 (inverted):    on (0), off (1)
 +
  0x0400:  PWRTE in bit 3 (not inverted): off (0), on (1)
 +
 +
  0x1000:  BODEN in bit 6  : off (0), on (1)
 +
 +
 +
Example: #pragma config_def 0x1111  // 0x0001 | 0x0010 | 0x0100 | 0x1000
 +
 +
    FOSC in position 0,1
 +
    WDTE in position 2
 +
    PWRTE in position 3 (0=on)
 +
    BODEN in position 6
 +
 +
NOTE: THIS PRAGMA IS NORMALLY FOUND IN THE CHIP HEADER FILE AND
 +
      SHOULD NOT BE USED IN THE APPLICATION SOURCE CODE.

Latest revision as of 09:00, 9 December 2012

C compiler

The most popular free C compiler for PIC project is cc5xfree. You can download from:


You can also download from:


Cc5x.JPG

C compiler handbook


Pic Kit 3

You can download the PITkit3 programmer software from [1]

Pickit3.JPG


Notes

The position and size of the supported config identifiers should be defined. This enables the identifiers to be used in #pragma config statements in an application.

   #pragma config_def [=] value
  value:
  0x0001:  FOSC in bit 0,1   : 0 - 3, LP, XT, HS, RC
  0x0002:  FOSC in bit 0,1,2 : 0 - 7, LP, XT, HS
  0x0004:  FOSC in bit 0     : 0, 1
  0x0008:  FOSC in bit 0,1,4 : 0 - 7, LP, XT, HS
  0x0010:  WDTE in bit 2: off (0), on (1)
  0x0020:  WDTE in bit 3: off (0), on (1)
  0x0100:  PWRTE in bit 3 (inverted):     on (0), off (1)
  0x0200:  PWRTE in bit 4 (inverted):     on (0), off (1)
  0x0400:  PWRTE in bit 3 (not inverted): off (0), on (1)
  0x1000:  BODEN in bit 6  : off (0), on (1)


Example: #pragma config_def 0x1111 // 0x0001 | 0x0010 | 0x0100 | 0x1000

   FOSC in position 0,1
   WDTE in position 2
   PWRTE in position 3 (0=on)
   BODEN in position 6

NOTE: THIS PRAGMA IS NORMALLY FOUND IN THE CHIP HEADER FILE AND

     SHOULD NOT BE USED IN THE APPLICATION SOURCE CODE.