Raspberry Pi and the 8-Digit LED MAX7219 Display Driver
The program presented below will allow Raspberry in Python and setup a MAX7219 display driver to act as a four digit counter. The program was ported over from Arduino C to illustrate how coding can be reused.
The MAX7219 display driver can drive 8 digit multiplexed LED display or a 8X8 LED matrix. This is setup in software. It includes selectable internal binary-coded-decimal (BCD) decoding which is used here.
It can also be cut on/off by a single command, the number of digits displayed, and intensity are all selectable in software. See "def initMAX7219()" below.
Refer to the block diagram above. 16-bit data input is broken into 2 8-bit data bytes the first being an address and the second being data. Using the function writeMAX7219(digit, k) digit is the digit value and k is position pointer.
For example assuming BCD mode and digit = 1 and k = 1 a one will be displayed on the far right of the display. writeMAX7219(digit, k) uses ssrOut() twice.
BCD code is limited to 0-9. Here we take a for loop where i counts from 0-999. Each iteration the value of i is sent to j which the MOD function j with 10 returns remainder value of 0-9.
The position and value are output to the display. The j is then divided by 10. This done 4 times to cover all four digits. Then i will increment and the process will begin again.
In the next section we will use the Python time and datetime function to create a LED real time clock.
The code is rpi_count1.txt
- Electronics hacks:
- Interface I2C LCD to Raspberry Pi in C
- ADS1115 4-Channel ADC Uses I2C with Raspberry Pi
- MCP4725 12-Bit DAC Interface to Raspberry Pi
- WiringPi and Pulse-Width-Modulation with Raspberry Pi
- WiringPi for Raspberry Pi and MAX6675 thermal-couple sensor
- WiringPi Blink an LED Demo
- Simple GPIO Reference Box
- Raspberry Pi with PCF8591 Analog To Digital Control in C
- Raspberry Pi PCF8591 AD-DA Sensor Python Interface
- Connect-Program Raspberry Pi and a MM5451 LED Display Driver
- Raspberry Pi Python RTC with MAX7219 Display Driver
- Raspberry Pi and the 8-Digit LED MAX7219 Display Driver
- Programming Raspberry Pi and the 74HC595 Serial Shift Register
- Web Master
- Gen. Electronics
- YouTube Channel
- Arduino Projects
- Raspberry Pi & Linux
- PIC18F2550 in C
- PIC16F628A Assembly
- PICAXE Projects
- Bristol VA/TN
- US Constitution
- Religious Themes
- Religion Archive 1