Thursday, July 16, 2020

Interfacing ATMega32 to MAX7221 LED display driver

Interfacing ATMega32 to MAX7221 LED display driver

MAX7221 SPI 8-Digit LED Display Driver

A master ATMega32 SPI could send data to many SPI slave devices on bus. MAX7221 is another example of an SPI slave device. MAX7221 is an 8-digit display driver. It could fit multiplexed seven-segment display, or a 8x8 dot matrix display. Both seven-segment and dot matrix display are common cathode. For more digits we can use a daisy-chain with preferred numbers of MAX7221.

Interfacing ATMega32 to MAX7221 LED display driver
A sample simulation of this example

This device work independently. The master MCU configures and send the data only once. Then MAX7221 periodically displays and refresh by itself.

Interfacing ATMega32 to MAX7221 LED display driver
MAX7221 28-DIP Package
These are its pins description:

Interfacing ATMega32 to MAX7221 LED display driver
Pin description of MAX7221

The data for format for MAX7221 reception is 16-bit wise, and device into two 8-bit registers.

Interfacing ATMega32 to MAX7221 LED display driver
Command register uses only 4 lower nibble.

I don't list all datasheet full specification here. I list only some needed technical details.
Every command register has its own address. We must load these address with any appropriate values.

Interfacing ATMega32 to MAX7221 LED display driver
MAX7221 Register Map


These commands with value I selected:
  1. The 0x09 command register loads with 0xFF to enable BCD decoding for all digits.
  2. The 0x0B command register loads with 0x01 to limit the scanning for only digit 0 and 1.
  3. The 0x0C command register loads with 0x01 to turn on the device (called normal operation).
  4. The 0x0A command register loads with 0x09 to set the intensity to 10/16.
  5. All digits have its own command register ranges from 0x01 to 0x08. We load these command registers to display the value. The value could be a BCD format or anythings, up to the pre-setting.
In this example, I turn on only two digits. This two-digit display show the counting value at one second rate.

Interfacing ATMega32 to MAX7221 LED display driver
A sample of program

ATMega32 C Source Code In Atmel Studio 7

The Atmel Studio 7 C source code is here.

A full schematic diagram lists below.

Interfacing ATMega32 to MAX7221 LED display driver
Schematic Diagram




1 comment:

Search This Blog

Labels

25AA010A (1) 8051 (7) 93AA46B (1) ADC (30) Analog Comparator (1) Arduino (15) ARM (6) AT89C52 (7) ATMega32 (54) AVR (57) CCS PICC (28) DAC (1) DHT11 (2) Display (105) Distance Sensor (3) DS18B20 (3) dsPIC (2) dsPIC30F1010 (2) EEPROM (5) Environment Sensor (4) esp8266 (1) I2C (29) Input/Output (67) Interrupt (19) Keil (5) Keypad (10) LCD (46) Master/Slave (1) MAX7221 (1) MCP23017 (5) MCP23S17 (4) Meter (3) MikroC (2) Motor (15) MPLABX (66) Nokia 5110 LCD (3) OLED (2) One-Wire (6) Oscillator (8) PCB (6) PCD8544 (3) PCF8574 (5) PIC (107) PIC12F (2) PIC16F628A (2) PIC16F630 (1) PIC16F716 (3) PIC16F818 (10) PIC16F818/819 (2) PIC16F84A (15) PIC16F876A (1) PIC16F877A (9) PIC16F88 (1) PIC16F887 (60) PIC18 (19) PIC18F1220 (4) PIC18F2550 (3) PIC18F4550 (12) PWM (11) RTC (8) Sensor (10) SH1106 (1) Shift Register (11) Shift Registers (2) SPI (24) STM32 (6) STM32 Blue Pill (6) STM32CubeIDE (6) STM32F103C8T6 (6) SysTick (3) temperature sensor (11) Thermometer (21) Timer/Counter (30) TM1637 (2) UART (7) Ultrasonic (4) Voltmeter (7) WDT (1) XC16 (2) XC8 (94)