xld0932 发表于 2024-8-5 12:18

基于MM32实现的通用段码液晶显示屏程序架构

本帖最后由 xld0932 于 2024-8-5 12:20 编辑

#申请原创#   @21小跑堂

1.概述
从之前分享的《解析SLCD例程设计思路,加速终端产品应用开发》一文中得到启发,在产品功能需求丰富的情况下,我们可以选择/评估MM32L0130这个集成了SLCD段码液晶显示屏驱动的系列MCU;但对于功能简单,对芯片成本要求又比较高时,选择分立器件或者是一个不错的选择;MM32推出的高性价比的MCU如MM32G0001系列,超值系列的MM32F0010\MM32F0020都是一个不错的选择;再结合当前SLCD显示驱动芯片的价格优势,整体成本可以做到1块钱以内。市面主比较应用的SLCD驱动芯片品牌有合泰的、深圳天微、无锡中微的等等,客户可以依据自己的功能需要,选择性价高的驱动芯片型号。

针对不同厂家的SLCD段码液晶显示屏的驱动芯片,其控制原理及接线方式都大同小异;为了方便程序移植、实现方便,我们基于MM32上面介绍到的3款芯片实现了一个通用的段码液晶显示屏程序架构,下面我们一起来详细的讲解一下。

2、硬件设计
2.1.基于MM32G0001的SLCD原理图


2.2.基于MM32F0010的SLCD原理图


2.3.基于MM32F0020的SLCD原理图


3.硬件实物



4.程序架构


5.程序实现(以MM32F0010为例)
5.1.SLCD驱动程序设计
#ifndef __SLCD_DRIVER_H
#define __SLCD_DRIVER_H

#ifdef __cplusplus
extern "C" {
#endif

#include <string.h>
#include "hal_conf.h"

#define SLCD_DRIVER_COM         (4)
#define SLCD_DRIVER_SEG         (32)

#define SLCD_DRIVER_CS_RCC      RCC_AHBENR_GPIOA
#define SLCD_DRIVER_CS_GPIO   GPIOA
#define SLCD_DRIVER_CS_PIN      GPIO_Pin_7

#define SLCD_DRIVER_WR_RCC      RCC_AHBENR_GPIOA
#define SLCD_DRIVER_WR_GPIO   GPIOA
#define SLCD_DRIVER_WR_PIN      GPIO_Pin_5

#define SLCD_DRIVER_DATA_RCC    RCC_AHBENR_GPIOA
#define SLCD_DRIVER_DATA_GPIO   GPIOA
#define SLCD_DRIVER_DATA_PIN    GPIO_Pin_4

#define SLCD_DRIVER_CS_H()      GPIO_WriteBit(SLCD_DRIVER_CS_GPIO, SLCD_DRIVER_CS_PIN, Bit_SET)
#define SLCD_DRIVER_CS_L()      GPIO_WriteBit(SLCD_DRIVER_CS_GPIO, SLCD_DRIVER_CS_PIN, Bit_RESET)

#define SLCD_DRIVER_WR_H()      GPIO_WriteBit(SLCD_DRIVER_WR_GPIO, SLCD_DRIVER_WR_PIN, Bit_SET)
#define SLCD_DRIVER_WR_L()      GPIO_WriteBit(SLCD_DRIVER_WR_GPIO, SLCD_DRIVER_WR_PIN, Bit_RESET)

#define SLCD_DRIVER_DATA_H()    GPIO_WriteBit(SLCD_DRIVER_DATA_GPIO, SLCD_DRIVER_DATA_PIN, Bit_SET)
#define SLCD_DRIVER_DATA_L()    GPIO_WriteBit(SLCD_DRIVER_DATA_GPIO, SLCD_DRIVER_DATA_PIN, Bit_RESET)

void SLCD_DRIVER_UpdateRAM(void);
void SLCD_DRIVER_ModifyRAM(uint8_t COMn, uint8_t SEGn, uint8_t State);
void SLCD_DRIVER_Fill(uint8_t Data);
void SLCD_DRIVER_Init(void);

#ifdef __cplusplus
}
#endif

#endif
#include "slcd_driver.h"

