SPI Backpack PCB for Liquid Crystal Displays: Part 4 LCD library
Adafruit’s LiquidCrystal backpack library doesn’t use the Arduino SPI library to send data to the 74HC595 chip. They just shiftOut bits directly, which works fine if the only device is the backpack. However, the fazjaxton CAN library does call the SPI library. This caused major problems when switching back and forth between CAN and LCD because the clock rates were way different.
I decided to investigate the LCD 74HC595 SPI implementation by Juan Hernandez from the Arduino playground which uses the Arduino SPI. It took quite a bit of time to get that library working because Hernandez uses a different pinout connection from the ‘595 chip, and did not have the LCD backlight control. Since I already have the PC board cut for the Adafruit pinout, I had to figure out how to rearrange the Hernandez code. Once I finally got his HelloWorld-SPI demo working though, it was simple to add the backlight bit, and I could modify the head end sketch to match. I changed the LCD code to use the same SPI clock rate as the CAN and they play together very well now.
This is the backpacked head end with new code displaying light level and temperature from remote station 31.