In Day 3 tutorial, we learnt basics of seven segment LED displays and discussed about a time-division multiplexing technique that reduces the number of required microcontroller I/O pins to drive multiple seven segment LED displays. Today we will move a step further and discuss about a serial interface (SPI) for driving 8 seven segment LED displays. The technique uses MAXIM’s MAX7219 LED driver chip that allows you to control 8 (or more in cascade configuration) common-cathode seven segment LED displays with only 3 I/O pins of Netduino. For illustrative purpose, we will use our 8-digit serial seven segment LED (8DSSSLED) display module here. The benefit of using MAX7219 is, it will do all the hard work of multiplexing operation and let the microcontroller do more important jobs. It supports SPI serial communication protocol.
Circuit Setup and Theory
The SPI communication method is the heart of the project besides the codes that controls what to display in the seven segments LED. In our setup, Netduino Plus acts as a SPI Master device and 8DSSSLED as a Slave. Among the several digital I/O pins of Netduino, Pins 11, 12 and 13 are designed to support the SPI Bus communication. Pin 12 is Master In Slave Out (MISO), pin 11 is Master Out Slave In (MOSI), and pin 13 serves as the master clock. In our project the Netduino Plus does not receive any data back from the slave device (MAX7219), so the MISO pin is unused. The MOSI pin (11) of Netduino goes to DIN of 8DSSSLED and pin 13 drives the CLK signal of MAX7219. The LOAD signal (which is a Chip Select pin of MAX7219) of the 8DSSSLED board can be connected to any Digital I/O of a microcontroller. In our case we have specified this to pin 10 of Netduino.
Since the circuit diagram and all the necessary details of 8DSSSLED is well explain here so allow me not to reinvent the wheel.
The program basically focused around the MAX7219 drive then tailored towards the 8DSSSLED. The .NET Micro FramWork provides a SPI class so we don’t have to worry too much about working with SPI. We will learn more about the SPI in a moment. Let’s look at the overview of this class. All the methods and properties can be seen in the picture below. The MAX7219 class, most of the time, disables the BCDDecode mode and hence, controls individual segments to display alphanumeric characters.
For more detail: Netduino and MAX721 interfacing for driving seven segment LED displays