Select Page

LED dot matrix display

Objective:

1. LED matrix should be interfaced with SPI and DMA

2. An area in RAM is designated as video buffer

3. There should be a library of font based character rendering on to the buffer space


LED Dot Matrix Display:

The LED Dot Matrix used is MAX 7219 Common Cathode type(data sheet link given below)

https://datasheets.maximintegrated.com/en/ds/MAX7219-MAX7221.pdf

In a LED dot matrix display the LEDs are located at the column and row intersections of the matrix. LEDs in the same row are connected together as are LEDs in the same column. Figure 1 shows common cathode configurations for LED matrix display.

 

 

 

 

 

 

 

 

 

 

 


MAX7219:

 

 

 

 

 

 

 

 

 

 

Figure 2 shows register map of MAX 7219. To perform an operation, particular register is selected and 8bit data is passed. MAX 7219 uses SSI for receiving data from micro-controller. In order to display a letter on Dot matrix, one row is selected at a time and bitstream is passed to make LEDs ON and OFF corresponding to letter to display. Then next row is selected and bitstream is passed. In order to display a letter continuously rows are multiplexed at a rate of 800Hz to 1000Hz.

Figure 3 shows the format in which we must send data to MAX 7219. Data frame is of 16 bits. Bits[15-12] are don’t care bits followed by four control bits. Control bits will be used for selecting one of the registers in MAX 7219. Then remaining 8 bits[7-0] will be data to loaded in corresponding register.


Bit Pattern For all the Alphabets:

Bit pattern for the all the Alphabets(capital and small) is stored in a library as shown below. Depending on the letter library is traversed and 64-bit bitstream is identified. This bitstream is then given to SSI as discussed earlier.

