Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

EEPROM - Electrically Erasable Programmable read-Only Memory


Modules

 Version History
 EEPROM - Code example

Functions

U8 EEreadStatus ()
 Read the eeprom status.
void EEwriteStatus (U8 stat)
 Write the staus register.
void EEwriteEnable (bool ena)
 Set the write enable latch (enable write operations).
U8 EEread (U32 *add)
 Read a byte at the specified address.
U16 EEreadWord (U32 *add)
 Read a word at the specified address.
U32 EEreadLong (U32 *add)
 Read a double word at the specified address.
double EEreadDouble (U32 *add)
 Read a double at the specified address.
void EEreadString (U32 *add, char *text, U32 maxChars)
 Read a string starting at the specified address.
void EEwrite (U32 *add, U8 data)
 Write a byte at the specified address.
void EEwriteWord (U32 *add, U16 data)
 Write a word at the specified address.
void EEwriteLong (U32 *add, U32 data)
 Write a double word at the specified address.
void EEwriteDouble (U32 *add, double data)
 Write a double at the specified address.
void EEwriteString (U32 *add, const char *text, U32 maxChars)
 Write a string at the specified address.
S8 EEreadCheck (U32 *add, S8 lowValue, S8 highValue, S8 defaultValue)
 Read a byte and check it.
S16 EEreadWordCheck (U32 *add, S16 lowValue, S16 highValue, S16 defaultValue)
 Read a word and check it.
S32 EEreadLongCheck (U32 *add, S32 lowValue, S32 highValue, S32 defaultValue)
 Read a double word and check it.
F64 EEreadDoubleCheck (U32 *add, F64 lowValue, F64 highValue, F64 defaultValue)
 Read a double and check it.

Detailed Description

Dependency:
FPGA - Procedures for SharkDuino+ FPGA,
TIMER - Procedure for timer usage,
SPI - Serial Protocol Interface

Function Documentation

U8 EEread U32 add  ) 
 

Parameters:
add EEprom address pointer. After the read this value is incremented (+1).
Returns:
EEprom contents

S8 EEreadCheck U32 add,
S8  lowValue,
S8  highValue,
S8  defaultValue
 

Reads a byte verifying that its value belongs to a defined range. If this condition is not respected a default value is applied.

Parameters:
add EEprom address pointer. After the read this value is incremented (+1).
lowValue Minimum accepted value for the byte read.
highValue Maximum accepted value for the byte read.
defaultValue Default value if byte read is out of range.
Returns:
The value read and possibly corrected.

double EEreadDouble U32 add  ) 
 

Parameters:
add EEprom address pointer. After the read this value is incremented (+8).
Returns:
EEprom contents

F64 EEreadDoubleCheck U32 add,
F64  lowValue,
F64  highValue,
F64  defaultValue
 

Reads a double verifying that its value belongs to a defined range. If this condition is not respected a default value is applied.

Parameters:
add EEprom address pointer. After the read this value is incremented (+8).
lowValue Minimum accepted value for the double read.
highValue Maximum accepted value for the double read.
defaultValue Default value if double read is out of range.
Returns:
The value read and possibly corrected.

U32 EEreadLong U32 add  ) 
 

Parameters:
add EEprom address pointer. After the read this value is incremented (+4).
Returns:
EEprom contents

S32 EEreadLongCheck U32 add,
S32  lowValue,
S32  highValue,
S32  defaultValue
 

Reads a double word verifying that its value belongs to a defined range. If this condition is not respected a default value is applied.

Parameters:
add EEprom address pointer. After the read this value is incremented (+4).
lowValue Minimum accepted value for the double word read.
highValue Maximum accepted value for the double word read.
defaultValue Default value if double word read is out of range.
Returns:
The value read and possibly corrected.

