📄 chip.txt
字号:
SELECTING A PICmicro DEVICE
---------------------------
CC8E offers 3 ways to select the PICmicro device when compiling an
application. MPLAB will define the device automatically.
1) By a command line option. MPLAB will generate this option
automatically.
-p18F242
2) By a pragma statement in the source code. Note that the command
line option will override the selection done by #pragma chip.
#pragma chip PIC18F242
3) By using include to directly select a header file. This is
not recommended because there will be an error if the command
line option is also used.
#include "18f242.h"
NOTE 1: When using a pragma statement or include file, remember to
use this the beginning of the C program so that it is compiled
first. However, some preprocessor statements like '#define' and
'#if', etc. may preceed the #include/#pragma statement.
NOTE 2: When using the command line option or the pragma statement,
CC8E will use automatic include of the header file.
NOTE 3: If the header file does not reside in the default project
folder, then the path name is required. This can be supplied by a
command line option as an include folder/directory (-I<path>).
NOTE 4: New header files can be defined according to the next
section "GENERIC CHIP SUPPORT" and section "HOW TO MAKE A NEW
HEADER FILE".
NOTE 5: ICD2 debugging requires defining a symbol before the header
file is compiled to avoid duplicate use of reserved resources:
a) By a command line option:
-DICD2_DEBUG
b) By using #define in combination with #pragma chip or #include:
#define ICD2_DEBUG
..
#pragma chip PIC18F452 // or #include "18F452.H"
HOW TO MAKE A NEW HEADER FILE
-----------------------------
1. Chose an existing definition which is similar to the new chip
2. Copy this definition to a new file, ex. '18C123.h'
3. Modify and extend the definition according to the next section
4. Use the new header file the same way as existing header files
NOTE: Before making a new header file, check if a header file
can be downloaded from www.bknd.com
GENERIC CHIP SUPPORT
--------------------
This section defines how to make NEW header files.
The generic chip definition syntax is:
#pragma chip [=] CHIP_ID, core CSIZE, code PSIZE, ram RMIN : RMAX
CHIP_ID : PIC18CNNN, PIC18FNNN,
or any name starting with a letter or '_'.
CSIZE : core size of the chip: 16
PSIZE : program memory size in code WORDS
(typically 1024, 2048, 4096, 8192, 16384, 32768)
RMIN : minimum valid RAM address : 0
RMAX : maximum valid RAM address : 511, 1536, .. 0xEFF
Some chips also have an unusual startup vector location. The reset-
vector then have to be specified.
NOTE: this statement is normally NOT required, because the
compiler normally use the default location, which is the first
location.
#pragma resetVector 0 // at byte address 0
#pragma resetVector 10 // at byte address 10
#pragma resetVector - // NO reset-vector at all
The number of RAM bytes in the access bank can be defined. The
default setting is 128 (0x80). The start address of the SFR
regeisters in the access bank at the end of the data space will
also change accordingly.
#pragma accessGPR 0x60 // access RAM from 0 to 0x5F
The number of call levels can be defined (normally not required):
// PIC18 : 31 stack levels (hardware)
#pragma stackLevels 30 // max 64
REGISTER DEFINITIONS
--------------------
NOTE: Some registers are ALWAYS automatically defined,
and SHOULD NOT be defined again:
/* Predefined:
char TOSU, TOSH, TOSL;
char STKPTR;
char *TBLPTR; // 24 bit address
char TBLPTRU, TBLPTRH, TBLPTRL, TABLAT;
char PCLATU, PCLATH, PCL;
char PRODH, PRODL;
char INTCON, INTCON2, INTCON3;
char W, WREG;
char BSR, BSRL;
size2 char *FSR0, *FSR1, *FSR2;
char INDF0, POSTINC0, POSTDEC0, PREINC0, PLUSW0, FSR0H, FSR0L;
char INDF1, POSTINC1, POSTDEC1, PREINC1, PLUSW1, FSR1H, FSR1L;
char INDF2, POSTINC2, POSTDEC2, PREINC2, PLUSW2, FSR2H, FSR2L;
char STATUS;
bit Carry, DC, Zero_, Overflow, Negative;
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -