Usando EEPROM de NRF24LE1 (Parte 5/14)

Using EEPROM of NRF24LE1 (Part 5/14)

EEPROM with NRF24LE1

All good and bad incidents are stored in the brain memory of humans. Similarly, the controller uses EEPROM to save data or variables. In this article we will see how to use the NRF24LE1 EEPROM and what are its uses?

Do you know what memory does in electronics? Let's look at an example of a capacitor. It has the ability to retain voltage and is therefore treated as a memory component. There are two types of memories in electronics; Volatile and non-volatile. The volatile is erased if the power supplied to this memory is cut off. This means that the stored data will be erased in the event of a power failure. Non-volatile has the advantage of retaining data even when the power is off. The most common example of volatile memory is the RAM used in our computers. The examples of volatile memory are hard disk, SD cards, EEPROM, etc.

Protótipo de interface NRF24LE1 e EEPROM

Fig. 1: NRF24LE1 and EEPROM interface prototype

In this article, we will focus on the EEPROM in our NRF module and its use. EEPROM stands for electrically erasable programmable read-only memory. It is a type of Non-Volatile. It can be programmed and erased by providing special programming signals. They are available in small sizes and can be easily interfaced with AVR, Arduino or PIC. Sometimes they are built into microcontrollers. But to expand the memory we have to use the external one.

The NRF24LE1, being an incredible component, has built-in EEPROM memory. It has 1.5 Kb of non-volatile data memory. This memory is useful when we connect sensors and want to retain the readings for future use. To utilize the read and write capabilities of this memory, we will use function in our code.

We will use the nrfsdk (software development kit) provided by Nordic Semiconductor Ltd.

Visit our previous article on NRF24LE1 for more help.

Some functions we will use to read and write EEPROM are:

lib_eeprom_byte_write – This function takes the address location and a byte data to be written.

lib_eeprom_bytes_write – This function takes several bytes of data along with the number of bytes and the starting address.

lib_eeprom_byte_read – This function generates byte data from the given memory address.

• ib_eeprom_bytes_read – This function generates multibyte data from the given initial memory location
The description of the various functions is:
FUNCTION INPUT PARAMETER EXIT DESCRIPTION
lib_eeprom_byte_write 8-bit address and 8-bit data To write 8-bit data to the specified –bit address
lib_eeprom_bytes_write 8-bit address, 8-bit pointer to bytes to be written, and 8-bit value indicating the number of bytes to be written To write multiple bytes to the specified starting address
lib_eeprom_byte_read 8-bit address 8-bit data To read 8-bit data from a specified 8-bit address
lib_eeprom_bytes_read 8-bit address, 8-bit pointer to bytes to be written, and 8-bit value indicating the number of bytes to be read To read multiple bytes from the specified starting address.

For a complete understanding, take a look at the implementation of these functions in the code. The code has been commented for greater understanding.

We will write some data to the EEPROM memory and then restart our system. We will then read the previously stored data to check the operation of the EEPROM.

Project source code

###

 //Program to

/* Copyright (c) 2009 Nordic Semiconductor. All rights reserved.

*
*The information contained herein is the confidential property of Nordic
* ASA Semiconductor. Terms and conditions of use are described in detail
* in the NORDIC SEMICONDUCTORS STANDARD SOFTWARE LICENSE AGREEMENT.
*
* Licensees are granted free and non-transferable use of the information. NO
* WARRANTY OF ANY KIND is provided. This title should NOT be removed from the
* the file.
*
*$LastAmendedRevision: 133$
*/
#include "reg24le1.h" // I/O header file for NRF24LE1
#include "lib_eeprom.h" // header file containing eeprom read/write functions
#include "hal_delay.h" // header file containing delay functions
// Main code
main void
{
P1DIR = 0; // define port1 as output
P1 = 0; // makes all Port1 pins low
P1 = lib_eeprom_byte_read(0x00); // load 8-bit data from eeprom at address 0x00
delay_ms(2000); //2 second delay
while(1) //infinite loop
{
P10 = 0; //make port1 pin0 low
P11 = 0; //make port1 pin1 low
lib_eeprom_byte_write(0x00, P1); // write data from register P1 to eeprom
delay_ms(2000); //2 second delay
lib_eeprom_byte_write(0x00, P1); // write data from register P1 to eeprom
P10 = 1; //make port1 pin0 high
P11 = 0; //make port1 pin1 low
lib_eeprom_byte_write(0x00, P1); // write data from register P1 to eeprom
delay_ms(2000); //2 second delay
P10 = 0; //make port1 pin0 low
P11 = 1; //make port1 pin1 high
lib_eeprom_byte_write(0x00, P1); // write data from register P1 to eeprom
delay_ms(2000); //2 second delay
P10 = 1; //make port1 pin0 high
P11 = 1; //make port1 pin1 high
lib_eeprom_byte_write(0x00, P1); // write data from register P1 to eeprom
delay_ms(2000); //2 second delay
}
}

###

Circuit diagrams

Circuit Diagram-NRF24LE1-EEPROM Interface

Project video

Conteúdo Relacionado

A network of sensors is embedded in every vehicle,...
The motor controller is one of the most important...
ESP32-CAM is a compact camera module that combines the...
A evolução dos padrões USB foi fundamental para moldar...
A SCHURTER anuncia um aprimoramento para sua conhecida série...
A Sealevel Systems anuncia o lançamento da Interface Serial...
A STMicroelectronics introduziu Diodos retificadores Schottky de trincheira de...
Determinar uma localização precisa é necessário em várias indústrias...
O novo VIPerGaN50 da STMicroelectronics simplifica a construção de...
A Samsung Electronics, fornecedora de tecnologia de memória avançada,...
O mercado embarcado tem uma necessidade de soluções de...
You have probably come across the term ' drag...
You probably have a support insulator if you've noticed...
You've probably seen stand an insulator sit on power...
You've probably seen shackle insulators enthroned on electricity poles,...
You have probably experienced situations where controlling a circuit...
Back to blog

Leave a comment

Please note, comments need to be approved before they are published.