unsigned char eng_cap[][8] = {

                          {0x0, 0x3c, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66},//A
                          {0x0, 0x3e, 0x66, 0x66, 0x3e, 0x66, 0x66, 0x3e},//B
                          {0x0, 0x3c, 0x66, 0x06, 0x06, 0x06, 0x66, 0x3c},//C
                          {0x0, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3e},//D
                          {0x0, 0x7e, 0x6, 0x6, 0x3e, 0x6, 0x6, 0x7e},//E
                          {0x0, 0x7e, 0x6, 0x6, 0x3e, 0x6, 0x6, 0x6},//F
                          {0x0, 0x3c, 0x66, 0x6, 0x6, 0x76, 0x66, 0x3c},//G
                          {0x0, 0x66, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66},//H
                          {0x0, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c},//I
                          {0x0, 0x78, 0x30, 0x30, 0x30, 0x36, 0x36, 0x1c},//J
                          {0x0, 0x66, 0x36, 0x1e, 0xe, 0x1e, 0x36, 0x66},//K
                          {0x0, 0x6, 0x6, 0x6, 0x6, 0x6, 0x6, 0x7e},//L
                          {0x0, 0xc6, 0xee, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6},//M
                          {0x0, 0xc6, 0xce, 0xde, 0xf6, 0xe6, 0xc6, 0xc6},//N
                          {0x0, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c},//O
                          {0x0, 0x3e, 0x66, 0x66, 0x66, 0x3e, 0x6, 0x6},//P
                          {0x0, 0x3c, 0x66, 0x66, 0x66, 0x76, 0x3c, 0x60},//Q
                          {0x0, 0x3e, 0x66, 0x66, 0x3e, 0x1e, 0x36, 0x66},//R
                          {0x0, 0x3c, 0x66, 0x06, 0x3c, 0x60, 0x66, 0x3c},//S
                          {0x0, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18},//T
                          {0x0, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c},//U
                          {0x0, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18},//V
                          {0x0, 0xc6, 0xc6, 0xc6, 0xd6, 0xfe, 0xee, 0xc6},//W
                          {0x0, 0xc6, 0xc6, 0x6c, 0x38, 0x6c, 0xc6, 0xc6},//X
                          {0x0, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18},//Y
                          {0x0, 0x7e, 0x60, 0x30, 0x18, 0xc, 0x6, 0x7e}//Z

}; unsigned char eng_small[][8] = {

                            0x0, 0x0, 0x0, 0x3c, 0x60, 0x7c, 0x66, 0x7c,//a
                            0x0, 0x6, 0x6, 0x6, 0x3e, 0x66, 0x66, 0x3e,//b
                            0x0, 0x0, 0x0, 0x3c, 0x66, 0x6, 0x66, 0x3c,//c
                            0x0, 0x60, 0x60, 0x60, 0x7c, 0x66, 0x66, 0x7c,//d
                            0x0, 0x0, 0x0, 0x3c, 0x66, 0x7e, 0x6, 0x3c,//e
                            0x0, 0x38, 0x6c, 0xc, 0xc, 0x3e, 0xc, 0xc,//f
                            0x0, 0x0, 0x7c, 0x66, 0x66, 0x7c, 0x60, 0x3c,//g
                            0x0, 0x6, 0x6, 0x6, 0x3e, 0x66, 0x66, 0x66,//h
                            0x0, 0x0, 0x18, 0x0, 0x18, 0x18, 0x18, 0x3c,//i
                            0x0, 0x30, 0x0, 0x30, 0x30, 0x36, 0x36, 0x1c,//j
                            0x0, 0x6, 0x6, 0x66, 0x36, 0x1e, 0x36, 0x66,//k
                            0x0, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,//l
                            0x0, 0x0, 0x0, 0xc6, 0xee, 0xfe, 0xd6, 0xd6,//m
                            0x0, 0x0, 0x0, 0x3e, 0x7e, 0x66, 0x66, 0x66,//n
                            0x0, 0x0, 0x0, 0x3c, 0x66, 0x66, 0x66, 0x3c,//o
                            0x0, 0x0, 0x3e, 0x66, 0x66, 0x3e, 0x6, 0x6,//p
                            0x0, 0x0, 0x3c, 0x36, 0x36, 0x3c, 0xb0, 0xf0,//q
                            0x0, 0x0, 0x0, 0x3e, 0x66, 0x66, 0x6, 0x6,//r
                            0x0, 0x0, 0x0, 0x7c, 0x2, 0x3c, 0x40, 0x3e,//s
                            0x0, 0x0, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x18,//t
                            0x0, 0x0, 0x0, 0x66, 0x66, 0x66, 0x66, 0x7c,//u
                            0x0, 0x0, 0x0, 0x0, 0x66, 0x66, 0x3c, 0x18,//v
                            0x0, 0x0, 0x0, 0xc6, 0xd6, 0xd6, 0xd6, 0x7c,//w
                            0x0, 0x0, 0x0, 0x66, 0x3c, 0x18, 0x3c, 0x66,//x
                            0x0, 0x0, 0x0, 0x66, 0x66, 0x7c, 0x60, 0x3c,//y
                            0x0, 0x0, 0x0, 0x3c, 0x30, 0x18, 0x0c, 0x3c//z

};


uDMA:

Tiva TM4C123GH6PM Microcontroller has a inbuilt micro-DMA (uDMA). This uDMA offers following features: – Highly flexible and configurable channel operation

– Ping-pong for continuous data flow and Scatter-gather for a programmable list of up to 256 arbitrary transfers initiated from a single request

– Two levels of priority

– Data sizes of 8, 16, and 32 bits

– Transfer size is programmable in binary steps from 1 to 1024

The transfer mode used in this implementation is Ping-pong mode. So, in this mode there will be two buffers used. Once primary buffer is transmitted SSI will interrupt uDMA. Then in the interrupt handler we must initialize secondary buffer. This has to be done repeatedly to send data continuously to Led Dot Matrix.


Final Output:

Scrolling text can be displayed by performing bitwise right shift for bitstream corresponding to each letter periodicaly.


Source Code Link:

1. LED Dot Matrix Code: https://github.com/krushnakant-pawar/tiva.git

2. Memory to Memory data transfer using DMA: https://github.com/krushnakant-pawar/dma.git