uint8_t SLCD_DRIVER_RAM;

void SLCD_DRIVER_InitGPIO(void)
{
    GPIO_InitTypeDef GPIO_InitStruct;

    /* CS */
    RCC_AHBPeriphClockCmd(SLCD_DRIVER_CS_RCC, ENABLE);

    GPIO_StructInit(&GPIO_InitStruct);
    GPIO_InitStruct.GPIO_Pin   = SLCD_DRIVER_CS_PIN;
    GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_InitStruct.GPIO_Mode= GPIO_Mode_Out_PP;
    GPIO_Init(SLCD_DRIVER_CS_GPIO, &GPIO_InitStruct);

    GPIO_WriteBit(SLCD_DRIVER_CS_GPIO, SLCD_DRIVER_CS_PIN, Bit_SET);

    /* WR */
    RCC_AHBPeriphClockCmd(SLCD_DRIVER_WR_RCC, ENABLE);

    GPIO_StructInit(&GPIO_InitStruct);
    GPIO_InitStruct.GPIO_Pin   = SLCD_DRIVER_WR_PIN;
    GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_InitStruct.GPIO_Mode= GPIO_Mode_Out_PP;
    GPIO_Init(SLCD_DRIVER_WR_GPIO, &GPIO_InitStruct);

    GPIO_WriteBit(SLCD_DRIVER_WR_GPIO, SLCD_DRIVER_WR_PIN, Bit_SET);

    /* DATA */
    RCC_AHBPeriphClockCmd(SLCD_DRIVER_DATA_RCC, ENABLE);

    GPIO_StructInit(&GPIO_InitStruct);
    GPIO_InitStruct.GPIO_Pin   = SLCD_DRIVER_DATA_PIN;
    GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_InitStruct.GPIO_Mode= GPIO_Mode_Out_PP;
    GPIO_Init(SLCD_DRIVER_DATA_GPIO, &GPIO_InitStruct);

    GPIO_WriteBit(SLCD_DRIVER_DATA_GPIO, SLCD_DRIVER_DATA_PIN, Bit_SET);
}

void SLCD_DRIVER_Write(uint16_t Data, uint8_t Bits)
{
    SLCD_DRIVER_CS_L();                /* CS--->L */

    for (uint8_t i = 0; i < Bits; i++)
    {
      SLCD_DRIVER_WR_L();            /* WR--->L */

      if ((Data << i) & 0x8000)
      {
            SLCD_DRIVER_DATA_H();      /* DATA->H */
      }
      else
      {
            SLCD_DRIVER_DATA_L();      /* DATA->L */
      }

      SLCD_DRIVER_WR_H();            /* WR--->H */
    }

    SLCD_DRIVER_CS_H();                /* CS--->H */
}

void SLCD_DRIVER_UpdateRAM(void)
{
    uint16_t Data = 0;

    for (uint8_t i = 0; i < SLCD_DRIVER_SEG; i++)
    {
      /*Write RAM : 101 a5a4a3a2a1a0 d0d1d2d3*/
      Data   = 0x05;
      Data <<= 0x06;

      Data|= (i & 0x3F);
      Data <<= 0x04;

      Data|= (SLCD_DRIVER_RAM & 0x0F);
      Data <<= 0x03;

      SLCD_DRIVER_Write(Data, 0x0D);
    }
}

void SLCD_DRIVER_ModifyRAM(uint8_t COMn, uint8_t SEGn, uint8_t State)
{
    if (State)
    {
      SLCD_DRIVER_RAM |=(0x01 << COMn);
    }
    else
    {
      SLCD_DRIVER_RAM &= ~(0x01 << COMn);
    }
}

void SLCD_DRIVER_Fill(uint8_t Data)
{
    memset(SLCD_DRIVER_RAM, Data, sizeof(SLCD_DRIVER_RAM));

    SLCD_DRIVER_UpdateRAM();
}

