robotics-university.com | Hello friends, today I invite you to learn embedded systems using SimpleLink MSP432 development kit form Texas Instruments (TI). On this article, I will make a guidance to make interfacing between 16x2 characters liquid crystal display (LCD) with MSP432P401R microcontroller chip that embedded on SimpleLink MSP432 development kit. For the software, still using Code Composer Studio IDE software. Okey ... let’s continue read this article and practiced by follow the guidance on this project, hopefully this article useful for you.
1. Project Materials
To build this project, we have to has the project materials. Below I write-down the needs hardware and software in order you can make this project realized.
A. Hardware needs
(1) SimpleLink MSP432P401R development kit (32-bit ARM Cortex-M4F) from TI.
(2) Data cable (USB type-A to Micro USB type-B).
(4) Hitachi HD44780 - 16x2 LCD module (or compatible). See figure 1.
Figure 1. Hitachi HD44780 LCD (or compatible)
B. Software needs
(1) Code Composer (CoCo) Studio
Download the latest version of CoCo Studio (v9.3.0) here!, then install it to your computer.
(2) LCD16x2_MSP43x library
LCD16x2_MSP43x (Include lcd16x2_msp43x.h and lcd16x2_msp43x.c) is a couple-library file which can make you easy to develop an embedded systems project using LCD HD44780 and MSP432P401R microcontroller chip. This library authorized by Haroldo Amaral (firstname.lastname@example.org). He has been shared this library on Github for free. Download this library here!
2. Hardware Interface
To start the project, at the first, you have to make your SimpleLink MSP432 development kit connect to Hitachi HD44780 16x2 LCD module (or compatible). To make a connection, you have to know about Hitachi HD44780 16x2 LCD module pin configuration, see figure 2 first.
Figure 2. LCD 16x2 character - pin configuration
On this project, we will control the texts display on the 16x2 LCD with just using 4-bit data line, i.e. D4, D5, D6, and D7. On the other hands, on SimpleLink MSP432P401R development kit, we will use PORT-4 (P4) for the interfacing line. Below are the detail connection descriptions, see table 1.
Tabel 1. MSP432 microcontroller & 16x2 LCD pins connection description
With follow the pins connection description on table 1 above, start to connect every single pins on MSP432 microcontroller pins and 16x2 LCD pins using jumper cable.
Figure 3. SimpleLink MSP432 development kit interfacing with 16x2 LCD
For your information, on this project I use 16x2 LCD module from CH electronics (www.circuits-home.com), the wiring-visualization as shown on figure 4 below.
Figure 4. The wiring-visualization - MSP432P401R interfacing with 16x2 LCD module
3. Getting Started to New Project Building
STEP 1: Install The Hardware
Install your SimpleLink MSP432 development kit with your 16x2 LCD module with follow the guidance on Section 2 (Hardware Interface) above.
STEP 2: Create New Project
To create a new project on Code Composer Studio, you can read my previous article about “How to Create New Project & Hardware Connection Verify On Coco Studio” here!
Figure 5. A new project which has been created (lcd_16x2_b)
STEP 3: Download LCD16x2_MSP43x Library From Github
Download lcd16x2_msp43x library from Github. I have shared the download link above (See section 1.B, Project Materials)
Figure 6. lcd16x2_msp43x library download page
Save the library in a folder/directory of your computer and extract the zip file (LCD16x2_MSP43x-master.zip) to get the lcd16x2_msp43x.h and lcd16x2_msp43x.c files.
STEP 4: Add LCD16x2_MSP43x Library Into The Project
In order the lcd16x2_msp43x library file can be include on building/compilation process, you have to add the lcd16x2_msp43x.h and lcd16x2_msp43x.c files into the project package. To do so, please follow the steps below.
Figure 7. Add lcd16x2_msp43x library files into the project
Right-click the project package on the “Project Explorer,” then select “Add Files” option (See figure 7). Then browse and open folder/directory where you have store lcd16x2_msp43x library files (lcd16x2_msp43x.h and lcd16x2_msp43x.c) before (when you follow the library download steps above). If the library files have been found, select the lcd16x2_msp43x.h and lcd16x2_msp43x.c file, then click “Open” button to start add it into the project package (See figure 8).
Figure 8. Select the lcd16x2_msp43x.h and lcd16x2_msp43x.c files
If after you push “Open” button and “File Operation” windows opened, just select “Copy files” radio-button then push “OK” button to continue the adding files process (See figure 9).
Figure 9. File operation windows
If the adding files process run properly, on project explorer, you will see the lcd16x2_msp43x.h and lcd16x2_msp43x.c file has been added on the lcd_16x2_b project package (See figure 10).
Figure 10. lcd16x2_msp43x library files has added into the project
STEP 5: Modify The LCD16x2_MSP43x Library
Next, double-click lcd16x2_msp43x.h file to open it. The default lcd16x2_msp43x.h file as shown on figure 11.
Figure 11. The default lcd16x2_msp43x.h file
To make the lcd16x2_msp43x library can use to control the 16x2 LCD module, you have to do some modification in that. First, change the "msp430.h" microcontroller header to become "msp432.h" Second, set the LCD pins corresponding with your actual LCD pins connection to the MSP432P401R microcontroller pins. On this project, I use PORT-4, following the pins configuration in Table 1 and figure 3 above (See figure 12).
Figure 12. The modified lcd16x2_msp43x.h file
After you have been finished to modify the lcd16x2_msp43x.h file, then save the changed (Save All).
STEP 6: Create Program On Code Composer Studio Program Editor
On this project, we will create a main program to show two sentences on the LCD display, i.e. “Hi Taufiq!” on the first-row and “How are you?” on the second-row. Write the program below on the CCS IDE program editor (See Program 1).
Program 1: main.c
STEP 7: Build The Project
If you have been finished create your program, next, you have to “build” or compile that program, in order your program can be sent to the target microcontroller chip and configure its function as your expectation. To know the program building steps, you can read my previous article about “HowTo Build Project On Code Composer Studio” here!
STEP 8: Debug or Load The Project/Program
On Code Composer Studio, after a project has built successfully, there are two method to send the program-output to the microcontroller chip, i.e. Debug the program and Load the program. To know the program debugging or loading steps, you can read my previous article about “How To Debug and Load Project Using Code Composer Studio” here!
STEP 9: Ensure The Project Working As Your Expectation
To ensure that the built program has downloaded into the target microcontroller chip properly, please observe the project hardware. Is the LED behaviour has been as your expectation? If yes, that is sign that the built program has downloaded well.
Figure 13. Project result (MSP432 - LCD)