Datasheet
Programming PIC Microcontrollers in BASIC - mikroElektronika
 next i
 Flash_Write($0D00, toWrite) ' write contents of the 
array to the address 0x0D00
 ' verify write
 PORTB = 0 ' turn off PORTB
 toRead = FLASH_ERROR ' initialize error state
 for i = 0 to 63
 toRead = Flash_Read($0D00+i) ' read 64 consecutive 
locations starting from 0x0D00
 if toRead <> toWrite[i] then ' stop on first error
 PORTB = FLASH_ERROR ' indicate error
 Delay_ms(500)
 else
 PORTB = FLASH_OK ' indicate there is no error
 end if
 next i
end.
For PIC16 family, the corresponding code looks like this:
' for PIC16
program flash_pic16_test
const FLASH_ERROR = $FF
const FLASH_OK = $AA
dim toRead as word
dim i as word
main:
 TRISB = 0 ' PORTB is output
 for i = 0 to 63
http://www.mikroelektronika.co.yu/english/product/books/picbasicbook/08.htm (6 sur 12)05/11/2004 02:28:30










