STLED316S (56 LEDs max), Keyboard scan (16 keys max)

The STM ST316S LED controller supports 6 Digits @ 8 Segments and 8 separate LEDs. Also supports a scanned keyboard of upto 16 keys. SPI bus interface.

Hello World

Import programmbed_STLED316S

Testprogram for STLED316S driver lib SPI Interface


Import librarySTLED316S

LED Driver, 6 digits @ 8 segm, 8 LEDs, 16 Keys. SPI Interface




This LED driver is found in frontpanel controllers of consumer electronics such as DVD and Microwave ovens. The added features such as the matrix keyboard scanning are useful in these applications. The typical application schematic is shown in the datasheet and in the documentation of evaluation boards referenced below.

The STLED316S has a single pin for Data input (commands, LED segments) and Data output (key status). This pin can be connected to mbed SPI MOSI and MISO using a series/pull-up resistor.


The example code was tested on a prototype module with 6 seven segment displays + decimal point, 3 LEDs and 3 switches. /media/uploads/wim/st316_test.jpg

The library supports printf style methods to display int, hex and float. LEDs may be set and cleared, cursor locate, display clear and brightness setting are available, keys can be read back and tested. The lib supports a 7 segment approximation of alphanumeric characters, which can represent most characters reasonably well.

The device is available on several evaluation modules that are sold on the internet. Here are some examples:

Select the target module by enabling one of the #defines in STLED316S_Config.h

// Select one of the testboards for the STM STLED316S LED controller
#define STLED316S_TEST  0
#define ST316BOARD_TEST 1 

Note that the STLED316 is very similar to LED (eg PT6964) and VFD controllers (eg PT6312) by the same and other vendors. See here. The STLED316S offers the additional feature of setting different brightness levels for each of the 6 digits. The 8 LEDs can also all have individual and independent brightness levels.


You need to log in to post a discussion