void SLCD_DRIVER_Init(void)
{
    SLCD_DRIVER_InitGPIO();

    memset(SLCD_DRIVER_RAM, 0, sizeof(SLCD_DRIVER_RAM));

    SLCD_DRIVER_Write(0x8020 /*0b 1000 0000 0010 0000*/, 0x0C); // SYS_EN
    SLCD_DRIVER_Write(0x8060 /*0b 1000 0000 0110 0000*/, 0x0C); // LCD_ON
    SLCD_DRIVER_Write(0x8300 /*0b 1000 0011 0000 0000*/, 0x0C); // RC256K
    SLCD_DRIVER_Write(0x8520 /*0b 1000 0101 0010 0000*/, 0x0C); // BIAS 1/3
    SLCD_DRIVER_Write(0x9C60 /*0b 1001 1100 0110 0000*/, 0x0C); // NORMAL

    SLCD_DRIVER_UpdateRAM();
}


5.2.SLCD共用函数设计
#ifndef __SLCD_H
#define __SLCD_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>

typedef struct
{
    char    ch;             /*字符索引*/
    uint8_t Segment;   /*字符对应的段编码*/
} SLCD_8SEG_TypeDef;

#define SLCD_8SEG_NUM       (38)

int SLCD_Search8Segment(const char   ch, uint8_t *Segment);
int SLCD_SearchCOMnSEGn(const char *str, uint8_t *COMn, uint8_t *SEGn);

#ifdef __cplusplus
}
#endif

#endif
#include "slcd.h"
#include "slcd_driver.h"

const SLCD_8SEG_TypeDef SLCD_8SEG_Table =
{
    {' ', {0, 0, 0, 0, 0, 0, 0, 0}},
    {'0', {1, 1, 1, 1, 1, 1, 0, 0}},
    {'1', {0, 1, 1, 0, 0, 0, 0, 0}},
    {'2', {1, 1, 0, 1, 1, 0, 1, 0}},
    {'3', {1, 1, 1, 1, 0, 0, 1, 0}},
    {'4', {0, 1, 1, 0, 0, 1, 1, 0}},
    {'5', {1, 0, 1, 1, 0, 1, 1, 0}},
    {'6', {1, 0, 1, 1, 1, 1, 1, 0}},
    {'7', {1, 1, 1, 0, 0, 0, 0, 0}},
    {'8', {1, 1, 1, 1, 1, 1, 1, 0}},
    {'9', {1, 1, 1, 1, 0, 1, 1, 0}},
    {'A', {1, 1, 1, 0, 1, 1, 1, 0}},
    {'b', {0, 0, 1, 1, 1, 1, 1, 0}},
    {'c', {0, 0, 0, 1, 1, 0, 1, 0}},
    {'C', {1, 0, 0, 1, 1, 1, 0, 0}},
    {'d', {0, 1, 1, 1, 1, 0, 1, 0}},
    {'E', {1, 0, 0, 1, 1, 1, 1, 0}},
    {'F', {1, 0, 0, 0, 1, 1, 1, 0}},
    {'g', {1, 1, 1, 1, 0, 1, 1, 0}},
    {'H', {0, 1, 1, 0, 1, 1, 1, 0}},
    {'h', {0, 0, 1, 0, 1, 1, 1, 0}},
    {'i', {0, 0, 1, 0, 0, 0, 0, 0}},
    {'I', {0, 0, 0, 0, 1, 1, 0, 0}},
    {'J', {0, 1, 1, 1, 1, 0, 0, 0}},
    {'l', {0, 0, 0, 0, 1, 1, 0, 0}},
    {'L', {0, 0, 0, 1, 1, 1, 0, 0}},
    {'n', {0, 0, 1, 0, 1, 0, 1, 0}},
    {'o', {0, 0, 1, 1, 1, 0, 1, 0}},
    {'O', {1, 1, 1, 1, 1, 1, 0, 0}},
    {'P', {1, 1, 0, 0, 1, 1, 1, 0}},
    {'q', {1, 1, 1, 0, 0, 1, 1, 0}},
    {'r', {0, 0, 0, 0, 1, 0, 1, 0}},
    {'S', {1, 0, 1, 1, 0, 1, 1, 0}},
    {'t', {0, 0, 0, 1, 1, 1, 1, 0}},
    {'u', {0, 0, 1, 1, 1, 0, 0, 0}},
    {'U', {0, 1, 1, 1, 1, 1, 0, 0}},
    {'y', {0, 1, 1, 1, 0, 1, 1, 0}},
    {'-', {0, 0, 0, 0, 0, 0, 1, 0}},
};

