We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
Rating:
Author: MIKROE
Last Updated: 2018-01-19
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: EEPROM
Downloaded: 5955 times
Not followed.
License: MIT license
EEPROM 4 click is 2,097,152 bits on a click board, organized into 262,144 bytes. In other words, this click board is an EEPROM memory medium with the capacity of 256 KB.
Do you want to subscribe in order to receive notifications regarding "EEPROM 4 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "EEPROM 4 click" changes.
Do you want to report abuse regarding "EEPROM 4 click".
Library Description
Initializes and defines SPI bus driver, driver functions which communicate with the memory array and configures click to the writable state.
Key functions
uint8_t eeprom4_sendCommand(uint8_t command_byte);- The function sends command (instruction) to the click. In case that command byte is _EEPROM4_LOW_POWER_WRITE_POLL_COMMAND (0x08) function returns 0x00 if a part is not in a write cycle and returns 0xFF if the part is still busy completing the write cycle. In other cases, the function returns 0.
void eeprom4_writeStatusReg(uint8_t data_value);- The function writes data determined in the parameter of the function to the status register.
uint8_t eeprom4_readStatusReg(void);- The function reads a one-byte data value from the status register.
void eeprom4_writeMemory(uint32_t memory_address, uint8_t *data_input, uint8_t nBytes);- The function writes a number of bytes determined by nBytes parameter from buffer determined by data_input pointer to memory location determined by memory_address parameter.
void eeprom4_readMemory(uint32_t memory_address, uint8_t *data_output, uint8_t nBytes);- The function reads a number of bytes determined by nBytes parameter from memory location determined by memory_address parameter and stores bytes to buffer determined by data_output pointer.
void eeprom4_enableWriteProtect(uint8_t state);- The function sets RST pin on state value to enable or disable writing to status register and memory array. WP pin is used in conjunction with the block protection bits of the status register and with WPEN and WEL bits also.
void eeprom4_enableHoldOperation(uint8_t state);- The function enables or disables the Hold operation. To pause the serial communication with the master device without resetting the serial sequence, the HOLD pin must be brought low. To resume serial communication, HOLD pin must be brought high.
uint8_t eeprom4_checkStatusReg(uint8_t check_bit);- The function checks the value of the status register bit determined by check_bit parameter.
Examples Description
The application is composed of three sections :
void applicationTask() { eeprom4_sendCommand(_EEPROM4_SET_WRITE_ENABLE_LATCH_COMMAND); eeprom4_writeMemory(_EEPROM4_FIRST_MEMORY_LOCATION, &data_write[0], 8); cnt = eeprom4_checkStatusReg(_EEPROM4_READY_BIT); check_state = eeprom4_sendCommand(_EEPROM4_LOW_POWER_WRITE_POLL_COMMAND); while(cnt | check_state) { cnt = eeprom4_checkStatusReg(_EEPROM4_READY_BIT); check_state = eeprom4_sendCommand(_EEPROM4_LOW_POWER_WRITE_POLL_COMMAND); } eeprom4_readMemory(0x00000001, &data_read[0], 6); for(cnt = 0; cnt < 6; cnt++) { WordToStr(data_read[cnt], text); mikrobus_logWrite(text, _LOG_TEXT); if(cnt < 5) { mikrobus_logWrite(",", _LOG_TEXT); }else { mikrobus_logWrite("", _LOG_LINE); } } Delay_ms(2000); }
MikroElektronika Libraries used in the example:
Additional notes and information
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.