SW500008 Microchip Technology, SW500008 Datasheet - Page 58

PICC-18 STD

SW500008

Manufacturer Part Number
SW500008
Description
PICC-18 STD
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC18r
Datasheets

Specifications of SW500008

Supported Families
PIC18
Core Architecture
PIC
Software Edition
Standard
Kit Contents
Software And Docs
Mcu Supported Families
PIC18
Tool Function
Compiler
Tool Type
Compiler
Lead Free Status / RoHS Status
Not applicable / RoHS Compliant
For Use With/related Products
PIC18 Series
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Other names
015
778-1001
778-1001
Supported Data Types and Variables
it will be cleared by the assignment since the least significant bit of data is zero. If you want to set
a bit variable to be 0 or 1 depending on whether the larger integral type is zero (false) or non-zero
(true), use the form:
The psects in which bit objects are allocated storage are declared using the bit PSECT directive
flag. Eight bit objects will take up one byte of storage space which is indicated by the psect’s scale
value of 8 in the map file. The length given in the map file for bit psects is in units of bits, not bytes.
All addresses specified for bit objects are also bit addresses.
non-zero initial value, explicitly initialise it at the beginning of your code.
3.4.3 Using Bit-Addressable Registers
The bit variable facility may be combined with absolute variable declarations (see Section 3.5.2) to
access bits at specific addresses. Absolute bit objects are numbered from 0 (the least significant bit
of the first byte) up. Therefore, bit number 3 (the fourth bit in the byte since numbering starts with
0) in byte number 5 is actually absolute bit number 43 (that is 8bits/byte * 5 bytes + 3 bits).
be a C object at absolute address FD0h, then declare a bit variable at absolute bit address 4050:
Note that all standard registers and bits within these registers are defined in the header files provided.
The only header file you need to include to have access to the PIC18 registers is <htc.h> - at compile
time this will include the appropriate header for the selected chip.
3.4.4 8-Bit Integer Data Types and Variables
HI-TECH PICC-18 STD supports both signed char and unsigned char 8-bit integral types.
If the signed or unsigned keyword is absent from the variable’s definition, the default type is
unsigned char unless the PICC18 --CHAR=signed option is used, in which case the default type
is signed char. The signed char type is an 8-bit two’s complement signed integer type, rep-
resenting integral values from -128 to +127 inclusive. The unsigned char is an 8-bit unsigned
integer type, representing integral values from 0 to 255 inclusive. It is a common misconception that
the C char types are intended purely for ASCII character manipulation. This is not true, indeed the
C language makes no guarantee that the default character representation is even ASCII. The char
44
The bit psects are cleared on startup, but are not initialised. To create a bit object which has a
If the PICC18 flag --STRICT is used, the bit keyword becomes unavailable.
For example, to access the power down detection flag bit in the RCON register, declare RCON to
bitvar = data != 0;
static unsigned char RCON @ 0xFD0;
static near bit PD @ (unsigned)&RCON*8+2;
C Language Features

Related parts for SW500008