中级
30 分钟

使用基于IS31FL3733和STM32F031K6的绿色LED矩阵体验无限可能的画布

绿色光辉盛宴

16x12 G Click with Nucleo 32 with STM32F031K6 MCU

已发布 10月 01, 2024

点击板

16x12 G Click

开发板

Nucleo 32 with STM32F031K6 MCU

编译器

NECTO Studio

微控制器单元

STM32F031K6

点亮您的想象力,用我们的16x12绿色LED矩阵为您的项目注入环保的辉煌。在这里,每个像素都是创造动态、节能的视觉效果的机会,可以吸引、传达信息并激发灵感。

A

A

硬件概览

它是如何工作的?

16x12 G Click搭载了一个16x12 LED显示屏和IS31FL3733矩阵驱动器。该点击设计为在3.3V或5V电源供应下运行。它通过I2C接口与目标微控制器通信,并通过mikroBUS™线上的INT、RST和CS引脚提供附加功能。每个LED可以单独控制开关状

态和光强度。IS31FL3733是一个通用的12×16 LED矩阵驱动器,具有1/12的周期速率。每个LED可以通过8位PWM数据单独调光,实现256级的线性调光。该驱动器具有可选择的3种自动呼吸模式(ABM-1、ABM-2和ABM-3)用于每个LED。这个Click

 board™可以通过VCC SEL跳线选择3.3V或5V逻辑电压电平。这样,既支持3.3V又支持5V的MCU可以正确使用通信线路。此外,这个Click board™配备了一个包含易于使用的功能和示例代码的库,可作为进一步开发的参考。

16x12 G Click top side image
16x12 G Click bottom side image

功能概述

开发板

Nucleo 32开发板搭载STM32F031K6 MCU,提供了一种经济且灵活的平台,适用于使用32引脚封装的STM32微控制器进行实验。该开发板具有Arduino™ Nano连接性,便于通过专用扩展板进行功能扩展,并且支持mbed,使其能够无缝集成在线资源。板载集成

ST-LINK/V2-1调试器/编程器,支持通过USB重新枚举,提供三种接口:虚拟串口(Virtual Com port)、大容量存储和调试端口。该开发板的电源供应灵活,可通过USB VBUS或外部电源供电。此外,还配备了三个LED指示灯(LD1用于USB通信,LD2用于电源

指示,LD3为用户可控LED)和一个复位按钮。STM32 Nucleo-32开发板支持多种集成开发环境(IDEs),如IAR™、Keil®和基于GCC的IDE(如AC6 SW4STM32),使其成为开发人员的多功能工具。

Nucleo 32 with STM32F031K6 MCU double side image

微控制器概述 

MCU卡片 / MCU

default

建筑

ARM Cortex-M0

MCU 内存 (KB)

32

硅供应商

STMicroelectronics

引脚数

32

RAM (字节)

4096

你完善了我!

配件

Click Shield for Nucleo-32是扩展您的开发板功能的理想选择,专为STM32 Nucleo-32引脚布局设计。Click Shield for Nucleo-32提供了两个mikroBUS™插座,可以添加来自我们不断增长的Click板™系列中的任何功能。从传感器和WiFi收发器到电机控制和音频放大器,我们应有尽有。Click Shield for Nucleo-32与STM32 Nucleo-32开发板兼容,为用户提供了一种经济且灵活的方式,使用任何STM32微控制器快速创建原型,并尝试各种性能、功耗和功能的组合。STM32 Nucleo-32开发板无需任何独立的探针,因为它集成了ST-LINK/V2-1调试器/编程器,并随附STM32全面的软件HAL库和各种打包的软件示例。这个开发平台为用户提供了一种简便且通用的方式,将STM32 Nucleo-32兼容开发板与他们喜欢的Click板™结合,应用于即将开展的项目中。

Click Shield for Nucleo-32 accessories 1 image

使用的MCU引脚

mikroBUS™映射器

NC
NC
AN
Reset
PA11
RST
Standby Mode
PA4
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
NC
NC
PWM
Interrupt
PA12
INT
NC
NC
TX
NC
NC
RX
I2C Clock
PB6
SCL
I2C Data
PB7
SDA
Power Supply
5V
5V
Ground
GND
GND
1

“仔细看看!”

Click board™ 原理图

16x12 G Click Schematic schematic

一步一步来

项目组装

Click Shield for Nucleo-144 front image hardware assembly

从选择您的开发板和Click板™开始。以Nucleo 32 with STM32F031K6 MCU作为您的开发板开始。

Click Shield for Nucleo-144 front image hardware assembly
Nucleo 144 with STM32L4A6ZG MCU front image hardware assembly
Stepper 22 Click front image hardware assembly
Prog-cut hardware assembly
Stepper 22 Click complete accessories setup image hardware assembly
Board mapper by product8 hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
STM32 M4 Clicker HA MCU/Select Step hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware assembly

软件支持

库描述

这个库包含了16x12 G Click的API。

关键函数:

  • c16x12g_display_image - 显示图像的函数

  • c16x12g_display_byte - 显示一个字节的函数

  • c16x12g_display_text - 带滚动功能的文本显示函数

开源

代码示例

完整的应用程序代码和一个现成的项目可以通过NECTO Studio包管理器直接安装到NECTO Studio 应用程序代码也可以在MIKROE的GitHub账户中找到。

/*!
 * \file 
 * \brief 16x12 Click example
 * 
 * # Description
 * This application draw image on the led matrics.
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initialization default device configuration, sets LED mode, 
 * configuration ABM and display one character.
 * 
 * ## Application Task  
 * Clear display, display one by one leds, display one character,
 * display image and display text with scroll.
 * 
 * \author MikroE Team
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "c16x12.h"

// ------------------------------------------------------------------ VARIABLES

static c16x12_t c16x12;
static log_t logger;

static uint8_t scroll_speed = 50;
static c16x12_abm_t abm_1;
static c16x12_abm_t abm_2;


char demo_text[ 7 ] = "MikroE";
uint16_t demo_image_light[ 12 ] = 
{ 0x0000, 0x0666, 0x0CCC, 0x1998, 0x3330, 0x6660, 0x3330, 0x1998, 0x0CCC, 0x0666, 0x0000, 0x0000 };
uint16_t demo_image_dark[ 12 ]  = 
{ 0xFFFF, 0xF999, 0xF333, 0xE667, 0xCCCF, 0x999F, 0xCCCF, 0xE667, 0xF333, 0xF999, 0xFFFF, 0xFFFF };

char name[] = "16x12";


// ------------------------------------------------------ APPLICATION FUNCTIONS

void application_init ( void )
{
    log_cfg_t log_cfg;
    c16x12_cfg_t cfg;

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, "---- Application Init ----" );

    //  Click initialization.

    c16x12_cfg_setup( &cfg );
    C16X12_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    c16x12_init( &c16x12, &cfg );

    c16x12g_device_reset( &c16x12 );
    Delay_ms ( 1000 );

    c16x12_default_cfg( &c16x12 );
    c16x12g_set_global_current_control( &c16x12, 255 );
    c16x12g_set_leds_mode( &c16x12, C16X12G_LED_MODE_ABM1 );

    abm_1.time_1     = C16X12G_ABM_T1_840MS;
    abm_1.time_2     = C16X12G_ABM_T2_840MS;
    abm_1.time_3     = C16X12G_ABM_T3_840MS;
    abm_1.time_4     = C16X12G_ABM_T4_840MS;
    abm_1.loop_begin = C16X12G_ABM_LOOP_BEGIN_T1;
    abm_1.loop_end   = C16X12G_ABM_LOOP_END_T3;
    abm_1.loop_times = C16X12G_ABM_LOOP_FOREVER;
    
    abm_2.time_1     = C16X12G_ABM_T1_210MS;
    abm_2.time_2     = C16X12G_ABM_T2_0MS;
    abm_2.time_3     = C16X12G_ABM_T3_210MS;
    abm_2.time_4     = C16X12G_ABM_T4_0MS;
    abm_2.loop_begin = C16X12G_ABM_LOOP_BEGIN_T1;
    abm_2.loop_end   = C16X12G_ABM_LOOP_END_T3;
    abm_2.loop_times = C16X12G_ABM_LOOP_FOREVER;
    
    c16x12g_config_abm( &c16x12, C16X12G_ABM_NUM_1, &abm_2 );
    c16x12g_start_abm( &c16x12 );
    c16x12g_display_text( &c16x12, &name[ 0 ], 5, scroll_speed );

    c16x12g_config_abm( &c16x12, C16X12G_ABM_NUM_1, &abm_1 );
    c16x12g_start_abm( &c16x12 );
    c16x12g_display_byte( &c16x12, 'G' );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    
    c16x12g_config_abm( &c16x12, C16X12G_ABM_NUM_1, &abm_2 );
    c16x12g_start_abm( &c16x12 );
}

void application_task ( void )
{
    uint8_t cnt = 0;
    
    c16x12g_display_text( &c16x12, &demo_text[ 0 ], 6, scroll_speed );

    c16x12g_clear_display( &c16x12 );

    // Display point
    for ( cnt = 1; cnt <= 12; cnt++ )
    {
        c16x12g_set_led( &c16x12, cnt, cnt, C16X12G_LED_STATE_ON, C16X12G_STOP_SETTINGS );
        Delay_ms ( 100 );
    }
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );

    c16x12g_display_image( &c16x12, &demo_image_light[ 0 ] );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
     
    c16x12g_display_image( &c16x12, &demo_image_dark[ 0 ] );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
}

int main ( void ) 
{
    /* Do not remove this line or clock might not be set correctly. */
    #ifdef PREINIT_SUPPORTED
    preinit();
    #endif
    
    application_init( );
    
    for ( ; ; ) 
    {
        application_task( );
    }

    return 0;
}


// ------------------------------------------------------------------------ END

额外支持

资源

喜欢这个项目吗?

'购买此套件' 按钮会直接带您进入购物车,您可以在购物车中轻松添加或移除产品。