Close

Custom controller for a 7-segments display. Project example

A project log for Arduino + CPLD = CPLD Fun Board!

Homemade low cost CPLD dev board (Arduino STM32F103 and Altera MAX II EPM240/EPM570 CPLD). Two dev boards into one.

Just4FunJust4Fun 11/02/2017 at 22:050 Comments

This is a ready to use example of a custom controller for a 4 digits 7-segments BCD led display.

To make things easier, in this example it is used the schematic editor and the 7400 devices family library, but note that this is not the best way to use a CPLD (the right way is to use VHDL/Verilog languages...).

The custom controller has four registers (74175) to store the BCD digits, and drives a 4 digit BCD led display (already assembled on the board) with a BCD to 7-segments decoder (7449) using multiplexing. The input clock for the multiplex comes from the 36MHz clock (from the STM32 MCU), and is divided by two 1:256 dividers (74393).

The interface for the MCU is so composed:

Here it is the schematic of the controller configured inside the CPLD:


The complete Quartus II project can be downloaded from this file: H311017_7SegBCD.zip (the file is too big for this site, so it's stored externally).

Unzip it taking its directory structure, and open it from the main Quartus II menu with "File" -> "Open Project..." selecting the file .qpf


and double click on the file name to open the schematic editor:

Here it is the schematic editor with the loaded project:

Now upload the configuration into the CPLD as described in the Log: "Blink led example. Step by step guide".

Then upload the sketch S311017_7SegBCD.ino (in the "Files" section) in the STM32 MCU using the Arduino IDE to run an application example using the custom interface.

The result is shown in this short video:

Note that pressing the DEV_CLRn button all the registers inside the CPLD are cleared.

Discussions