- #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[SLCD_DRIVER_SEG];
- 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[i] & 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[SEGn] |= (0x01 << COMn);
- }
- else
- {
- SLCD_DRIVER_RAM[SEGn] &= ~(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[8]; /*字符对应的段编码*/
- } 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[SLCD_8SEG_NUM] =
- {
- {' ', {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[i].ch == ch)
- {
- for (j = 0; j < 8; j++)
- {
- Segment[j] = SLCD_8SEG_Table[i].Segment[j];
- }
- return (i);
- }
- }
- return (-1);
- }
- const char SLCD_TruthTable[SLCD_DRIVER_COM][SLCD_DRIVER_SEG][5] =
- {
- {"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[i][j]) == 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[10][7][5] =
- {
- {"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[8];
- 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[Index][i], &COMn, &SEGn) != -1)
- {
- SLCD_DRIVER_ModifyRAM(COMn, SEGn, Segment[i]);
- }
- }
- SLCD_DRIVER_UpdateRAM();
- }
- }
- }
- const char DP_Table[9][5] =
- {
- "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[Index], &COMn, &SEGn) != -1)
- {
- SLCD_DRIVER_ModifyRAM(COMn, SEGn, State);
- }
- SLCD_DRIVER_UpdateRAM();
- }
- }
- const char COL_Table[3][5] =
- {
- "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[Index], &COMn, &SEGn) != -1)
- {
- SLCD_DRIVER_ModifyRAM(COMn, SEGn, State);
- }
- SLCD_DRIVER_UpdateRAM();
- }
- }
- const char W_Table[5][5] =
- {
- "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[Index], &COMn, &SEGn) != -1)
- {
- SLCD_DRIVER_ModifyRAM(COMn, SEGn, State);
- }
- SLCD_DRIVER_UpdateRAM();
- }
- }
- const char L_Table[4][5] =
- {
- "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[Index], &COMn, &SEGn) != -1)
- {
- SLCD_DRIVER_ModifyRAM(COMn, SEGn, State);
- }
- SLCD_DRIVER_UpdateRAM();
- }
- }
- const char S_Table[9][5] =
- {
- "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[Index], &COMn, &SEGn) != -1)
- {
- SLCD_DRIVER_ModifyRAM(COMn, SEGn, State);
- }
- SLCD_DRIVER_UpdateRAM();
- }
- }
- const char T_Table[1][5] =
- {
- "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[Index], &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[16] = {'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[i])
- {
- return (i);
- }
- }
- return (0xFF);
- }
- void ProtocolAnalyzing(uint8_t *Buffer, uint8_t Length)
- {
- if (Length == 3)
- {
- if (Buffer[1] == 'F')
- {
- SLCD_DisplayALL();
- }
- else if (Buffer[1] == 'E')
- {
- SLCD_DisplayCLR();
- }
- else
- {
- }
- }
- /* @T[T1]# */
- if (Length == 4)
- {
- if ((Buffer[0] == '@') && (Buffer[3] == '#'))
- {
- if (Buffer[1] == 'T')
- {
- SLCD_DisplayT(1, Buffer[2] - 0x30);
- }
- }
- }
- /* @D[Index][ch]# */
- /* @P[Index][State]# */
- /* @C[Index][State]# */
- /* @W[Index][State]# */
- /* @L[Index][State]# */
- /* @S[Index][State]# */
- /* @T[Index][State]# */
- if (Length == 5)
- {
- if ((Buffer[0] == '@') && (Buffer[4] == '#'))
- {
- if (Buffer[1] == 'D')
- {
- SLCD_DisplayDigit(Protocol_ASCII_TO_Hex(Buffer[2]), Buffer[3]);
- }
- else if (Buffer[1] == 'P')
- {
- SLCD_DisplayPoint(Protocol_ASCII_TO_Hex(Buffer[2]), Buffer[3] - 0x30);
- }
- else if (Buffer[1] == 'C')
- {
- SLCD_DisplayCOL( Protocol_ASCII_TO_Hex(Buffer[2]), Buffer[3] - 0x30);
- }
- else if (Buffer[1] == 'W')
- {
- SLCD_DisplayW( Protocol_ASCII_TO_Hex(Buffer[2]), Buffer[3] - 0x30);
- }
- else if (Buffer[1] == 'L')
- {
- SLCD_DisplayL( Protocol_ASCII_TO_Hex(Buffer[2]), Buffer[3] - 0x30);
- }
- else if (Buffer[1] == 'S')
- {
- SLCD_DisplayS( Protocol_ASCII_TO_Hex(Buffer[2]), Buffer[3] - 0x30);
- }
- else if (Buffer[1] == 'T')
- {
- SLCD_DisplayT( Protocol_ASCII_TO_Hex(Buffer[2]), Buffer[3] - 0x30);
- }
- else
- {
- }
- }
- }
- /* @C[COL1][COL2][COL3]# */
- if (Length == 6)
- {
- if ((Buffer[0] == '@') && (Buffer[5] == '#'))
- {
- if (Buffer[1] == 'C')
- {
- SLCD_DisplayCOL(1, Buffer[2] - 0x30);
- SLCD_DisplayCOL(2, Buffer[3] - 0x30);
- SLCD_DisplayCOL(3, Buffer[4] - 0x30);
- }
- }
- }
- /* @L[L1][L2][L3][L4]# */
- if (Length == 7)
- {
- if ((Buffer[0] == '@') && (Buffer[6] == '#'))
- {
- if (Buffer[1] == 'L')
- {
- SLCD_DisplayL(1, Buffer[2] - 0x30);
- SLCD_DisplayL(2, Buffer[3] - 0x30);
- SLCD_DisplayL(3, Buffer[4] - 0x30);
- SLCD_DisplayL(4, Buffer[5] - 0x30);
- }
- }
- }
- /* @W[W1][W2][W3][W4][W5]# */
- if (Length == 8)
- {
- if ((Buffer[0] == '@') && (Buffer[7] == '#'))
- {
- if (Buffer[1] == 'W')
- {
- SLCD_DisplayW(1, Buffer[2] - 0x30);
- SLCD_DisplayW(2, Buffer[3] - 0x30);
- SLCD_DisplayW(3, Buffer[4] - 0x30);
- SLCD_DisplayW(4, Buffer[5] - 0x30);
- SLCD_DisplayW(5, Buffer[6] - 0x30);
- }
- }
- }
- /* @P[DP1][DP2][DP3][DP4][DP5][DP6][DP7][DP8][DP9]# */
- /* @S[S1][S2][S3][S4][S5][S6][S7][S8][S9]# */
- if (Length == 12)
- {
- if ((Buffer[0] == '@') && (Buffer[11] == '#'))
- {
- if (Buffer[1] == 'P')
- {
- SLCD_DisplayPoint(1, Buffer[2] - 0x30);
- SLCD_DisplayPoint(2, Buffer[3] - 0x30);
- SLCD_DisplayPoint(3, Buffer[4] - 0x30);
- SLCD_DisplayPoint(4, Buffer[5] - 0x30);
- SLCD_DisplayPoint(5, Buffer[6] - 0x30);
- SLCD_DisplayPoint(6, Buffer[7] - 0x30);
- SLCD_DisplayPoint(7, Buffer[8] - 0x30);
- SLCD_DisplayPoint(8, Buffer[9] - 0x30);
- SLCD_DisplayPoint(9, Buffer[10] - 0x30);
- }
- else if (Buffer[1] == 'S')
- {
- SLCD_DisplayS(1, Buffer[2] - 0x30);
- SLCD_DisplayS(2, Buffer[3] - 0x30);
- SLCD_DisplayS(3, Buffer[4] - 0x30);
- SLCD_DisplayS(4, Buffer[5] - 0x30);
- SLCD_DisplayS(5, Buffer[6] - 0x30);
- SLCD_DisplayS(6, Buffer[7] - 0x30);
- SLCD_DisplayS(7, Buffer[8] - 0x30);
- SLCD_DisplayS(8, Buffer[9] - 0x30);
- SLCD_DisplayS(9, Buffer[10] - 0x30);
- }
- else
- {
- }
- }
- }
- /* @D[1][2][3][4][5][6][7][8][9][10]# */
- if (Length == 13)
- {
- if ((Buffer[0] == '@') && (Buffer[12] == '#'))
- {
- if (Buffer[1] == 'D')
- {
- SLCD_DisplayDigit(1, Buffer[2]);
- SLCD_DisplayDigit(2, Buffer[3]);
- SLCD_DisplayDigit(3, Buffer[4]);
- SLCD_DisplayDigit(4, Buffer[5]);
- SLCD_DisplayDigit(5, Buffer[6]);
- SLCD_DisplayDigit(6, Buffer[7]);
- SLCD_DisplayDigit(7, Buffer[8]);
- SLCD_DisplayDigit(8, Buffer[9]);
- SLCD_DisplayDigit(9, Buffer[10]);
- SLCD_DisplayDigit(10, Buffer[11]);
- }
- }
- }
- }
6.显示效果
6.1.MM32G0001驱动SLCD显示效果
6.2.MM32F0010驱动SLCD显示效果
6.3.MM32F0020驱动SLCD显示效果
7.附件资料
7.1.GDC0689S(T)P10V3B显示屏:
GDC0689S(T)P10V3B.pdf
(309.4 KB, 下载次数: 16)
7.2.GDC04212S(T)P10V3B显示屏:
GDC04212S(T)P10V3B.pdf
(220.54 KB, 下载次数: 16)
7.3.GDC04362S(T)P10V3T显示屏:
GDC04362S(T)P10V3T.pdf
(419.84 KB, 下载次数: 17)
7.4.MM32G0001原理图:
Schematic_MM32G0001_LCD.pdf
(71.6 KB, 下载次数: 20)
7.5.MM32F0010原理图:
Schematic_MM32F0010_LCD.pdf
(71.8 KB, 下载次数: 14)
7.6.MM32F0020原理图:
Schematic_MM32F0020_LCD.pdf
(78.62 KB, 下载次数: 13)
7.7.MM32G0001工程源码:
MM32G0001.zip
(568.38 KB, 下载次数: 39)
7.8.MM32F0010工程源码:
MM32F0010.zip
(591.5 KB, 下载次数: 18)
7.9.MM32F0020工程源码:
MM32F0020.zip
(603.62 KB, 下载次数: 24)
8.扩展应用
以上实现的段码液晶显示屏程序架构同样适用于段码形式的LED显示屏上,后面会分享一个段码LED应用的多功能闹钟,期待ing……