TivaC Lcd Driver for 1602A LCD controller
A c++ driver for interfacing the TivaC with the 1602A LCD controller
TivaC Lcd Driver for 1602A LCD controller Documentation

Lcd Driver

Driver using the TivaC Dev board for the 1602A LCD controller. This controller uses a parallel bus that can do 4-bit or 8-bit, there was no standard protocol to talk with it aside from the things noted in the datasheet so it's just pretty big banging until it works

Features:

Notes about Usability

The project was written mainly for my personal usage so there was more hardcoding that I would like for a driver but I have also attempted to make it flexible where possible, you are welcome to add more abstractions to make it look nicer

Documentations

There is doxygen docs of the LcdDriver class here:

Doxygen Docs

Check TivaWare documents(included with the full TivaWare) for other stuffs

References and Helpful Resources

HD44780 datasheet, similar but not the same

The 1602 datasheet

Custom character generator(Necessary if you want to create your own character)

Building the project

This is a code composer studio(ccs) project so simply cloning and importing it and then set the SW_ROOT inside the project properties to the TivaDep directory would be enough, for example: my SW_ROOT variable is /path/to/this_repo/Tivaware_Dep, for version 8.2.0.00007, the project builds successfully

Building the project using something other than ccs is not guaranteed because TivaWare doesn't play nicely with other IDE from my experience(unless you go through and fix every single include errors)

If you look at the .gitignore of the project, you would see only a fraction of ignore files that usually go into C/C++ and Eclipse project, it was intentional since ccs won't build if I ignore other stuffs, so to play it safe, I only ignore files that are guaranteed to be unimportant

Another note is that if you haven't, you should increase the stacksize allowed by ccs to make sure no weird errors happen

Project structure

Example

For examples of most of the features, check the main.cpp file in the src dir

Adding and Using Custom Character

While most of the projects are documented in doxygen, adding custom character is a little special since it requires external help, you should go to https://omerk.github.io/lcdchargen/, create your pattern then grab the array from there

Then in your code:

LcdConfig lcdConfig; // create config struct
// ... edit the config struct
// creating and preparing the driver
auto lcdDriver = LcdDriver(lcdConfig);
lcdDriver.init();
lcdDriver.enable();
// paste the array you got from the website above here
uint8_t charPattern2[] = {0b10000, 0b01000, 0b01011, 0b01110, 0b01010, 0b00010, 0b00010, 0b00010};
lcdDriver.newCustomCharAdd(charPattern2, 2); // uses slot 2 for the pattern, you are set to use after this
// using the custom pattern
lcdDriver.displayWrite("Pattern: `2"); // `2 will be replaced with the pattern you just added on the LCD
// the pattern should be printed on the lcd after this