ABL electronic PIC16 Personal Computer User Manual


 
This library provides routines for accessing microcontroller Flash memory. Note
that prototypes differ for PIC16 and PIC18 families.
Flash_Read
Flash_Write
mikroC
- C Compiler for Microchip PIC microcontrollers
mikroC
making it simple...
18 6
MikroElektronika:
Development
tools
-
Books
-
Compilers
page
Flash Memory Library
Library Routines
Prototype
unsigned Flash_Read(unsigned address);
// for PIC16
char Flash_Read(long unsigned address);
// for PIC18
Returns Returns data byte from Flash memory.
Description Reads data from the specified address in Flash memory.
Example
Flash_Read(0x0D00);
Flash_Read
Prototype
void Flash_Write(unsigned address, unsigned data);
// for PIC16
void Flash_Write(unsigned long address, char *data);
// for PIC18
Description Writes chunk of data to Flash memory. With PIC18, data needs to be exactly 64 bytes in
size. Keep in mind that this function erases target memory before writing Data to it.
This means that if write was unsuccessful, previous data will be lost.
Example
// Write consecutive values in 64 consecutive locations
char toWrite[64];
// initialize array:
for (i = 0; i < 63; i++) toWrite[i] = i;
Flash_Write(0x0D00, toWrite);
Flash_Write