mikroC
mikroC - C Compiler for Microchip PIC microcontrollers
making it simple...
Flash Memory Library
This library provides routines for accessing microcontroller Flash memory. Note that prototypes differ for PIC16 and PIC18 families.
Library Routines
| Flash_Read |
| Flash_Write |
Flash_Read |
|
|
|
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_Write
|
| 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); |
| |
|
|
|
|
|
|
|
| page |
|
|
|
|
|
|
| ||
186 | MikroElektronika: Development tools - Books - Compilers | ||||
|
|
|