Datasheet
Programming PIC Microcontrollers in BASIC - mikroElektronika
end.
8.2 Flash Memory
Flash memory is a form of EEPROM that allows multiple memory locations to be erased or written in 
one programming operation. Normal EEPROM only allows one location at a time to be erased or 
written, meaning that Flash can operate at higher effective speeds when the systems using it read and 
write to different locations at the same time.
Flash memory stores information on a silicon chip in a way that does not need power to maintain the 
information in the chip. This means that if you turn off the power to the chip, the information is 
retained without consuming any power. In addition, Flash offers fast read access times and solid-state 
shock resistance. These characteristics make it very popular for microcontroller applications and for 
applications such as storage on battery-powered devices like cell phones.
Many modern PIC microcontrollers utilize Flash memory, usually in addition to normal EEPROM 
storage chip. Therefore, BASIC provides a library for direct accessing and working with MCU’s 
Flash. Note: Routines differ for PIC16 and PIC18 families, please refer to Chapter 5: Built-in and 
Library Routines.
The following code demonstrates use of Flash Memory library routines:
' for PIC18
program flash_pic18_test
const FLASH_ERROR = $FF
const FLASH_OK = $AA
dim toRead as byte
dim i as byte
dim toWrite as byte[64]
main:
 TRISB = 0 ' PORTB is output
 for i = 0 to 63 ' initialize array
 toWrite[i] = i
http://www.mikroelektronika.co.yu/english/product/books/picbasicbook/08.htm (5 sur 12)05/11/2004 02:28:30










