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:
- a 4 bits input data bus to receive a BCD digit (DATA_0-3);
- a 2 bits input address bus to address one of four digit registers (SEL_0-1);
- an input signal to write the digit to the selected digit register. The data and the address must be valid when the write signal is activated (SEL_WE).
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
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.