In this lesson, we will continue to study the CC430F5137 microcontroller on the MSP430 core on which the TiTAN and TiTAN-I boards are based.
We will learn how to work with an LCD display with a parallel HD44780 interface and a CC1101 radio interface.
As a result we will get this stand
We studied the bottom part of the stand in the previous lesson, and learned how to connect the TiTAN-I Board via the I2C interface to the LCD display, how to start the real-time clock (RTC) and transmit data over the radio.
Now the TiTAN Board must receive data from the radio, display the time information from the TITAN-I on the LCD display, and turn on the buzzer if the alarm mode is triggered.
Are you ready?
As we have already mentioned we will need the RF1A library from our example from the web-site titanproject.com in the “software” section.
Let’s add it to our project. In this library, you will find an array of rfSettings with radio settings that were obtained using the SmartRF Studio program by Texas Instruments.
By the way, we use the functions necessary for the operation of the LCD display in this example
Let’s connect these libraries to our project.
First, we will determine the size of the received data and the size of the service information (RSSI and LQI) that accompanies each received packet.
We will discuss the values of this data in one of our further lessons, but you can also learn about them yourself by using the Texas Instruments documentation on the CC1101 interface in section 17
at this address: https://www.ti.com/lit/ds/symlink/cc1101.pdf?ts=1590908983417 Define an array for the received data and the necessary variables.
As you may have guessed, the main actions in the microcontrollers are processed by interrupts. And receiving data over the radio is no exception.
Create the handler interrupt on the radio.
Don’t be afraid of so many events that can handle this interruption. They are described in detail in the reference documentation by Texas Instruments in section 25.
Let’s check that the data was received. The first byte of the received data will be the length of the data along with the RSSI and LQI fields. After that, we will get all the received data to the receiving buffer and set the flag that the data is received.
At the end, we will reconfigure the radio and prepare it to accept the following data.
There’s not much left.
Let’s initialize the LCD display. We’ll start to display the data received from the radio and will turn on the buzzer if necessary.
Let us remind you about the printf function. In the first part of the lesson, we told you what you need to do to make it perceive the modifiers.
It remains to build our project and run it on the TiTAN-I Board.
Thanks to these two parts of the lesson, you have mastered 6 very important functions:
- The real-time clock,
- The I2C interface,
- The LCD displays on the PCF2119x and HD44780 controllers,
- The built-in CC1101 transceiver to the CC430F5137,
- The advanced printf function.