SW500010 Microchip Technology, SW500010 Datasheet - Page 67

HI-TECH C PRO FOR PIC10/12/16

SW500010

Manufacturer Part Number
SW500010
Description
HI-TECH C PRO FOR PIC10/12/16
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC10/12/16r
Datasheets

Specifications of SW500010

Supported Families
PIC10, PIC12, PIC16
Core Architecture
PIC
Software Edition
Professional
Kit Contents
Software And Docs
Mcu Supported Families
PIC10/12/16
Tool Type
Compiler
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
PIC10, PIC12, PIC14, PIC16, PIC16E
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Other names
019P
778-1006
778-1006
C Language Features
3.2.4 Bit Instructions
Wherever possible, HI-TECH C will attempt to use the PIC bit instructions. For example, when
using a bitwise operator and a mask to alter a bit within an integral type, the compiler will check the
mask value to determine if a bit instruction can achieve the same functionality.
3.2.5 EEPROM Access
For most devices that come with on-chip EEPROM, the compiler offers several methods of accessing
this memory. The EEPROM access methods are described in the following sections.
3.2.5.1 The eeprom variable qualifier
The compiler provides the eeprom qualifier as a very simple and efficient method to configure and
access EEPROM. This feature allows initialization of EEPROM memory and allows the simplest
mechanism for runtime access. The eeprom qualifier may only be applied to global and/or static
variables and this indicates to the compiler that the object should reside in EEPROM memory. For
example:
This will create an eeprom “variable” which is predefined with the value 0x1234. This would be
equivalent to using the __EEPROM_DATA macro with 0x12 and 0x34 as two of its parameters.
This variable may be read or written to at runtime:
The compiler will produce the appropriate code to access EEPROM and is particularly efficient
when accessing multi-byte variables. Unlike conventional RAM variables, if an initialized EEPROM
variable is modified during runtime, next time the processor is reset the variable will contain the
updated value, not the original initialization value. So in the above example, the first time the
processor starts up, serial_number will contain 0x1234, however after this is changed to 0xAA55,
unsigned int foo;
foo |= 0x40;
will produce the instruction:
bsf _foo,6
To set or clear individual bits within integral type, the following macros could be used:
#define bitset(var,bitno) ((var) |= 1UL < < (bitno))
#define bitclr(var,bitno) ((var) &= ~(1UL < < (bitno)))
To perform the same operation as above, the bitset macro could be employed as follows:
bitset(foo,6);
eeprom unsigned int serial_number = 0x1234;
serial_number = 0xAA55;
Processor-related Features
67

Related parts for SW500010