U8 EEreadStatus  ) 
 

 * The Read Status Register instruction (RDSR) provides access to the STATUS register. 
 * The STATUS register may be read at any time, even during a write cycle. 
 * STATUS REGISTER\n
 * 7    6   5   4   3   2   1   0
 * W/R  -   -   -   W/R W/R R   R
 * WPEN X   X   X   BP1 BP0 WEL WIP
 * The Write-In-Process (WIP) bit indicates whether the 25LC1024 is busy with a write operation. 
 * When set to a ‘1’, a write is in progress, when set to a ‘0’, no write is in progress. 
 * This bit is read-only.
 * The Write Enable Latch (WEL) bit indicates the status of the write enable latch and is read-only. 
 * When set to a ‘1’, the latch allows writes to the array, when set to a ‘0’, the latch prohibits writes to the array. 
 * The state of this bit can always be updated via the WREN or WRDI commands regardless of the state of write protection on the STATUS register. 
 * The Block Protection (BP0 and BP1) bits indicate which blocks are currently write-protected. 
 * These bits are set by the user issuing the WRSR instruction. 
 * These bits are nonvolatile and are shown in above table.
 * 
Returns:
Return the eeprom status
See also:
EEwriteStatus

void EEreadString U32 add,
char *  text,
U32  maxChars
 

Parameters:
add EEprom address pointer. After the read this value is incremented (+maxChars).
text String to be written
maxChars String size

U16 EEreadWord U32 add  ) 
 

Parameters:
add EEprom address pointer. After the read this value is incremented (+2).
Returns:
EEprom contents

S16 EEreadWordCheck U32 add,
S16  lowValue,
S16  highValue,
S16  defaultValue
 

Reads a word verifying that its value belongs to a defined range. If this condition is not respected a default value is applied.

Parameters:
add EEprom address pointer. After the read this value is incremented (+2).
lowValue Minimum accepted value for the word read.
highValue Maximum accepted value for the word read.
defaultValue Default value if word read is out of range.
Returns:
The value read and possibly corrected.

void EEwrite U32 add,
U8  data
 

Parameters:
add EEprom address pointer. After the read this value is incremented (+1).
data Byte to be written

void EEwriteDouble U32 add,
double  data
 

Parameters:
add EEprom address pointer. After the read this value is incremented (+8).
data Double to be written

void EEwriteEnable bool  ena  ) 
 

Parameters:
ena If true enable write operations

void EEwriteLong U32 add,
U32  data
 

Parameters:
add EEprom address pointer. After the read this value is incremented (+4).
data Double word to be written

void EEwriteStatus U8  stat  ) 
 

 * The Write Status Register instruction (WRSR) allows the user to write to the nonvolatile bits in the STATUS register.
 * The user is able to select one of four levels of protection for the array by writing to the appropriate bits in the STATUS register.
 * The array is divided up into four segments. 
 * The user has the ability to write-protect none, one, two, or all four of the segments of the array. 
 * The partitioning is controlled as shown in below table:
 * BP1      BP0     Array Addresses             Array Addresses
 *                  Write-Protected               Unprotected
 *  0        0            none              All (Sectors 0, 1, 2 & 3)
 *                                              (00000h-1FFFFh)
 *  0        1      Upper 1/4 (Sector 3)    Lower 3/4 (Sectors 0, 1 & 2)
 *                    (18000h-1FFFFh)           (00000h-17FFFh)
 *  1        0      Upper 1/2 (Sectors 2&3) Lower 1/2 (Sectors 0 & 1)
 *                    (10000h-1FFFFh)           (00000h-0FFFFh)
 *  1        1      All (Sectors 0,1,2&3)            none
 *                    (00000h-1FFFFh)
 * The Write-Protect Enable (WPEN) bit is a nonvolatile bit that is available as an enable bit for the WP pin.
 * The Write-Protect (WP) pin and the Write-Protect Enable (WPEN) bit in the STATUS register control the programmable hardware write-protect feature. 
 * Hardware write protection is enabled when WP pin is low and the WPEN bit is high. 
 * Hardware write protection is disabled when either the WP pin is high or the WPEN bit is low. 
 * When the chip is hardware write-protected, only writes to nonvolatile bits in the STATUS register are disabled.
 * 
Parameters:
stat Status Register
See also:
EEreadStatus

void EEwriteString U32 add,
const char *  text,
U32  maxChars
 

Parameters:
add EEprom address pointer. After the read this value is incremented (+maxChars).
text String to be written
maxChars Size of the string to be written

void EEwriteWord U32 add,
U16  data
 

Parameters:
add EEprom address pointer. After the read this value is incremented (+2).
data Word to be written
footer

otStudio - Library Reference - (C) 2020-25 Officina Turini, All Rights Reserved
Document built with Doxygen 1.4.0