int SLCD_Search8Segment(const char ch, uint8_t *Segment)
{
    uint8_t i = 0, j = 0;

    for (i = 0; i < SLCD_8SEG_NUM; i++)
    {
      if (SLCD_8SEG_Table.ch == ch)
      {
            for (j = 0; j < 8; j++)
            {
                Segment = SLCD_8SEG_Table.Segment;
            }

            return (i);
      }
    }

    return (-1);
}

const char SLCD_TruthTable =
{
    {"L4","W2","W1","4A","4F","3A","3F","2A","1F","1A","2F","5D","DP5 ","6D","DP6 ","7D","DP7 ","S1","S8","8D","DP8 ","9D","DP9 ","10D ","S9","    ","    ","    ","    ","    ","    ","    "},
    {"L3","W3","T1","4B","4G","3B","3G","2B","1G","1B","2G","5E","5C","6E","6C","7E","7C","S2","S7","8E","8C","9E","9C","10E ","10C ","    ","    ","    ","    ","    ","    ","    "},
    {"L2","W4","COL3","4C","4E","3C","3E","2C","1E","1C","2E","5G","5B","6G","6B","7G","7B","S3","S6","8G","8B","9G","9B","10G ","10B ","    ","    ","    ","    ","    ","    ","    "},
    {"L1","W5","COL2","COL1","4D","DP3 ","3D","DP2 ","1D","DP1 ","2D","5F","5A","6F","6A","7F","7A","S4","S5","8F","8A","9F","9A","10F ","10A ","    ","    ","    ","    ","    ","    ","    "},
};

int SLCD_SearchCOMnSEGn(const char *str, uint8_t *COMn, uint8_t *SEGn)
{
    uint8_t i = 0, j = 0;

    for (i = 0; i < SLCD_DRIVER_COM; i++)
    {
      for (j = 0; j < SLCD_DRIVER_SEG; j++)
      {
            if (strcmp(str, SLCD_TruthTable) == 0)
            {
                *COMn = i;
                *SEGn = j;

                return (0);
            }
      }
    }

    *COMn = 0xFF;
    *SEGn = 0xFF;

    return (-1);
}
5.3.SLCD API功能设计
#ifndef __SLCD_API_H
#define __SLCD_API_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>

void SLCD_DisplayDigit(uint8_t Index, char ch);
void SLCD_DisplayPoint(uint8_t Index, uint8_t State);
void SLCD_DisplayCOL(uint8_t Index, uint8_t State);
void SLCD_DisplayW(uint8_t Index, uint8_t State);
void SLCD_DisplayL(uint8_t Index, uint8_t State);
void SLCD_DisplayS(uint8_t Index, uint8_t State);
void SLCD_DisplayT(uint8_t Index, uint8_t State);
void SLCD_DisplayALL(void);
void SLCD_DisplayCLR(void);

#ifdef __cplusplus
}
#endif

#endif
#include "slcd_api.h"
#include "slcd.h"
#include "slcd_driver.h"

const char DigitTable =
{
    {"1A", "1B", "1C", "1D", "1E", "1F", "1G"},
    {"2A", "2B", "2C", "2D", "2E", "2F", "2G"},
    {"3A", "3B", "3C", "3D", "3E", "3F", "3G"},
    {"4A", "4B", "4C", "4D", "4E", "4F", "4G"},
    {"5A", "5B", "5C", "5D", "5E", "5F", "5G"},
    {"6A", "6B", "6C", "6D", "6E", "6F", "6G"},
    {"7A", "7B", "7C", "7D", "7E", "7F", "7G"},
    {"8A", "8B", "8C", "8D", "8E", "8F", "8G"},
    {"9A", "9B", "9C", "9D", "9E", "9F", "9G"},
    {"10A ", "10B ", "10C ", "10D ", "10E ", "10F ", "10G "}
};

