Skip to content

sunriax/.matrix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Version: 1.0 Release License: GPL v3

. Matrix Display Controller

PCB

The MDC (Matrix Display Controller) is to interact with a dot matrix display (like the Kingbright TA20) over SPI bus or UART (See the command list below).

Board

Download Description
Schematic Complete Schematic of the Display
KiCAD KiCAD files
Gerber Gerber production and drill files

3D Model

TOP BOT
PCB Top PCB Bot

Agenda

Board Status
Schematic ✔️ Done
Board ✔️ Done
Partlist ✔️ Done
Production ✔️ Done
Assembly ✔️ Done
Case ❌ Open

Firmware Build Status

Image Download
Display zip / tar.gz
Demo (ATmega16) zip / tar.gz

Display

The display can be driven in two modes either the standard (spi) mode or the uart mode.

SPI mode

The display can be controlled with the matrix library. The library can be found in the TEST project. The library is modular and can be adapted onto other plattforms. For platform adaptions the spi library has to be rewritten for the target platform. Currently the library can be used with an ATmega16A.

Startup

// User libraries
#include "matrix/matrix.h"

// ...
int main(void)
{
	matrix_init();
	_delay_ms(1000);
	matrix_clear_all();
	_delay_ms(1000);
}

Standard commands

Command Description
matrix_init() Initializes the display
matrix_buffer(0-255, ARRAY) Send an array (5*7) bits to a specific display
matrix_buffer_all(ARRAY) Send an array (5*7) bits to all displays
matrix_char(0-255, ASCII) Send an ASCII char to a specific display
matrix_string(STRING) Send an ASCII string to a all display
matrix_clear(0-255) Clear a specific display
matrix_clear_all() Clear all displays

Speical commands

Define VALUE Description
MATRIX_EEPROM_CHAR0 0x00 EEPROM address of MEMORY 0
MATRIX_EEPROM_CHAR0 0x01 EEPROM address of MEMORY 1
... ... ...
MATRIX_EEPROM_CHAR0 0x0E EEPROM address of MEMORY E
MATRIX_EEPROM_CHAR0 0x0F EEPROM address of MEMORY F
Command Description
matrix_prom_write(0-255, DEFINE, ARRAY) Save an array (5*7) to the display EEPROM
matrix_prom_read(0-255, DEFINE) Load an array from EEPROM to the display

Example

// TEST Connection
//
//          uC                 DISPLAY 0              DISPLAY 1
//  ~~~~~~~~~~~~~~~~~+    +~~~~~~~~~~~~~~~~~+    +~~~~~~~~~~~~~~~~~+
//    A  (M)         |    |                 |    |                 |
//    T  (E)     VCC +----+ VCC         VCC +----+ VCC         VCC |
//    M  (G)         |    |                 |    |                 |
//    E  (A)    MOSI +----+ MOSI       MISO +----+ MOSI       MISO |
//    G  (C)     SCK +----+ SCK         SCK +----+ SCK         SCK |
//    A  (A)      SS +----+ SS           SS +----+ SS           SS |
//    1  (R)     GND +----+ GND         GND +----+ GND         GND |
//    6  (D)         |    |                 |    |                 |
//    A              |    +~~~~~~~~~~~~~~~~~+    +~~~~~~~~~~~~~~~~~+
//  ~~~~~~~~~~~~~~~~~+

#define F_CPU 12000000UL    // System clock (required for delay)

// System libraries
#include <avr/io.h>
#include <util/delay.h>

// User libraries
#include "matrix/matrix.h"

// ...
int main(void)
{
	matrix_init();
	_delay_ms(1000);
	matrix_clear_all();
	_delay_ms(1000);

    unsigned char buffer[] = {
		0b01000,
		0b01000,
		0b01000,
		0b01000,
		0b01000,
		0b01000,
		0b11111
	}; 

    // Send buffer to display 0
    matrix_buffer(0, buffer);
	_delay_ms(1000);

    // Send buffer to all displays
    matrix_buffer_all(buffer);
	_delay_ms(1000);

    // Send ASCII char to display 0
    matrix_char(0, 'A');
	_delay_ms(1000);

    // Send string to displays
    matrix_string(0, "TEST");
	_delay_ms(1000);

    // Clear display 0
    matrix_clear(0);
	_delay_ms(1000);

    // Clear all displays
    matrix_clear_all();
	_delay_ms(1000);

    // !!! Only one time necessary !!!
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    // !!! Warning:                                    !!!
    // !!! Don´t call this function in a while(1) loop !!!
    // !!! This will damage the EEPROM                 !!!
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    // Save buffer in display EEPROM
	matrix_prom_write(0, MATRIX_EEPROM_CHAR0, buffer);
	_delay_ms(1000);

    // Read data from EEPROM
    matrix_prom_read(0, MATRIX_EEPROM_CHAR0);
	_delay_ms(1000);
}

UART mode

The standard ASCII characters can also be transferred to display over UART. Therefore a special configuration is necessary. Pin SS should be connected to ground (GND) before powering the display.

// TEST Connection
//
//           DISPLAY 0              USB/UART
//      +~~~~~~~~~~~~~~~~~+   +~~~~~~~~~~~~~~~~~+
//      |                 |   |                 |
//      + VCC         VCC +---+ VCC             |
//      |                 |   |             +---+
//      + MOSI       MISO +---+ TXD         | U |
//      + SCK         SCK +   |             | S |
//  +---+ SS           SS +   |             | B |
//  +---+ GND         GND +---+ GND         +---+
//      |                 |   |                 |
//      +~~~~~~~~~~~~~~~~~+   +~~~~~~~~~~~~~~~~~+

Characters can be sent to the display over TeraTerm or Putty UART should contain following setup:

Parameter Value
Baudrate 9600
Datasize 8 Bit
Parity None
Stopbits 1