SW500007 Microchip Technology, SW500007 Datasheet - Page 214

PICC-18 PRO

SW500007

Manufacturer Part Number
SW500007
Description
PICC-18 PRO
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC18r
Datasheets

Specifications of SW500007

Supported Families
PIC18
Core Architecture
PIC
Software Edition
Professional
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
015P
778-1002
778-1002
FLASH_ERASE, FLASH_READ, FLASH_WRITE
Synopsis
Description
These functions allow access to the flash memory of the microcontroller (when present).
function. flash_read returns the data value found at the specified address in flash memory.
use of the flash_erase() function. The number of bytes erased per flash erase action is specific to
each device’s flash-erase block size. Specifying an address to the flash_erase function, will erase
the entire block that contains the given address.
flash_write requires a pointer to the data that will be copied, the length of data to copy (in bytes)
and a pointer to the destination address in flash memory. This function can be used to update values
of variables declared as const. Any erasures of flash memory required in order write to the flash are
performed within flash_write and pre-erasure is not required.
Example
200
Reading from the flash memory can be done one byte at a time with use of the flash_read()
Entire sectors of flash memory can be restored to an unprogrammed state (value=FFFFh) with
flash_write() copies blocks of data/code from RAM/flash to a new destination in flash memory.
#include <htc.h>
void flash_erase (unsigned long addr);
unsigned char flash_read (unsigned long addr);
void flash_write(const unsigned char * source, unsigned int length,
#include <htc.h>
const unsigned char old_text[]="insert text here";
unsigned char new_text[]="HI-TECH Software";
void
main (void)
{
const unsigned char * source = new_text;
far unsigned char * dest = (far unsigned char *) old_text;
unsigned char data;
unsigned int length = sizeof(new_text);
far unsigned char * dest_addr);
Library Functions

Related parts for SW500007