void SLCD_DisplayDigit(uint8_t Index, char ch)
{
    uint8_t i = 0,Segment;
    uint8_t COMn = 0, SEGn = 0;

    if ((Index >= 1) && (Index <= 10))
    {
      Index--;

      if (SLCD_Search8Segment(ch, Segment) != -1)
      {
            for (i = 0; i < 7; i++)
            {
                if (SLCD_SearchCOMnSEGn(DigitTable, &COMn, &SEGn) != -1)
                {
                  SLCD_DRIVER_ModifyRAM(COMn, SEGn, Segment);
                }
            }

            SLCD_DRIVER_UpdateRAM();
      }
    }
}

const char DP_Table =
{
    "DP1 ", "DP2 ", "DP3 ", "DP4 ","DP5 ","DP6 ","DP7 ","DP8 ","DP9 "
};

void SLCD_DisplayPoint(uint8_t Index, uint8_t State)
{
    uint8_t COMn = 0, SEGn = 0;

    if ((Index >= 1) && (Index <= 9))
    {
      Index--;

      if (SLCD_SearchCOMnSEGn(DP_Table, &COMn, &SEGn) != -1)
      {
            SLCD_DRIVER_ModifyRAM(COMn, SEGn, State);
      }

      SLCD_DRIVER_UpdateRAM();
    }
}

const char COL_Table =
{
    "COL1", "COL2", "COL3"
};

void SLCD_DisplayCOL(uint8_t Index, uint8_t State)
{
    uint8_t COMn = 0, SEGn = 0;

    if ((Index >= 1) && (Index <= 3))
    {
      Index--;

      if (SLCD_SearchCOMnSEGn(COL_Table, &COMn, &SEGn) != -1)
      {
            SLCD_DRIVER_ModifyRAM(COMn, SEGn, State);
      }

      SLCD_DRIVER_UpdateRAM();
    }
}

const char W_Table =
{
    "W1", "W2", "W3", "W4", "W5"
};

void SLCD_DisplayW(uint8_t Index, uint8_t State)
{
    uint8_t COMn = 0, SEGn = 0;

    if ((Index >= 1) && (Index <= 5))
    {
      Index--;

      if (SLCD_SearchCOMnSEGn(W_Table, &COMn, &SEGn) != -1)
      {
            SLCD_DRIVER_ModifyRAM(COMn, SEGn, State);
      }

      SLCD_DRIVER_UpdateRAM();
    }
}

const char L_Table =
{
    "L1", "L2", "L3", "L4"
};

void SLCD_DisplayL(uint8_t Index, uint8_t State)
{
    uint8_t COMn = 0, SEGn = 0;

    if ((Index >= 1) && (Index <= 4))
    {
      Index--;

      if (SLCD_SearchCOMnSEGn(L_Table, &COMn, &SEGn) != -1)
      {
            SLCD_DRIVER_ModifyRAM(COMn, SEGn, State);
      }

      SLCD_DRIVER_UpdateRAM();
    }
}

const char S_Table =
{
    "S1", "S2", "S3", "S4", "S5", "S6", "S7", "S8", "S9"
};

void SLCD_DisplayS(uint8_t Index, uint8_t State)
{
    uint8_t COMn = 0, SEGn = 0;

    if ((Index >= 1) && (Index <= 9))
    {
      Index--;

      if (SLCD_SearchCOMnSEGn(S_Table, &COMn, &SEGn) != -1)
      {
            SLCD_DRIVER_ModifyRAM(COMn, SEGn, State);
      }

      SLCD_DRIVER_UpdateRAM();
    }
}

const char T_Table =
{
    "T1"
};

void SLCD_DisplayT(uint8_t Index, uint8_t State)
{
    uint8_t COMn = 0, SEGn = 0;

    if (Index == 1)
    {
      Index--;

      if (SLCD_SearchCOMnSEGn(T_Table, &COMn, &SEGn) != -1)
      {
            SLCD_DRIVER_ModifyRAM(COMn, SEGn, State);
      }

      SLCD_DRIVER_UpdateRAM();
    }
}

void SLCD_DisplayALL(void)
{
    SLCD_DRIVER_Fill(0xFF);
}

