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.

LCD display at head end node

LCD display at head end node

Advertisements
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: