SW500010 Microchip Technology, SW500010 Datasheet - Page 70

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
Processor-related Features
rom_read(), this macro does not wait for any concurrent EEPROM writes to complete before pro-
ceeding to select and read EEPROM. Had the previous example used the EEPROM_READ() macro
in place of eeprom_read() the operation would have failed. If it cannot be guaranteed that all writes
to EEPROM have completed at the time of calling EEPROM_READ(), the appropriate flag should
be polled prior to executing EEPROM_READ(). For example:
3.2.6 Flash Runtime Access
HI-TECH C PRO for the PIC10/12/16 MCU Family provides a number of methods to access the
contents of program memory at runtime. Particular care must be taken when modifying the contents
of program memory. If the location being modified is that which is currently being executed or
you’ve accidentally selected a region of your executable code for use as non-volatile storage, the
result could be disastrous so take care.
step will be performed internally by the compiler within the access routine and does not need to be
implemented as a separate stage. Data within the same flash erasure block that is unrelated to the
write operation will be backed up before the block is erased and restored after the erasure.
3.2.6.1 Flash Access Macros
Similar to the EEPROM read/write routines described above, there are equivalent Flash memory
routines. For example, to write a byte-sized value to an address in flash memory:
To read a byte of data from an address in flash memory, and store it in a variable:
70
In the case of EEPROM_READ(), there is another very important detail to note. Unlike eep-
For those devices requiring a flash erasure operation be performed prior to writing to flash, this
#include <htc.h>
void eetest(void){
}
FLASH_WRITE(address,value);
variable=FLASH_READ(address);
unsigned char value = 1;
unsigned char address = 0;
// Initiate writing value to address
EEPROM_WRITE(address,value);
// wait for end-of-write before EEPROM_READ
while(WR) continue;
// read from EEPROM at address
value = EEPROM_READ(address);
C Language Features

Related parts for SW500010