void SLCD_DisplayCLR(void)
{
    SLCD_DRIVER_Fill(0x00);
}
5.4.Protocol自定义控制协议
#ifndef __PROTOCOL_H
#define __PROTOCOL_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>

void ProtocolAnalyzing(uint8_t *Buffer, uint8_t Length);

#ifdef __cplusplus
}
#endif

#endif
#include "protocol.h"
#include "slcd_api.h"

uint8_t Protocol_ASCII_TO_Hex(char ch)
{
    char HEX_Table = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};

    for (uint8_t i = 0; i < 16; i++)
    {
      if (ch == HEX_Table)
      {
            return (i);
      }
    }

    return (0xFF);
}

void ProtocolAnalyzing(uint8_t *Buffer, uint8_t Length)
{
    if (Length == 3)
    {
      if (Buffer == 'F')
      {
            SLCD_DisplayALL();
      }
      else if (Buffer == 'E')
      {
            SLCD_DisplayCLR();
      }
      else
      {
      }
    }

    /* @T# */
    if (Length == 4)
    {
      if ((Buffer == '@') && (Buffer == '#'))
      {
            if (Buffer == 'T')
            {
                SLCD_DisplayT(1, Buffer - 0x30);
            }         
      }
    }

    /* @D# */
    /* @P# */
    /* @C# */
    /* @W# */
    /* @L# */
    /* @S# */
    /* @T# */
    if (Length == 5)
    {
      if ((Buffer == '@') && (Buffer == '#'))
      {
            if (Buffer == 'D')
            {
                SLCD_DisplayDigit(Protocol_ASCII_TO_Hex(Buffer), Buffer);
            }
            else if (Buffer == 'P')
            {
                SLCD_DisplayPoint(Protocol_ASCII_TO_Hex(Buffer), Buffer - 0x30);
            }
            else if (Buffer == 'C')
            {
                SLCD_DisplayCOL(Protocol_ASCII_TO_Hex(Buffer), Buffer - 0x30);
            }
            else if (Buffer == 'W')
            {
                SLCD_DisplayW(    Protocol_ASCII_TO_Hex(Buffer), Buffer - 0x30);
            }
            else if (Buffer == 'L')
            {
                SLCD_DisplayL(    Protocol_ASCII_TO_Hex(Buffer), Buffer - 0x30);
            }
            else if (Buffer == 'S')
            {
                SLCD_DisplayS(    Protocol_ASCII_TO_Hex(Buffer), Buffer - 0x30);
            }
            else if (Buffer == 'T')
            {
                SLCD_DisplayT(    Protocol_ASCII_TO_Hex(Buffer), Buffer - 0x30);
            }
            else
            {
            }
      }
    }

    /* @C# */
    if (Length == 6)
    {
      if ((Buffer == '@') && (Buffer == '#'))
      {
            if (Buffer == 'C')
            {
                SLCD_DisplayCOL(1, Buffer - 0x30);
                SLCD_DisplayCOL(2, Buffer - 0x30);
                SLCD_DisplayCOL(3, Buffer - 0x30);
            }
      }
    }

    /* @L# */
    if (Length == 7)
    {
      if ((Buffer == '@') && (Buffer == '#'))
      {
            if (Buffer == 'L')
            {
                SLCD_DisplayL(1, Buffer - 0x30);
                SLCD_DisplayL(2, Buffer - 0x30);
                SLCD_DisplayL(3, Buffer - 0x30);
                SLCD_DisplayL(4, Buffer - 0x30);
            }
      }
    }

    /* @W# */
    if (Length == 8)
    {
      if ((Buffer == '@') && (Buffer == '#'))
      {
            if (Buffer == 'W')
            {
                SLCD_DisplayW(1, Buffer - 0x30);
                SLCD_DisplayW(2, Buffer - 0x30);
                SLCD_DisplayW(3, Buffer - 0x30);
                SLCD_DisplayW(4, Buffer - 0x30);
                SLCD_DisplayW(5, Buffer - 0x30);
            }
      }
    }

    /* @P# */
    /* @S# */
    if (Length == 12)
    {
      if ((Buffer == '@') && (Buffer == '#'))
      {
            if (Buffer == 'P')
            {
                SLCD_DisplayPoint(1, Buffer- 0x30);
                SLCD_DisplayPoint(2, Buffer- 0x30);
                SLCD_DisplayPoint(3, Buffer- 0x30);
                SLCD_DisplayPoint(4, Buffer- 0x30);
                SLCD_DisplayPoint(5, Buffer- 0x30);
                SLCD_DisplayPoint(6, Buffer- 0x30);
                SLCD_DisplayPoint(7, Buffer- 0x30);
                SLCD_DisplayPoint(8, Buffer- 0x30);
                SLCD_DisplayPoint(9, Buffer - 0x30);
            }
            else if (Buffer == 'S')
            {
                SLCD_DisplayS(1, Buffer- 0x30);
                SLCD_DisplayS(2, Buffer- 0x30);
                SLCD_DisplayS(3, Buffer- 0x30);
                SLCD_DisplayS(4, Buffer- 0x30);
                SLCD_DisplayS(5, Buffer- 0x30);
                SLCD_DisplayS(6, Buffer- 0x30);
                SLCD_DisplayS(7, Buffer- 0x30);
                SLCD_DisplayS(8, Buffer- 0x30);
                SLCD_DisplayS(9, Buffer - 0x30);
            }
            else
            {
            }
      }
    }

    /* @D# */
    if (Length == 13)
    {
      if ((Buffer == '@') && (Buffer == '#'))
      {
            if (Buffer == 'D')
            {
                SLCD_DisplayDigit(1,Buffer);
                SLCD_DisplayDigit(2,Buffer);
                SLCD_DisplayDigit(3,Buffer);
                SLCD_DisplayDigit(4,Buffer);
                SLCD_DisplayDigit(5,Buffer);
                SLCD_DisplayDigit(6,Buffer);
                SLCD_DisplayDigit(7,Buffer);
                SLCD_DisplayDigit(8,Buffer);
                SLCD_DisplayDigit(9,Buffer);
                SLCD_DisplayDigit(10, Buffer);
            }
      }
    }
}
6.显示效果
6.1.MM32G0001驱动SLCD显示效果


