222 of 318
ZBasic System Library 212 ZX Microcontroller Family PutPersistent Type Subroutine Invocation PutPersistent(addr, var, count) Parameter Method Type Description addr ByVal int16 The Persistent Memory address to which to write. var ByRef any type The variable from which data will be taken. count ByVal int8/16 The number of bytes to write. Discussion This routine reads one or more bytes from RAM and writes them to Persistent Memory beginning at the address given. Caution Persistent Memory has a write cycle limit of approximately a million writes. Writing to a particular address in excess of this limit may cause the memory to become unreliable. A block of Persistent Memory starting at address zero is reserved for system use. When the compiler assigns addresses to persistent variables defined in your program, the lowest address used is the first address above this reserved block. The .map file generated by the compiler contains a section indicating the addresses assigned to persistent variables defined in your program. The built-in values Register.PersistentStart, Register.PersistentSize and Register.PersistentUsed may be useful for determining the allocated an unallocated portions of Persistent Memory. This routine will write to any address in Persistent Memory. Generally, you should avoid writing to the reserved area of Persistent Memory. Example Dim pvar(1 to 10) as PersistentByte Dim var(1 to 10) as Byte Call PutPersistent(pvar.DataAddress, var, SizeOf(pvar)) Compatibility This routine is not available in BasicX compatibility mode. See Also GetPersistent