Syntax
SUB FREAD ( FlashAddr, Destination, size
)
Destination = arrayname | stringname
size in bytes
FlashAddr an address in RAM or
Flash
Description -- added version 7.13
The built-in subroutine FREAD copies data stored in the Flash memory to
the Destination array, for size bytes. When a string is used, it
is treated like a byte array, not a 0 terminated string
You can also directly access the Flash with pointers. To read a word in
Flash, *FlashAddr will return the 32 bit value starting at that
address.
Example
' simple example of
write and read
DIM A(511) as string
DIM B(511) as
string
'...
WRITE (&H6000, A, 512)
' this will erase the &H6000 sector, as its the first encountered
WRITE
(&H6200, A, 512) ' no erasure is required, as it was erased in
the last call
FREAD (&H6200, B, 512)
'...
WRITE
(&H6000, A, 0) ' this forces an erase of
sector &H6000, needed as it was the last sector erased
WRITE (&H6000,
A, 512)
'...
WRITE (&H6000, A,
512) ' as the same block is being written it will
automatically be erased
WRITE (&H6000, A,
512)
Differences from other BASICs
- Does not exist in Visual BASIC
- PBASIC has a similar function
See also