6.2.MM32F0010驱动SLCD显示效果


6.3.MM32F0020驱动SLCD显示效果


7.附件资料
7.1.GDC0689S(T)P10V3B显示屏:
7.2.GDC04212S(T)P10V3B显示屏:
7.3.GDC04362S(T)P10V3T显示屏:
7.4.MM32G0001原理图:
7.5.MM32F0010原理图:
7.6.MM32F0020原理图:
7.7.MM32G0001工程源码:
7.8.MM32F0010工程源码:
7.9.MM32F0020工程源码:


8.扩展应用
以上实现的段码液晶显示屏程序架构同样适用于段码形式的LED显示屏上,后面会分享一个段码LED应用的多功能闹钟,期待ing……

chenqianqian 发表于 2024-8-8 08:10

这个是段码液晶,显示的内容是固定的

xld0932 发表于 2024-8-8 09:27

chenqianqian 发表于 2024-8-8 08:10
这个是段码液晶,显示的内容是固定的

段码液晶屏,段位设计是固定的,显示的内容是通过组合可变的

tpgf 发表于 2024-8-10 15:58

通用段码液晶显示屏是一种广泛应用于各类电子设备中的显示技术。这种屏幕通过液晶显示技术来展示数字、字符和简单图形,因其低功耗、高可靠性和长寿命等优点而被广泛采用

hellobug 发表于 2024-8-11 21:07

不错的分享。最近在看段码屏,使用的是HT1623的驱动芯片。不过段码屏主要都要定制生产,有时候量少了不太划算。

beyikyo 发表于 2024-10-31 16:56

详细介绍了基于 MM32 的通用段码液晶显示屏程序架构,从硬件设计到程序实现,内容全面且实用,很有收获。

suncat0504 发表于 2024-11-7 18:14

谢谢分享!感觉段码液晶显示屏的驱动比图形的麻烦,占用IO口也多。另外图形点阵的液晶现在价格也降下来了。
页: [1]
查看完整版本: 基于MM32实现的通用段码液晶显示屏程序架构