【MT32F006】MT32F006之HT1628驱动LED

news2024/12/25 9:15:34

本文最后修改时间:2023年03月30日

一、本节简介

本文介绍如何使用MT32F006连接HT1628芯片驱动LED。

二、实验平台

库版本:V1.0.0

编译软件:MDK5.37

硬件平台:MT32F006开发板(主芯片MT32F006)

仿真器:JLINK

传感器:HT1628

三、版权声明

1)作者:甜甜的大香瓜

2)声明:喝水不忘挖井人,转载请注明出处。

3)纠错/业务合作:897503845@qq.com

4)香瓜嵌入式之STM8/STM32群:164311667

5)本文出处:原创连载资料《简单粗暴学MT32F006》

6)完整开源资料下载地址(电脑端打开):opengua.taobao.com

四、实验前提

1、在进行本文步骤前,请先阅读以下章节:

1)《简单粗暴学MT32F006》的第一章和第二章章节

2、在进行本文步骤前,请先实现以下章节:

1)《简单粗暴学MT32F006》的《MT32F006之定时器延时》。

五、基础知识

1、什么是HT1628?

答:HT1628的完整型号HT1628BRWZ(封装SOP-28-300mil),品牌是HTCSEMI(海天芯)。

3.3V~4.2V 电压、4位*13段或7位*10段的阴极型的LED面板显示驱动。

打个比方,如果要点亮5个8字的数码管,一共要5*7=35个led。

方法一:使用mcu来控制,35个IO口对应控制35个led,此方法非常占用mcu的IO口。

方法二:使用mcu来控制,用行与列的方式,5个IO作为行、7个IO作为列,此方法需要5+7=12个IO口,也很占用mcu的IO口。

方法三(推荐):使用mcu+HT1628驱动芯片,mcu只需要3个IO(DIO数据信号、CLK时钟信号、STB信号是否有效脚)控制HT1628,HT1628再去控制LED。实际占用的是HT1628的IO口。

2、网上很多TM1628的驱动资料,与HT1628通用吗?

 

答:封装和引脚一样,但驱动代码不通用。

3、HT1628连接LED必须按一定规律顺序吗?

答:有规律会比较方便写代码,但是没规律也可以按独立的灯来写。

4、HT1628的操作逻辑是怎么样的?

1)配置DIO、CLK、STB三个IO。

2)延时等待稳定。

3)发送3条设置指令,主要设置:几位几段、地址自动增加模式、设置显示地址为0开始

4)第3条设置指令后紧跟着一串LED数据:

如上图,一共14个字节,每个字节又分为HL低字节、HU高字节,这些字节会被存在HT1628的寄存器里,每个位都只对应1个位置(也就是对应1个LED灯)。

例如左上角第一个00HL地址的4个位(4个LED)分别是SG1-DIG1、SG2-DIG1、SG3-DIG1、SG4-DIG1。

注:位digits;段segments。

5)发送第4条设置指令,主要设置:亮度、开启显示。

六、硬件原理

1、MCU与HT1628连接

由上图可知:

HT1628引脚

MT32F006引脚

DIO

PIO1_5

CLK

PIO1_4

STB

PIO1_1

2、HT1628与LED的连接

七、实验步骤

1、编写并添加串口驱动

1)编写驱动GUA_HT1628.c(存放在“……\Projects\MT006_StdPeriph_Templates\GUA”)

//**********************************************************************

//name:         GUA_HT1628.c

//introduce:    LED驱动

//author:       甜甜的大香瓜     

//email:        897503845@qq.com  

//shop:         opengua.taobao.com

//changetime:   2023.02.02

//**********************************************************************

#include "mt006.h"

#include "GUA_Delay.h"

#include "GUA_HT1628.h"

#include "string.h"

//SEG Code

//const GUA_U8 LEDseg[11]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0};

/*********************宏定义************************/

#define GUA_STB_H                 GPIO_WriteBit(GPIO1, GPIO_Pin_1, Bit_SET)

#define GUA_STB_L                 GPIO_WriteBit(GPIO1, GPIO_Pin_1, Bit_RESET)

#define GUA_CLK_H                 GPIO_WriteBit(GPIO1, GPIO_Pin_4, Bit_SET)

#define GUA_CLK_L                 GPIO_WriteBit(GPIO1, GPIO_Pin_4, Bit_RESET)

#define GUA_DIO_H                 GPIO_WriteBit(GPIO1, GPIO_Pin_5, Bit_SET)

#define GUA_DIO_L                 GPIO_WriteBit(GPIO1, GPIO_Pin_5, Bit_RESET)

/*********************内部变量************************/

GUA_U8 gGUA_HT1628_Ram[14] = {0};

GUA_HT1628_DISPLAY stGUA_HT1628_Display;

/*********************内部函数声明************************/

static void GUA_HT1628_DataConvert(void);

static void GUA_HT1628_GPIO_Init(void);

static void GUA_HT1628_SendCMD(GUA_U8 nGUA_CMD);

static void GUA_HT1628_SendData(GUA_U8 nGUA_Data);

//**********************************************************************

//name:         GUA_HT1628_DataConvert

//introduce:    HT1628的GPIO初始化

//parameter:    none

//return:       none

//author:       甜甜的大香瓜

//email:        897503845@qq.com

//shop:         opengua.taobao.com

//changetime:   2023.02.02

//**********************************************************************

static void GUA_HT1628_DataConvert(void)

{

      //清空内存缓冲区

      memset(gGUA_HT1628_Ram, 0, 14);

     

      //left_button D1 D2 D3

      if(stGUA_HT1628_Display.left_button == GUA_LIGHT_PART_ON)

      {

           //D1 D2 D3: 1 1 1

           gGUA_HT1628_Ram[12] |= (1<<2)|(1<<1)|(1<<0);

      }

      else

      {

           //D1 D2 D3: 0 0 0

           gGUA_HT1628_Ram[12] &= ~(1<<0);   //D1

           gGUA_HT1628_Ram[12] &= ~(1<<1);   //D2

           gGUA_HT1628_Ram[12] &= ~(1<<2);   //D3

      }

     

      //right_button D62 D63 D64

      if(stGUA_HT1628_Display.right_button == GUA_LIGHT_PART_ON)

      {

           //D62 D63 D64:1 1 1

           gGUA_HT1628_Ram[0] |= (1<<3)|(1<<2)|(1<<1);

      }

      else

      {

           //D62 D63 D64:0 0 0

           gGUA_HT1628_Ram[0] &= ~(1<<1);    //D62

           gGUA_HT1628_Ram[0] &= ~(1<<2);    //D63

           gGUA_HT1628_Ram[0] &= ~(1<<3);    //D64

      }    

     

      //lb D22

      if(stGUA_HT1628_Display.lb == GUA_LIGHT_PART_ON)

      {

           gGUA_HT1628_Ram[8] |= (1<<1);

      }

      else

      {

           gGUA_HT1628_Ram[8] &= ~(1<<1);

      }         

     

      //kg D23

      if(stGUA_HT1628_Display.kg == GUA_LIGHT_PART_ON)

      {

           gGUA_HT1628_Ram[8] |= (1<<2);

      }

      else

      {

           gGUA_HT1628_Ram[8] &= ~(1<<2);

      }

      //oz D60

      if(stGUA_HT1628_Display.oz == GUA_LIGHT_PART_ON)

      {

           gGUA_HT1628_Ram[3] |= (1<<1);

      }

      else

      {

           gGUA_HT1628_Ram[3] &= ~(1<<1);

      }

      //g D61

      if(stGUA_HT1628_Display.g == GUA_LIGHT_PART_ON)

      {

           gGUA_HT1628_Ram[0] |= (1<<0);

      }

      else

      {

           gGUA_HT1628_Ram[0] &= ~(1<<0);

      }    

     

      //point D45

      if(stGUA_HT1628_Display.point == GUA_LIGHT_PART_ON)

      {

           gGUA_HT1628_Ram[4] |= (1<<4);

      }

      else

      {

           gGUA_HT1628_Ram[4] &= ~(1<<4);

      }         

     

      //num1 D8 D10 D13 D14 D12 D9 D11**********************

      switch(stGUA_HT1628_Display.num1)

      {

           //D8 D10 D13 D14 D12 D9 D11:1 1 1 1 1 1 0

           case GUA_LIGHT_NUMBER0:

           {               

                 gGUA_HT1628_Ram[12] |= (1<<7);    //D8

                 gGUA_HT1628_Ram[13] |= (1<<1);    //D10

                 gGUA_HT1628_Ram[10] |= (1<<2);    //D13

                 gGUA_HT1628_Ram[10] |= (1<<3);    //D14

                 gGUA_HT1628_Ram[10] |= (1<<1);    //D12

                 gGUA_HT1628_Ram[13] |= (1<<0);    //D9

                 gGUA_HT1628_Ram[10] &= ~(1<<0);   //D11                            

                 break;               

           }

          

           //D8 D10 D13 D14 D12 D9 D11:0 1 1 0 0 0 0

           case GUA_LIGHT_NUMBER1:

           {               

                 gGUA_HT1628_Ram[12] &= ~(1<<7);   //D8

                 gGUA_HT1628_Ram[13] |= (1<<1);    //D10

                 gGUA_HT1628_Ram[10] |= (1<<2);    //D13

                 gGUA_HT1628_Ram[10] &= ~(1<<3);   //D14

                 gGUA_HT1628_Ram[10] &= ~(1<<1);   //D12

                 gGUA_HT1628_Ram[13] &= ~(1<<0);   //D9

                 gGUA_HT1628_Ram[10] &= ~(1<<0);   //D11                            

                 break;               

           }    

          

           //D8 D10 D13 D14 D12 D9 D11:1 1 0 1 1 0 1

           case GUA_LIGHT_NUMBER2:

           {               

                 gGUA_HT1628_Ram[12] |= (1<<7);    //D8

                 gGUA_HT1628_Ram[13] |= (1<<1);    //D10

                 gGUA_HT1628_Ram[10] &= ~(1<<2);   //D13

                 gGUA_HT1628_Ram[10] |= (1<<3);    //D14

                 gGUA_HT1628_Ram[10] |= (1<<1);    //D12

                 gGUA_HT1628_Ram[13] &= ~(1<<0);   //D9

                 gGUA_HT1628_Ram[10] |= (1<<0);    //D11                            

                 break;               

           }

          

           //D8 D10 D13 D14 D12 D9 D11:1 1 1 1 0 0 1

           case GUA_LIGHT_NUMBER3:

           {               

                 gGUA_HT1628_Ram[12] |= (1<<7);    //D8

                 gGUA_HT1628_Ram[13] |= (1<<1);    //D10

                 gGUA_HT1628_Ram[10] |= (1<<2);    //D13

                 gGUA_HT1628_Ram[10] |= (1<<3);    //D14

                 gGUA_HT1628_Ram[10] &= ~(1<<1);   //D12

                 gGUA_HT1628_Ram[13] &= ~(1<<0);   //D9

                 gGUA_HT1628_Ram[10] |= (1<<0);    //D11                            

                 break;               

           }

          

           //D8 D10 D13 D14 D12 D9 D11:0 1 1 0 0 1 1

           case GUA_LIGHT_NUMBER4:

           {               

                 gGUA_HT1628_Ram[12] &= ~(1<<7);   //D8

                 gGUA_HT1628_Ram[13] |= (1<<1);    //D10

                 gGUA_HT1628_Ram[10] |= (1<<2);    //D13

                 gGUA_HT1628_Ram[10] &= ~(1<<3);   //D14

                 gGUA_HT1628_Ram[10] &= ~(1<<1);   //D12

                 gGUA_HT1628_Ram[13] |= (1<<0);    //D9

                 gGUA_HT1628_Ram[10] |= (1<<0);    //D11                            

                 break;               

           }    

          

           //D8 D10 D13 D14 D12 D9 D11:1 0 1 1 0 1 1

           case GUA_LIGHT_NUMBER5:

           {               

                 gGUA_HT1628_Ram[12] |= (1<<7);    //D8

                 gGUA_HT1628_Ram[13] &= ~(1<<1);   //D10

                 gGUA_HT1628_Ram[10] |= (1<<2);    //D13

                 gGUA_HT1628_Ram[10] |= (1<<3);    //D14

                 gGUA_HT1628_Ram[10] &= ~(1<<1);   //D12

                 gGUA_HT1628_Ram[13] |= (1<<0);    //D9

                 gGUA_HT1628_Ram[10] |= (1<<0);    //D11                            

                 break;               

           }    

          

           //D8 D10 D13 D14 D12 D9 D11:1 0 1 1 1 1 1

           case GUA_LIGHT_NUMBER6:

           {               

                 gGUA_HT1628_Ram[12] |= (1<<7);    //D8

                 gGUA_HT1628_Ram[13] &= ~(1<<1);   //D10

                 gGUA_HT1628_Ram[10] |= (1<<2);    //D13

                 gGUA_HT1628_Ram[10] |= (1<<3);    //D14

                 gGUA_HT1628_Ram[10] |= (1<<1);    //D12

                 gGUA_HT1628_Ram[13] |= (1<<0);    //D9

                 gGUA_HT1628_Ram[10] |= (1<<0);    //D11                            

                 break;               

           }    

          

           //D8 D10 D13 D14 D12 D9 D11:1 1 1 0 0 0 0

           case GUA_LIGHT_NUMBER7:

           {               

                 gGUA_HT1628_Ram[12] |= (1<<7);    //D8

                 gGUA_HT1628_Ram[13] |= (1<<1);    //D10

                 gGUA_HT1628_Ram[10] |= (1<<2);    //D13

                 gGUA_HT1628_Ram[10] &= ~(1<<3);   //D14

                 gGUA_HT1628_Ram[10] &= ~(1<<1);   //D12

                 gGUA_HT1628_Ram[13] &= ~(1<<0);   //D9

                 gGUA_HT1628_Ram[10] &= ~(1<<0);   //D11                            

                 break;               

           }    

          

           //D8 D10 D13 D14 D12 D9 D11:1 1 1 1 1 1 1

           case GUA_LIGHT_NUMBER8:

           {               

                 gGUA_HT1628_Ram[12] |= (1<<7);    //D8

                 gGUA_HT1628_Ram[13] |= (1<<1);    //D10

                 gGUA_HT1628_Ram[10] |= (1<<2);    //D13

                 gGUA_HT1628_Ram[10] |= (1<<3);    //D14

                 gGUA_HT1628_Ram[10] |= (1<<1);    //D12

                 gGUA_HT1628_Ram[13] |= (1<<0);    //D9

                 gGUA_HT1628_Ram[10] |= (1<<0);    //D11                            

                 break;               

           }               

          

           //D8 D10 D13 D14 D12 D9 D11:1 1 1 1 0 1 1

           case GUA_LIGHT_NUMBER9:

           {               

                 gGUA_HT1628_Ram[12] |= (1<<7);    //D8

                 gGUA_HT1628_Ram[13] |= (1<<1);    //D10

                 gGUA_HT1628_Ram[10] |= (1<<2);    //D13

                 gGUA_HT1628_Ram[10] |= (1<<3);    //D14

                 gGUA_HT1628_Ram[10] &= ~(1<<1);   //D12

                 gGUA_HT1628_Ram[13] |= (1<<0);    //D9

                 gGUA_HT1628_Ram[10] |= (1<<0);    //D11                            

                 break;               

           }

          

           //D8 D10 D13 D14 D12 D9 D11:0 0 0 0 0 0 0

           default:

           {               

                 gGUA_HT1628_Ram[12] &= ~(1<<7);   //D8

                 gGUA_HT1628_Ram[13] &= ~(1<<1);   //D10

                 gGUA_HT1628_Ram[10] &= ~(1<<2);   //D13

                 gGUA_HT1628_Ram[10] &= ~(1<<3);   //D14

                 gGUA_HT1628_Ram[10] &= ~(1<<1);   //D12

                 gGUA_HT1628_Ram[13] &= ~(1<<0);   //D9

                 gGUA_HT1628_Ram[10] &= ~(1<<0);   //D11                                 

                 break;               

           }

      }

     

      //num2 D15 D17 D20 D21 D19 D16 D18**********************

      switch(stGUA_HT1628_Display.num2)

      {

           //D15 D17 D20 D21 D19 D16 D18:1 1 1 1 1 1 0

           case GUA_LIGHT_NUMBER0:

           {               

                 gGUA_HT1628_Ram[10] |= (1<<4);    //D15

                 gGUA_HT1628_Ram[10] |= (1<<6);    //D17

                 gGUA_HT1628_Ram[11] |= (1<<1);    //D20

                 gGUA_HT1628_Ram[8]  |= (1<<0);    //D21

                 gGUA_HT1628_Ram[11] |= (1<<0);    //D19

                 gGUA_HT1628_Ram[10] |= (1<<5);    //D16

                 gGUA_HT1628_Ram[10] &= ~(1<<7);   //D18                            

                 break;               

           }

          

           //D15 D17 D20 D21 D19 D16 D18:0 1 1 0 0 0 0

           case GUA_LIGHT_NUMBER1:

           {               

                 gGUA_HT1628_Ram[10] &= ~(1<<4);   //D15

                 gGUA_HT1628_Ram[10] |= (1<<6);    //D17

                 gGUA_HT1628_Ram[11] |= (1<<1);    //D20

                 gGUA_HT1628_Ram[8]  &= ~(1<<0);   //D21

                 gGUA_HT1628_Ram[11] &= ~(1<<0);   //D19

                 gGUA_HT1628_Ram[10] &= ~(1<<5);   //D16

                 gGUA_HT1628_Ram[10] &= ~(1<<7);   //D18                            

                 break;                                

           }    

          

           //D15 D17 D20 D21 D19 D16 D18:1 1 0 1 1 0 1

           case GUA_LIGHT_NUMBER2:

           {               

                 gGUA_HT1628_Ram[10] |= (1<<4);    //D15

                 gGUA_HT1628_Ram[10] |= (1<<6);    //D17

                 gGUA_HT1628_Ram[11] &= ~(1<<1);   //D20

                 gGUA_HT1628_Ram[8]  |= (1<<0);    //D21

                 gGUA_HT1628_Ram[11] |= (1<<0);    //D19

                 gGUA_HT1628_Ram[10] &= ~(1<<5);   //D16

                 gGUA_HT1628_Ram[10] |= (1<<7);    //D18                      

                 break;               

           }

          

           //D15 D17 D20 D21 D19 D16 D18:1 1 1 1 0 0 1

           case GUA_LIGHT_NUMBER3:

           {               

                 gGUA_HT1628_Ram[10] |= (1<<4);    //D15

                 gGUA_HT1628_Ram[10] |= (1<<6);    //D17

                 gGUA_HT1628_Ram[11] |= (1<<1);    //D20

                 gGUA_HT1628_Ram[8]  |= (1<<0);    //D21

                 gGUA_HT1628_Ram[11] &= ~(1<<0);   //D19

                 gGUA_HT1628_Ram[10] &= ~(1<<5);   //D16

                 gGUA_HT1628_Ram[10] |= (1<<7);    //D18                                            

                 break;               

           }

          

           //D15 D17 D20 D21 D19 D16 D18:0 1 1 0 0 1 1

           case GUA_LIGHT_NUMBER4:

           {               

                 gGUA_HT1628_Ram[10] &= ~(1<<4);   //D15

                 gGUA_HT1628_Ram[10] |= (1<<6);    //D17

                 gGUA_HT1628_Ram[11] |= (1<<1);    //D20

                 gGUA_HT1628_Ram[8]  &= ~(1<<0);   //D21

                 gGUA_HT1628_Ram[11] &= ~(1<<0);   //D19

                 gGUA_HT1628_Ram[10] |= (1<<5);    //D16

                 gGUA_HT1628_Ram[10] |= (1<<7);    //D18                                            

                 break;               

           }    

          

           //D15 D17 D20 D21 D19 D16 D18:1 0 1 1 0 1 1

           case GUA_LIGHT_NUMBER5:

           {               

                 gGUA_HT1628_Ram[10] |= (1<<4);    //D15

                 gGUA_HT1628_Ram[10] &= ~(1<<6);   //D17

                 gGUA_HT1628_Ram[11] |= (1<<1);    //D20

                 gGUA_HT1628_Ram[8]  |= (1<<0);    //D21

                 gGUA_HT1628_Ram[11] &= ~(1<<0);   //D19

                 gGUA_HT1628_Ram[10] |= (1<<5);    //D16

                 gGUA_HT1628_Ram[10] |= (1<<7);    //D18                                            

                 break;               

           }    

          

           //D15 D17 D20 D21 D19 D16 D18:1 0 1 1 1 1 1

           case GUA_LIGHT_NUMBER6:

           {    

                 gGUA_HT1628_Ram[10] |= (1<<4);    //D15

                 gGUA_HT1628_Ram[10] &= ~(1<<6);   //D17

                 gGUA_HT1628_Ram[11] |= (1<<1);    //D20

                 gGUA_HT1628_Ram[8]  |= (1<<0);    //D21

                 gGUA_HT1628_Ram[11] |= (1<<0);    //D19

                 gGUA_HT1628_Ram[10] |= (1<<5);    //D16

                 gGUA_HT1628_Ram[10] |= (1<<7);    //D18                            

                 break;               

           }    

          

           //D15 D17 D20 D21 D19 D16 D18:1 1 1 0 0 0 0

           case GUA_LIGHT_NUMBER7:

           {               

                 gGUA_HT1628_Ram[10] |= (1<<4);    //D15

                 gGUA_HT1628_Ram[10] |= (1<<6);    //D17

                 gGUA_HT1628_Ram[11] |= (1<<1);    //D20

                 gGUA_HT1628_Ram[8]  &= ~(1<<0);   //D21

                 gGUA_HT1628_Ram[11] &= ~(1<<0);   //D19

                 gGUA_HT1628_Ram[10] &= ~(1<<5);   //D16

                 gGUA_HT1628_Ram[10] &= ~(1<<7);   //D18                                            

                 break;               

           }    

          

           //D15 D17 D20 D21 D19 D16 D18:1 1 1 1 1 1 1

           case GUA_LIGHT_NUMBER8:

           {               

                 gGUA_HT1628_Ram[10] |= (1<<4);    //D15

                 gGUA_HT1628_Ram[10] |= (1<<6);    //D17

                 gGUA_HT1628_Ram[11] |= (1<<1);    //D20

                 gGUA_HT1628_Ram[8]  |= (1<<0);    //D21

                 gGUA_HT1628_Ram[11] |= (1<<0);    //D19

                 gGUA_HT1628_Ram[10] |= (1<<5);    //D16

                 gGUA_HT1628_Ram[10] |= (1<<7);    //D18                                            

                 break;               

           }               

          

           //D15 D17 D20 D21 D19 D16 D18:1 1 1 1 0 1 1

           case GUA_LIGHT_NUMBER9:

           {               

                 gGUA_HT1628_Ram[10] |= (1<<4);    //D15

                 gGUA_HT1628_Ram[10] |= (1<<6);    //D17

                 gGUA_HT1628_Ram[11] |= (1<<1);    //D20

                 gGUA_HT1628_Ram[8]  |= (1<<0);    //D21

                 gGUA_HT1628_Ram[11] &= ~(1<<0);   //D19

                 gGUA_HT1628_Ram[10] |= (1<<5);    //D16

                 gGUA_HT1628_Ram[10] |= (1<<7);    //D18                                            

                 break;               

           }

          

           //D15 D17 D20 D21 D19 D16 D18:0 0 0 0 0 0 0

           default:

           {               

                 gGUA_HT1628_Ram[10] &= ~(1<<4);   //D15

                 gGUA_HT1628_Ram[10] &= ~(1<<6);   //D17

                 gGUA_HT1628_Ram[11] &= ~(1<<1);   //D20

                 gGUA_HT1628_Ram[8]  &= ~(1<<0);   //D21

                 gGUA_HT1628_Ram[11] &= ~(1<<0);   //D19

                 gGUA_HT1628_Ram[10] &= ~(1<<5);   //D16

                 gGUA_HT1628_Ram[10] &= ~(1<<7);   //D18                                                  

                 break;               

           }

      }    

      //num3 D24 D26 D29 D30 D28 D25 D27**********************

      switch(stGUA_HT1628_Display.num3)

      {

           //D24 D26 D29 D30 D28 D25 D27:1 1 1 1 1 1 0

           case GUA_LIGHT_NUMBER0:

           {               

                 gGUA_HT1628_Ram[8] |= (1<<3);          //D24

                 gGUA_HT1628_Ram[8] |= (1<<5);          //D26

                 gGUA_HT1628_Ram[9] |= (1<<0);          //D29

                 gGUA_HT1628_Ram[9] |= (1<<1);          //D30

                 gGUA_HT1628_Ram[8] |= (1<<7);          //D28

                 gGUA_HT1628_Ram[8] |= (1<<4);          //D25

                 gGUA_HT1628_Ram[8] &= ~(1<<6);    //D27                            

                 break;               

           }

          

           //D24 D26 D29 D30 D28 D25 D27:0 1 1 0 0 0 0

           case GUA_LIGHT_NUMBER1:

           {               

                 gGUA_HT1628_Ram[8] &= ~(1<<3);    //D24

                 gGUA_HT1628_Ram[8] |= (1<<5);          //D26

                 gGUA_HT1628_Ram[9] |= (1<<0);          //D29

                 gGUA_HT1628_Ram[9] &= ~(1<<1);    //D30

                 gGUA_HT1628_Ram[8] &= ~(1<<7);    //D28

                 gGUA_HT1628_Ram[8] &= ~(1<<4);    //D25

                 gGUA_HT1628_Ram[8] &= ~(1<<6);    //D27                            

                 break;                                

           }    

          

           //D24 D26 D29 D30 D28 D25 D27:1 1 0 1 1 0 1

           case GUA_LIGHT_NUMBER2:

           {               

                 gGUA_HT1628_Ram[8] |= (1<<3);          //D24

                 gGUA_HT1628_Ram[8] |= (1<<5);          //D26

                 gGUA_HT1628_Ram[9] &= ~(1<<0);    //D29

                 gGUA_HT1628_Ram[9] |= (1<<1);          //D30

                 gGUA_HT1628_Ram[8] |= (1<<7);          //D28

                 gGUA_HT1628_Ram[8] &= ~(1<<4);    //D25

                 gGUA_HT1628_Ram[8] |= (1<<6);          //D27                                 

                 break;               

           }

          

           //D24 D26 D29 D30 D28 D25 D27:1 1 1 1 0 0 1

           case GUA_LIGHT_NUMBER3:

           {               

                 gGUA_HT1628_Ram[8] |= (1<<3);          //D24

                 gGUA_HT1628_Ram[8] |= (1<<5);          //D26

                 gGUA_HT1628_Ram[9] |= (1<<0);          //D29

                 gGUA_HT1628_Ram[9] |= (1<<1);          //D30

                 gGUA_HT1628_Ram[8] &= ~(1<<7);    //D28

                 gGUA_HT1628_Ram[8] &= ~(1<<4);    //D25

                 gGUA_HT1628_Ram[8] |= (1<<6);          //D27                                                             

                 break;               

           }

          

           //D24 D26 D29 D30 D28 D25 D27:0 1 1 0 0 1 1

           case GUA_LIGHT_NUMBER4:

           {               

                 gGUA_HT1628_Ram[8] &= ~(1<<3);    //D24

                 gGUA_HT1628_Ram[8] |= (1<<5);          //D26

                 gGUA_HT1628_Ram[9] |= (1<<0);          //D29

                 gGUA_HT1628_Ram[9] &= ~(1<<1);    //D30

                 gGUA_HT1628_Ram[8] &= ~(1<<7);    //D28

                 gGUA_HT1628_Ram[8] |= (1<<4);          //D25

                 gGUA_HT1628_Ram[8] |= (1<<6);          //D27                                                       

                 break;               

           }    

          

           //D24 D26 D29 D30 D28 D25 D27:1 0 1 1 0 1 1

           case GUA_LIGHT_NUMBER5:

           {               

                 gGUA_HT1628_Ram[8] |= (1<<3);          //D24

                 gGUA_HT1628_Ram[8] &= ~(1<<5);    //D26

                 gGUA_HT1628_Ram[9] |= (1<<0);          //D29

                 gGUA_HT1628_Ram[9] |= (1<<1);          //D30

                 gGUA_HT1628_Ram[8] &= ~(1<<7);    //D28

                 gGUA_HT1628_Ram[8] |= (1<<4);          //D25

                 gGUA_HT1628_Ram[8] |= (1<<6);          //D27                                                       

                 break;               

           }    

          

           //D24 D26 D29 D30 D28 D25 D27:1 0 1 1 1 1 1

           case GUA_LIGHT_NUMBER6:

           {    

                 gGUA_HT1628_Ram[8] |= (1<<3);          //D24

                 gGUA_HT1628_Ram[8] &= ~(1<<5);    //D26

                 gGUA_HT1628_Ram[9] |= (1<<0);          //D29

                 gGUA_HT1628_Ram[9] |= (1<<1);          //D30

                 gGUA_HT1628_Ram[8] |= (1<<7);          //D28

                 gGUA_HT1628_Ram[8] |= (1<<4);          //D25

                 gGUA_HT1628_Ram[8] |= (1<<6);          //D27                                       

                 break;               

           }    

          

           //D24 D26 D29 D30 D28 D25 D27:1 1 1 0 0 0 0

           case GUA_LIGHT_NUMBER7:

           {               

                 gGUA_HT1628_Ram[8] |= (1<<3);          //D24

                 gGUA_HT1628_Ram[8] |= (1<<5);          //D26

                 gGUA_HT1628_Ram[9] |= (1<<0);          //D29

                 gGUA_HT1628_Ram[9] &= ~(1<<1);    //D30

                 gGUA_HT1628_Ram[8] &= ~(1<<7);    //D28

                 gGUA_HT1628_Ram[8] &= ~(1<<4);    //D25

                 gGUA_HT1628_Ram[8] &= ~(1<<6);    //D27                                                        

                 break;               

           }    

          

           //D24 D26 D29 D30 D28 D25 D27:1 1 1 1 1 1 1

           case GUA_LIGHT_NUMBER8:

           {               

                 gGUA_HT1628_Ram[8] |= (1<<3);          //D24

                 gGUA_HT1628_Ram[8] |= (1<<5);          //D26

                 gGUA_HT1628_Ram[9] |= (1<<0);          //D29

                 gGUA_HT1628_Ram[9] |= (1<<1);          //D30

                 gGUA_HT1628_Ram[8] |= (1<<7);          //D28

                 gGUA_HT1628_Ram[8] |= (1<<4);          //D25

                 gGUA_HT1628_Ram[8] |= (1<<6);          //D27                                                       

                 break;               

           }               

          

           //D24 D26 D29 D30 D28 D25 D27:1 1 1 1 0 1 1

           case GUA_LIGHT_NUMBER9:

           {               

                 gGUA_HT1628_Ram[8] |= (1<<3);          //D24

                 gGUA_HT1628_Ram[8] |= (1<<5);          //D26

                 gGUA_HT1628_Ram[9] |= (1<<0);          //D29

                 gGUA_HT1628_Ram[9] |= (1<<1);          //D30

                 gGUA_HT1628_Ram[8] &= ~(1<<7);    //D28

                 gGUA_HT1628_Ram[8] |= (1<<4);          //D25

                 gGUA_HT1628_Ram[8] |= (1<<6);          //D27                                                       

                 break;               

           }

          

           //D24 D26 D29 D30 D28 D25 D27:0 0 0 0 0 0 0

           default:

           {               

                 gGUA_HT1628_Ram[8] &= ~(1<<3);    //D24

                 gGUA_HT1628_Ram[8] &= ~(1<<5);    //D26

                 gGUA_HT1628_Ram[9] &= ~(1<<0);    //D29

                 gGUA_HT1628_Ram[9] &= ~(1<<1);    //D30

                 gGUA_HT1628_Ram[8] &= ~(1<<7);    //D28

                 gGUA_HT1628_Ram[8] &= ~(1<<4);    //D25

                 gGUA_HT1628_Ram[8] &= ~(1<<6);    //D27                                                             

                 break;               

           }

      }

      //num4 D31 D33 D36 D37 D35 D32 D34**********************

      switch(stGUA_HT1628_Display.num4)

      {

           //D31 D33 D36 D37 D35 D32 D34:1 1 1 1 1 1 0

           case GUA_LIGHT_NUMBER0:

           {               

                 gGUA_HT1628_Ram[6]    |= (1<<0); //D31

                 gGUA_HT1628_Ram[6]    |= (1<<2); //D33

                 gGUA_HT1628_Ram[6]    |= (1<<5); //D36

                 gGUA_HT1628_Ram[6]  |= (1<<6);    //D37

                 gGUA_HT1628_Ram[6]    |= (1<<4); //D35

                 gGUA_HT1628_Ram[6]    |= (1<<1); //D32

                 gGUA_HT1628_Ram[6]    &= ~(1<<3);      //D34                            

                 break;               

           }

          

           //D31 D33 D36 D37 D35 D32 D34:0 1 1 0 0 0 0

           case GUA_LIGHT_NUMBER1:

           {               

                 gGUA_HT1628_Ram[6]    &= ~(1<<0);      //D31

                 gGUA_HT1628_Ram[6]    |= (1<<2); //D33

                 gGUA_HT1628_Ram[6]    |= (1<<5); //D36

                 gGUA_HT1628_Ram[6]  &= ~(1<<6);   //D37

                 gGUA_HT1628_Ram[6]    &= ~(1<<4);      //D35

                 gGUA_HT1628_Ram[6]    &= ~(1<<1);      //D32

                 gGUA_HT1628_Ram[6]    &= ~(1<<3);      //D34                                            

                 break;                                

           }    

          

           //D31 D33 D36 D37 D35 D32 D34:1 1 0 1 1 0 1

           case GUA_LIGHT_NUMBER2:

           {         

                 gGUA_HT1628_Ram[6]    |= (1<<0); //D31

                 gGUA_HT1628_Ram[6]    |= (1<<2); //D33

                 gGUA_HT1628_Ram[6]    &= ~(1<<5);      //D36

                 gGUA_HT1628_Ram[6]  |= (1<<6);    //D37

                 gGUA_HT1628_Ram[6]    |= (1<<4); //D35

                 gGUA_HT1628_Ram[6]    &= ~(1<<1);      //D32

                 gGUA_HT1628_Ram[6]    |= (1<<3); //D34                      

                 break;               

           }

          

           //D31 D33 D36 D37 D35 D32 D34:1 1 1 1 0 0 1

           case GUA_LIGHT_NUMBER3:

           {         

                 gGUA_HT1628_Ram[6]    |= (1<<0); //D31

                 gGUA_HT1628_Ram[6]    |= (1<<2); //D33

                 gGUA_HT1628_Ram[6]    |= (1<<5); //D36

                 gGUA_HT1628_Ram[6]  |= (1<<6);    //D37

                 gGUA_HT1628_Ram[6]    &= ~(1<<4);      //D35

                 gGUA_HT1628_Ram[6]    &= ~(1<<1);      //D32

                 gGUA_HT1628_Ram[6]    |= (1<<3); //D34                                            

                 break;               

           }

          

           //D31 D33 D36 D37 D35 D32 D34:0 1 1 0 0 1 1

           case GUA_LIGHT_NUMBER4:

           {               

                 gGUA_HT1628_Ram[6]    &= ~(1<<0);      //D31

                 gGUA_HT1628_Ram[6]    |= (1<<2); //D33

                 gGUA_HT1628_Ram[6]    |= (1<<5); //D36

                 gGUA_HT1628_Ram[6]  &= ~(1<<6);   //D37

                 gGUA_HT1628_Ram[6]    &= ~(1<<4);      //D35

                 gGUA_HT1628_Ram[6]    |= (1<<1); //D32

                 gGUA_HT1628_Ram[6]    |= (1<<3); //D34                                                             

                 break;               

           }    

          

           //D31 D33 D36 D37 D35 D32 D34:1 0 1 1 0 1 1

           case GUA_LIGHT_NUMBER5:

           {         

                 gGUA_HT1628_Ram[6]    |= (1<<0); //D31

                 gGUA_HT1628_Ram[6]    &= ~(1<<2);      //D33

                 gGUA_HT1628_Ram[6]    |= (1<<5); //D36

                 gGUA_HT1628_Ram[6]  |= (1<<6);    //D37

                 gGUA_HT1628_Ram[6]    &= ~(1<<4);      //D35

                 gGUA_HT1628_Ram[6]    |= (1<<1); //D32

                 gGUA_HT1628_Ram[6]    |= (1<<3); //D34                                                  

                 break;               

           }    

          

           //D31 D33 D36 D37 D35 D32 D34:1 0 1 1 1 1 1

           case GUA_LIGHT_NUMBER6:

           {    

                 gGUA_HT1628_Ram[6]    |= (1<<0); //D31

                 gGUA_HT1628_Ram[6]    &= ~(1<<2);      //D33

                 gGUA_HT1628_Ram[6]    |= (1<<5); //D36

                 gGUA_HT1628_Ram[6]  |= (1<<6);    //D37

                 gGUA_HT1628_Ram[6]    |= (1<<4); //D35

                 gGUA_HT1628_Ram[6]    |= (1<<1); //D32

                 gGUA_HT1628_Ram[6]    |= (1<<3); //D34                                            

                 break;               

           }    

          

           //D31 D33 D36 D37 D35 D32 D34:1 1 1 0 0 0 0

           case GUA_LIGHT_NUMBER7:

           {               

                 gGUA_HT1628_Ram[6]    |= (1<<0); //D31

                 gGUA_HT1628_Ram[6]    |= (1<<2); //D33

                 gGUA_HT1628_Ram[6]    |= (1<<5); //D36

                 gGUA_HT1628_Ram[6]  &= ~(1<<6);   //D37

                 gGUA_HT1628_Ram[6]    &= ~(1<<4);      //D35

                 gGUA_HT1628_Ram[6]    &= ~(1<<1);      //D32

                 gGUA_HT1628_Ram[6]    &= ~(1<<3);      //D34                                                             

                 break;               

           }    

          

           //D31 D33 D36 D37 D35 D32 D34:1 1 1 1 1 1 1

           case GUA_LIGHT_NUMBER8:

           {               

                 gGUA_HT1628_Ram[6]    |= (1<<0); //D31

                 gGUA_HT1628_Ram[6]    |= (1<<2); //D33

                 gGUA_HT1628_Ram[6]    |= (1<<5); //D36

                 gGUA_HT1628_Ram[6]  |= (1<<6);    //D37

                 gGUA_HT1628_Ram[6]    |= (1<<4); //D35

                 gGUA_HT1628_Ram[6]    |= (1<<1); //D32

                 gGUA_HT1628_Ram[6]    |= (1<<3); //D34                                                             

                 break;               

           }               

          

           //D31 D33 D36 D37 D35 D32 D34:1 1 1 1 0 1 1

           case GUA_LIGHT_NUMBER9:

           {         

                 gGUA_HT1628_Ram[6]    |= (1<<0); //D31

                 gGUA_HT1628_Ram[6]    |= (1<<2); //D33

                 gGUA_HT1628_Ram[6]    |= (1<<5); //D36

                 gGUA_HT1628_Ram[6]  |= (1<<6);    //D37

                 gGUA_HT1628_Ram[6]    &= ~(1<<4);      //D35

                 gGUA_HT1628_Ram[6]    |= (1<<1); //D32

                 gGUA_HT1628_Ram[6]    |= (1<<3); //D34                                            

                 break;               

           }

          

           //D31 D33 D36 D37 D35 D32 D34:0 0 0 0 0 0 0

           default:

           {               

                 gGUA_HT1628_Ram[6]    &= ~(1<<0);      //D31

                 gGUA_HT1628_Ram[6]    &= ~(1<<2);      //D33

                 gGUA_HT1628_Ram[6]    &= ~(1<<5);      //D36

                 gGUA_HT1628_Ram[6]  &= ~(1<<6);   //D37

                 gGUA_HT1628_Ram[6]    &= ~(1<<4);      //D35

                 gGUA_HT1628_Ram[6]    &= ~(1<<1);      //D32

                 gGUA_HT1628_Ram[6]    &= ~(1<<3);      //D34                                                                        

                 break;               

           }

      }

      //num5 D38 D40 D43 D44 D42 D39 D41**********************

      switch(stGUA_HT1628_Display.num5)

      {

           //D38 D40 D43 D44 D42 D39 D41:1 1 1 1 1 1 0

           case GUA_LIGHT_NUMBER0:

           {                          

                 gGUA_HT1628_Ram[6]    |= (1<<7); //D38

                 gGUA_HT1628_Ram[7]    |= (1<<1); //D40

                 gGUA_HT1628_Ram[4]    |= (1<<2); //D43

                 gGUA_HT1628_Ram[4]  |= (1<<3);    //D44

                 gGUA_HT1628_Ram[4]    |= (1<<1); //D42

                 gGUA_HT1628_Ram[7]    |= (1<<0); //D39

                 gGUA_HT1628_Ram[4]    &= ~(1<<0);      //D41                      

                 break;               

           }

          

           //D38 D40 D43 D44 D42 D39 D41:0 1 1 0 0 0 0

           case GUA_LIGHT_NUMBER1:

           {               

                 gGUA_HT1628_Ram[6]    &= ~(1<<7);      //D38

                 gGUA_HT1628_Ram[7]    |= (1<<1); //D40

                 gGUA_HT1628_Ram[4]    |= (1<<2); //D43

                 gGUA_HT1628_Ram[4]  &= ~(1<<3);   //D44

                 gGUA_HT1628_Ram[4]    &= ~(1<<1);      //D42

                 gGUA_HT1628_Ram[7]    &= ~(1<<0);      //D39

                 gGUA_HT1628_Ram[4]    &= ~(1<<0);      //D41                                            

                 break;                                

           }    

          

           //D38 D40 D43 D44 D42 D39 D41:1 1 0 1 1 0 1

           case GUA_LIGHT_NUMBER2:

           {         

                 gGUA_HT1628_Ram[6]    |= (1<<7); //D38

                 gGUA_HT1628_Ram[7]    |= (1<<1); //D40

                 gGUA_HT1628_Ram[4]    &= ~(1<<2);      //D43

                 gGUA_HT1628_Ram[4]  |= (1<<3);    //D44

                 gGUA_HT1628_Ram[4]    |= (1<<1); //D42

                 gGUA_HT1628_Ram[7]    &= ~(1<<0);      //D39

                 gGUA_HT1628_Ram[4]    |= (1<<0); //D41                

                 break;               

           }

          

           //D38 D40 D43 D44 D42 D39 D41:1 1 1 1 0 0 1

           case GUA_LIGHT_NUMBER3:

           {               

                 gGUA_HT1628_Ram[6]    |= (1<<7); //D38

                 gGUA_HT1628_Ram[7]    |= (1<<1); //D40

                 gGUA_HT1628_Ram[4]    |= (1<<2); //D43

                 gGUA_HT1628_Ram[4]  |= (1<<3);    //D44

                 gGUA_HT1628_Ram[4]    &= ~(1<<1);      //D42

                 gGUA_HT1628_Ram[7]    &= ~(1<<0);      //D39

                 gGUA_HT1628_Ram[4]    |= (1<<0); //D41                                                        

                 break;               

           }

          

           //D38 D40 D43 D44 D42 D39 D41:0 1 1 0 0 1 1

           case GUA_LIGHT_NUMBER4:

           {               

                 gGUA_HT1628_Ram[6]    &= ~(1<<7);      //D38

                 gGUA_HT1628_Ram[7]    |= (1<<1); //D40

                 gGUA_HT1628_Ram[4]    |= (1<<2); //D43

                 gGUA_HT1628_Ram[4]  &= ~(1<<3);   //D44

                 gGUA_HT1628_Ram[4]    &= ~(1<<1);      //D42

                 gGUA_HT1628_Ram[7]    |= (1<<0); //D39

                 gGUA_HT1628_Ram[4]    |= (1<<0); //D41                                                             

                 break;               

           }    

          

           //D38 D40 D43 D44 D42 D39 D41:1 0 1 1 0 1 1

           case GUA_LIGHT_NUMBER5:

           {         

                 gGUA_HT1628_Ram[6]    |= (1<<7); //D38

                 gGUA_HT1628_Ram[7]    &= ~(1<<1);      //D40

                 gGUA_HT1628_Ram[4]    |= (1<<2); //D43

                 gGUA_HT1628_Ram[4]  |= (1<<3);    //D44

                 gGUA_HT1628_Ram[4]    &= ~(1<<1);      //D42

                 gGUA_HT1628_Ram[7]    |= (1<<0); //D39

                 gGUA_HT1628_Ram[4]    |= (1<<0); //D41                                       

                 break;               

           }    

          

           //D38 D40 D43 D44 D42 D39 D41:1 0 1 1 1 1 1

           case GUA_LIGHT_NUMBER6:

           {    

                 gGUA_HT1628_Ram[6]    |= (1<<7); //D38

                 gGUA_HT1628_Ram[7]    &= ~(1<<1);      //D40

                 gGUA_HT1628_Ram[4]    |= (1<<2); //D43

                 gGUA_HT1628_Ram[4]  |= (1<<3);    //D44

                 gGUA_HT1628_Ram[4]    |= (1<<1); //D42

                 gGUA_HT1628_Ram[7]    |= (1<<0); //D39

                 gGUA_HT1628_Ram[4]    |= (1<<0); //D41                                       

                 break;               

           }    

          

           //D38 D40 D43 D44 D42 D39 D41:1 1 1 0 0 0 0

           case GUA_LIGHT_NUMBER7:

           {               

                 gGUA_HT1628_Ram[6]    |= (1<<7); //D38

                 gGUA_HT1628_Ram[7]    |= (1<<1); //D40

                 gGUA_HT1628_Ram[4]    |= (1<<2); //D43

                 gGUA_HT1628_Ram[4]  &= ~(1<<3);   //D44

                 gGUA_HT1628_Ram[4]    &= ~(1<<1);      //D42

                 gGUA_HT1628_Ram[7]    &= ~(1<<0);      //D39

                 gGUA_HT1628_Ram[4]    &= ~(1<<0);      //D41                                                       

                 break;               

           }    

          

           //D38 D40 D43 D44 D42 D39 D41:1 1 1 1 1 1 1

           case GUA_LIGHT_NUMBER8:

           {               

                 gGUA_HT1628_Ram[6]    |= (1<<7); //D38

                 gGUA_HT1628_Ram[7]    |= (1<<1); //D40

                 gGUA_HT1628_Ram[4]    |= (1<<2); //D43

                 gGUA_HT1628_Ram[4]  |= (1<<3);    //D44

                 gGUA_HT1628_Ram[4]    |= (1<<1); //D42

                 gGUA_HT1628_Ram[7]    |= (1<<0); //D39

                 gGUA_HT1628_Ram[4]    |= (1<<0); //D41                                                        

                 break;               

           }               

          

           //D38 D40 D43 D44 D42 D39 D41:1 1 1 1 0 1 1

           case GUA_LIGHT_NUMBER9:

           {               

                 gGUA_HT1628_Ram[6]    |= (1<<7); //D38

                 gGUA_HT1628_Ram[7]    |= (1<<1); //D40

                 gGUA_HT1628_Ram[4]    |= (1<<2); //D43

                 gGUA_HT1628_Ram[4]  |= (1<<3);    //D44

                 gGUA_HT1628_Ram[4]    &= ~(1<<1);      //D42

                 gGUA_HT1628_Ram[7]    |= (1<<0); //D39

                 gGUA_HT1628_Ram[4]    |= (1<<0); //D41                                                        

                 break;               

           }

          

           //D38 D40 D43 D44 D42 D39 D41:0 0 0 0 0 0 0

           default:

           {         

                 gGUA_HT1628_Ram[6]    &= ~(1<<7);      //D38

                 gGUA_HT1628_Ram[7]    &= ~(1<<1);      //D40

                 gGUA_HT1628_Ram[4]    &= ~(1<<2);      //D43

                 gGUA_HT1628_Ram[4]  &= ~(1<<3);   //D44

                 gGUA_HT1628_Ram[4]    &= ~(1<<1);      //D42

                 gGUA_HT1628_Ram[7]    &= ~(1<<0);      //D39

                 gGUA_HT1628_Ram[4]    &= ~(1<<0);      //D41                                            

                 break;               

           }

      }

      //num6 D46 D48 D51 D52 D50 D47 D49**********************

      switch(stGUA_HT1628_Display.num6)

      {

           //D46 D48 D51 D52 D50 D47 D49:1 1 1 1 1 1 0

           case GUA_LIGHT_NUMBER0:

           {               

                 gGUA_HT1628_Ram[4]    |= (1<<5); //D46

                 gGUA_HT1628_Ram[4]    |= (1<<7); //D48

                 gGUA_HT1628_Ram[2]    |= (1<<0); //D51

                 gGUA_HT1628_Ram[2]  |= (1<<1);    //D52

                 gGUA_HT1628_Ram[5]    |= (1<<1); //D50

                 gGUA_HT1628_Ram[4]    |= (1<<6); //D47

                 gGUA_HT1628_Ram[5]    &= ~(1<<0);      //D49                      

                 break;               

           }

          

           //D46 D48 D51 D52 D50 D47 D49:0 1 1 0 0 0 0

           case GUA_LIGHT_NUMBER1:

           {         

                 gGUA_HT1628_Ram[4]    &= ~(1<<5);      //D46

                 gGUA_HT1628_Ram[4]    |= (1<<7); //D48

                 gGUA_HT1628_Ram[2]    |= (1<<0); //D51

                 gGUA_HT1628_Ram[2]  &= ~(1<<1);   //D52

                 gGUA_HT1628_Ram[5]    &= ~(1<<1);      //D50

                 gGUA_HT1628_Ram[4]    &= ~(1<<6);      //D47

                 gGUA_HT1628_Ram[5]    &= ~(1<<0);      //D49                            

                 break;                                

           }    

          

           //D46 D48 D51 D52 D50 D47 D49:1 1 0 1 1 0 1

           case GUA_LIGHT_NUMBER2:

           {    

                 gGUA_HT1628_Ram[4]    |= (1<<5); //D46

                 gGUA_HT1628_Ram[4]    |= (1<<7); //D48

                 gGUA_HT1628_Ram[2]    &= ~(1<<0);      //D51

                 gGUA_HT1628_Ram[2]  |= (1<<1);    //D52

                 gGUA_HT1628_Ram[5]    |= (1<<1); //D50

                 gGUA_HT1628_Ram[4]    &= ~(1<<6);      //D47

                 gGUA_HT1628_Ram[5]    |= (1<<0); //D49                

                 break;               

           }

          

           //D46 D48 D51 D52 D50 D47 D49:1 1 1 1 0 0 1

           case GUA_LIGHT_NUMBER3:

           {         

                 gGUA_HT1628_Ram[4]    |= (1<<5); //D46

                 gGUA_HT1628_Ram[4]    |= (1<<7); //D48

                 gGUA_HT1628_Ram[2]    |= (1<<0); //D51

                 gGUA_HT1628_Ram[2]  |= (1<<1);    //D52

                 gGUA_HT1628_Ram[5]    &= ~(1<<1);      //D50

                 gGUA_HT1628_Ram[4]    &= ~(1<<6);      //D47

                 gGUA_HT1628_Ram[5]    |= (1<<0); //D49                                                  

                 break;               

           }

          

           //D46 D48 D51 D52 D50 D47 D49:0 1 1 0 0 1 1

           case GUA_LIGHT_NUMBER4:

           {               

                 gGUA_HT1628_Ram[4]    &= ~(1<<5);      //D46

                 gGUA_HT1628_Ram[4]    |= (1<<7); //D48

                 gGUA_HT1628_Ram[2]    |= (1<<0); //D51

                 gGUA_HT1628_Ram[2]  &= ~(1<<1);   //D52

                 gGUA_HT1628_Ram[5]    &= ~(1<<1);      //D50

                 gGUA_HT1628_Ram[4]    |= (1<<6); //D47

                 gGUA_HT1628_Ram[5]    |= (1<<0); //D49                                                             

                 break;               

           }    

          

           //D46 D48 D51 D52 D50 D47 D49:1 0 1 1 0 1 1

           case GUA_LIGHT_NUMBER5:

           {               

                 gGUA_HT1628_Ram[4]    |= (1<<5); //D46

                 gGUA_HT1628_Ram[4]    &= ~(1<<7);      //D48

                 gGUA_HT1628_Ram[2]    |= (1<<0); //D51

                 gGUA_HT1628_Ram[2]  |= (1<<1);    //D52

                 gGUA_HT1628_Ram[5]    &= ~(1<<1);      //D50

                 gGUA_HT1628_Ram[4]    |= (1<<6); //D47

                 gGUA_HT1628_Ram[5]    |= (1<<0); //D49                                                             

                 break;               

           }    

          

           //D46 D48 D51 D52 D50 D47 D49:1 0 1 1 1 1 1

           case GUA_LIGHT_NUMBER6:

           {    

                 gGUA_HT1628_Ram[4]    |= (1<<5); //D46

                 gGUA_HT1628_Ram[4]    &= ~(1<<7);      //D48

                 gGUA_HT1628_Ram[2]    |= (1<<0); //D51

                 gGUA_HT1628_Ram[2]  |= (1<<1);    //D52

                 gGUA_HT1628_Ram[5]    |= (1<<1); //D50

                 gGUA_HT1628_Ram[4]    |= (1<<6); //D47

                 gGUA_HT1628_Ram[5]    |= (1<<0); //D49                                            

                 break;               

           }    

          

           //D46 D48 D51 D52 D50 D47 D49:1 1 1 0 0 0 0

           case GUA_LIGHT_NUMBER7:

           {               

                 gGUA_HT1628_Ram[4]    |= (1<<5); //D46

                 gGUA_HT1628_Ram[4]    |= (1<<7); //D48

                 gGUA_HT1628_Ram[2]    |= (1<<0); //D51

                 gGUA_HT1628_Ram[2]  &= ~(1<<1);   //D52

                 gGUA_HT1628_Ram[5]    &= ~(1<<1);      //D50

                 gGUA_HT1628_Ram[4]    &= ~(1<<6);      //D47

                 gGUA_HT1628_Ram[5]    &= ~(1<<0);      //D49                                                             

                 break;               

           }    

          

           //D46 D48 D51 D52 D50 D47 D49:1 1 1 1 1 1 1

           case GUA_LIGHT_NUMBER8:

           {               

                 gGUA_HT1628_Ram[4]    |= (1<<5); //D46

                 gGUA_HT1628_Ram[4]    |= (1<<7); //D48

                 gGUA_HT1628_Ram[2]    |= (1<<0); //D51

                 gGUA_HT1628_Ram[2]  |= (1<<1);    //D52

                 gGUA_HT1628_Ram[5]    |= (1<<1); //D50

                 gGUA_HT1628_Ram[4]    |= (1<<6); //D47

                 gGUA_HT1628_Ram[5]    |= (1<<0); //D49                                                             

                 break;               

           }               

          

           //D46 D48 D51 D52 D50 D47 D49:1 1 1 1 0 1 1

           case GUA_LIGHT_NUMBER9:

           {               

                 gGUA_HT1628_Ram[4]    |= (1<<5); //D46

                 gGUA_HT1628_Ram[4]    |= (1<<7); //D48

                 gGUA_HT1628_Ram[2]    |= (1<<0); //D51

                 gGUA_HT1628_Ram[2]  |= (1<<1);    //D52

                 gGUA_HT1628_Ram[5]    &= ~(1<<1);      //D50

                 gGUA_HT1628_Ram[4]    |= (1<<6); //D47

                 gGUA_HT1628_Ram[5]    |= (1<<0); //D49                                                             

                 break;               

           }

          

           //D46 D48 D51 D52 D50 D47 D49:0 0 0 0 0 0 0

           default:

           {               

                 gGUA_HT1628_Ram[4]    &= ~(1<<5);      //D46

                 gGUA_HT1628_Ram[4]    &= ~(1<<7);      //D48

                 gGUA_HT1628_Ram[2]    &= ~(1<<0);      //D51

                 gGUA_HT1628_Ram[2]  &= ~(1<<1);   //D52

                 gGUA_HT1628_Ram[5]    &= ~(1<<1);      //D50

                 gGUA_HT1628_Ram[4]    &= ~(1<<6);      //D47

                 gGUA_HT1628_Ram[5]    &= ~(1<<0);      //D49                                                                        

                 break;               

           }

      }

      //num7 D53 D55 D58 D59 D57 D54 D56**********************

      switch(stGUA_HT1628_Display.num7)

      {

           //D53 D55 D58 D59 D57 D54 D56:1 1 1 1 1 1 0

           case GUA_LIGHT_NUMBER0:

           {               

                 gGUA_HT1628_Ram[2]    |= (1<<2); //D53

                 gGUA_HT1628_Ram[2]    |= (1<<4); //D55

                 gGUA_HT1628_Ram[2]    |= (1<<7); //D58

                 gGUA_HT1628_Ram[3]  |= (1<<0);    //D59

                 gGUA_HT1628_Ram[2]    |= (1<<6); //D57

                 gGUA_HT1628_Ram[2]    |= (1<<3); //D54

                 gGUA_HT1628_Ram[2]    &= ~(1<<5);      //D56                            

                 break;               

           }

          

           //D53 D55 D58 D59 D57 D54 D56:0 1 1 0 0 0 0

           case GUA_LIGHT_NUMBER1:

           {               

                 gGUA_HT1628_Ram[2]    &= ~(1<<2);      //D53

                 gGUA_HT1628_Ram[2]    |= (1<<4); //D55

                 gGUA_HT1628_Ram[2]    |= (1<<7); //D58

                 gGUA_HT1628_Ram[3]  &= ~(1<<0);   //D59

                 gGUA_HT1628_Ram[2]    &= ~(1<<6);      //D57

                 gGUA_HT1628_Ram[2]    &= ~(1<<3);      //D54

                 gGUA_HT1628_Ram[2]    &= ~(1<<5);      //D56                                                  

                 break;                                

           }    

          

           //D53 D55 D58 D59 D57 D54 D56:1 1 0 1 1 0 1

           case GUA_LIGHT_NUMBER2:

           {               

                 gGUA_HT1628_Ram[2]    |= (1<<2); //D53

                 gGUA_HT1628_Ram[2]    |= (1<<4); //D55

                 gGUA_HT1628_Ram[2]    &= ~(1<<7);      //D58

                 gGUA_HT1628_Ram[3]  |= (1<<0);    //D59

                 gGUA_HT1628_Ram[2]    |= (1<<6); //D57

                 gGUA_HT1628_Ram[2]    &= ~(1<<3);      //D54

                 gGUA_HT1628_Ram[2]    |= (1<<5); //D56                                            

                 break;               

           }

          

           //D53 D55 D58 D59 D57 D54 D56:1 1 1 1 0 0 1

           case GUA_LIGHT_NUMBER3:

           {               

                 gGUA_HT1628_Ram[2]    |= (1<<2); //D53

                 gGUA_HT1628_Ram[2]    |= (1<<4); //D55

                 gGUA_HT1628_Ram[2]    |= (1<<7); //D58

                 gGUA_HT1628_Ram[3]  |= (1<<0);    //D59

                 gGUA_HT1628_Ram[2]    &= ~(1<<6);      //D57

                 gGUA_HT1628_Ram[2]    &= ~(1<<3);      //D54

                 gGUA_HT1628_Ram[2]    |= (1<<5); //D56                                                        

                 break;               

           }

          

           //D53 D55 D58 D59 D57 D54 D56:0 1 1 0 0 1 1

           case GUA_LIGHT_NUMBER4:

           {               

                 gGUA_HT1628_Ram[2]    &= ~(1<<2);      //D53

                 gGUA_HT1628_Ram[2]    |= (1<<4); //D55

                 gGUA_HT1628_Ram[2]    |= (1<<7); //D58

                 gGUA_HT1628_Ram[3]  &= ~(1<<0);   //D59

                 gGUA_HT1628_Ram[2]    &= ~(1<<6);      //D57

                 gGUA_HT1628_Ram[2]    |= (1<<3); //D54

                 gGUA_HT1628_Ram[2]    |= (1<<5); //D56                                                        

                 break;               

           }    

          

           //D53 D55 D58 D59 D57 D54 D56:1 0 1 1 0 1 1

           case GUA_LIGHT_NUMBER5:

           {               

                 gGUA_HT1628_Ram[2]    |= (1<<2); //D53

                 gGUA_HT1628_Ram[2]    &= ~(1<<4);      //D55

                 gGUA_HT1628_Ram[2]    |= (1<<7); //D58

                 gGUA_HT1628_Ram[3]  |= (1<<0);    //D59

                 gGUA_HT1628_Ram[2]    &= ~(1<<6);      //D57

                 gGUA_HT1628_Ram[2]    |= (1<<3); //D54

                 gGUA_HT1628_Ram[2]    |= (1<<5); //D56                                                        

                 break;               

           }    

          

           //D53 D55 D58 D59 D57 D54 D56:1 0 1 1 1 1 1

           case GUA_LIGHT_NUMBER6:

           {    

                 gGUA_HT1628_Ram[2]    |= (1<<2); //D53

                 gGUA_HT1628_Ram[2]    &= ~(1<<4);      //D55

                 gGUA_HT1628_Ram[2]    |= (1<<7); //D58

                 gGUA_HT1628_Ram[3]  |= (1<<0);    //D59

                 gGUA_HT1628_Ram[2]    |= (1<<6); //D57

                 gGUA_HT1628_Ram[2]    |= (1<<3); //D54

                 gGUA_HT1628_Ram[2]    |= (1<<5); //D56                                       

                 break;               

           }    

          

           //D53 D55 D58 D59 D57 D54 D56:1 1 1 0 0 0 0

           case GUA_LIGHT_NUMBER7:

           {               

                 gGUA_HT1628_Ram[2]    |= (1<<2); //D53

                 gGUA_HT1628_Ram[2]    |= (1<<4); //D55

                 gGUA_HT1628_Ram[2]    |= (1<<7); //D58

                 gGUA_HT1628_Ram[3]  &= ~(1<<0);   //D59

                 gGUA_HT1628_Ram[2]    &= ~(1<<6);      //D57

                 gGUA_HT1628_Ram[2]    &= ~(1<<3);      //D54

                 gGUA_HT1628_Ram[2]    &= ~(1<<5);      //D56                                                       

                 break;               

           }    

          

           //D53 D55 D58 D59 D57 D54 D56:1 1 1 1 1 1 1

           case GUA_LIGHT_NUMBER8:

           {               

                 gGUA_HT1628_Ram[2]    |= (1<<2); //D53

                 gGUA_HT1628_Ram[2]    |= (1<<4); //D55

                 gGUA_HT1628_Ram[2]    |= (1<<7); //D58

                 gGUA_HT1628_Ram[3]  |= (1<<0);    //D59

                 gGUA_HT1628_Ram[2]    |= (1<<6); //D57

                 gGUA_HT1628_Ram[2]    |= (1<<3); //D54

                 gGUA_HT1628_Ram[2]    |= (1<<5); //D56                                                        

                 break;               

           }               

          

           //D53 D55 D58 D59 D57 D54 D56:1 1 1 1 0 1 1

           case GUA_LIGHT_NUMBER9:

           {               

                 gGUA_HT1628_Ram[2]    |= (1<<2); //D53

                 gGUA_HT1628_Ram[2]    |= (1<<4); //D55

                 gGUA_HT1628_Ram[2]    |= (1<<7); //D58

                 gGUA_HT1628_Ram[3]  |= (1<<0);    //D59

                 gGUA_HT1628_Ram[2]    &= ~(1<<6);      //D57

                 gGUA_HT1628_Ram[2]    |= (1<<3); //D54

                 gGUA_HT1628_Ram[2]    |= (1<<5); //D56                                                        

                 break;               

           }

          

           //D53 D55 D58 D59 D57 D54 D56:0 0 0 0 0 0 0

           default:

           {               

                 gGUA_HT1628_Ram[2]    &= ~(1<<2);      //D53

                 gGUA_HT1628_Ram[2]    &= ~(1<<4);      //D55

                 gGUA_HT1628_Ram[2]    &= ~(1<<7);      //D58

                 gGUA_HT1628_Ram[3]  &= ~(1<<0);   //D59

                 gGUA_HT1628_Ram[2]    &= ~(1<<6);      //D57

                 gGUA_HT1628_Ram[2]    &= ~(1<<3);      //D54

                 gGUA_HT1628_Ram[2]    &= ~(1<<5);      //D56                                                             

                 break;               

           }

      }    

}

//**********************************************************************

//name:         GUA_HT1628_GPIO_Init

//introduce:    HT1628的GPIO初始化

//parameter:    none

//return:       none

//author:       甜甜的大香瓜

//email:        897503845@qq.com

//shop:         opengua.taobao.com

//changetime:   2023.02.02

//**********************************************************************

static void GUA_HT1628_GPIO_Init(void)

{

      GPIO_InitTypeDef GPIO_InitStructure;

      //PIO1_1 STB,注意不能同时初始化多个IO

      GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;

      GPIO_InitStructure.GPIO_Speed = GPIO_Speed_Level_2;

      GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;

      GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;

      GPIO_Init(GPIO1, &GPIO_InitStructure);

     

      //PIO1_4 CLK,注意不能同时初始化多个IO

      GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;

      GPIO_InitStructure.GPIO_Speed = GPIO_Speed_Level_2;

      GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;

      GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;

      GPIO_Init(GPIO1, &GPIO_InitStructure);

     

      //PIO1_5 DIO,注意不能同时初始化多个IO

      GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;

      GPIO_InitStructure.GPIO_Speed = GPIO_Speed_Level_2;

      GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;

      GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;

      GPIO_Init(GPIO1, &GPIO_InitStructure);

      //初始化io的电平

      GUA_STB_H;

      GUA_DIO_H;

      GUA_CLK_H;

}

//**********************************************************************

//name:         GUA_HT1628_SendCMD

//introduce:    发送指令函数

//parameter:    nGUA_CMD:要发送的指令

//return:       none

//author:       甜甜的大香瓜

//email:        897503845@qq.com

//shop:         opengua.taobao.com

//changetime:   2023.02.02

//**********************************************************************

static void GUA_HT1628_SendCMD(GUA_U8 nGUA_CMD)

{

  GUA_U8 i;

      //拉高

      GUA_STB_H;

      GUA_Delay_Us(1);

     

      //拉低

      GUA_STB_L;

      GUA_Delay_Us(1);

     

     

      //按位写入

  for(i=0; i<8; i++)

  {   

    GUA_CLK_L;

           GUA_Delay_Us(1);

          

    if(nGUA_CMD & 0x01)

    {

      GUA_DIO_H;

    }

    else 

    {

      GUA_DIO_L;

    }     

    nGUA_CMD >>= 1;

          

    GUA_CLK_H;

           GUA_Delay_Us(1);

  }

}

//**********************************************************************

//name:         GUA_HT1628_SendData

//introduce:    发送数据函数

//parameter:    nGUA_Data:要发送的数据

//return:       none

//author:       甜甜的大香瓜

//email:        897503845@qq.com

//shop:         opengua.taobao.com

//changetime:   2023.02.02

//**********************************************************************

static void GUA_HT1628_SendData(GUA_U8 nGUA_Data)

{

  GUA_U8 i;

      //按位写入

  for(i=0; i<8; i++)

  {   

    GUA_CLK_L;

           GUA_Delay_Us(1);

          

    if (nGUA_Data & 0x01)  

    {

      GUA_DIO_H;

    }

    else 

    {

      GUA_DIO_L;

    }

    nGUA_Data >>= 1;

          

    GUA_CLK_H;

           GUA_Delay_Us(1);

  }

}

//**********************************************************************

//name:         GUA_HT1628_Display

//introduce:    将结构体数据对应显示到led上

//parameter:    none

//return:       none

//author:       甜甜的大香瓜

//email:        897503845@qq.com

//shop:         opengua.taobao.com

//changetime:   2023.02.02

//**********************************************************************

void GUA_HT1628_Display(void)

{

      GUA_U8 i = 0;

      //将结构体数据转换到数组中

      GUA_HT1628_DataConvert();

     

  //3条设置指令

  GUA_HT1628_SendCMD(0x03);   //指令1 7位10段

  GUA_HT1628_SendCMD(0x40);   //指令2 地址自动增加模式

  GUA_HT1628_SendCMD(0xC0);   //指令3 设置显示地址为00

      //指令3带的14个字节数据初始化

      for(i=0; i<14; i++)

      {

           GUA_HT1628_SendData(gGUA_HT1628_Ram[i]);    

      }

 

      //最后一条设置指令

  GUA_HT1628_SendCMD((0x80|stGUA_HT1628_Display.pulse_width|stGUA_HT1628_Display.onoff));

}

//**********************************************************************

//name:         GUA_HT1628_Init

//introduce:    初始化函数

//parameter:    none

//return:       none

//author:       甜甜的大香瓜

//email:        897503845@qq.com

//shop:         opengua.taobao.com

//changetime:   2023.02.02

//**********************************************************************

void GUA_HT1628_Init(void)

{

      //初始化IO

      GUA_HT1628_GPIO_Init();

     

      //延时,如果不加延时,全速时会写入不正常

      GUA_Delay_Ms(1);

     

      //填充初始数据

      stGUA_HT1628_Display.left_button = GUA_LIGHT_PART_ON;

      stGUA_HT1628_Display.right_button = GUA_LIGHT_PART_ON;

      stGUA_HT1628_Display.num1 = GUA_LIGHT_NUMBER8;

      stGUA_HT1628_Display.num2 = GUA_LIGHT_NUMBER8;

      stGUA_HT1628_Display.num3 = GUA_LIGHT_NUMBER8;

      stGUA_HT1628_Display.num4 = GUA_LIGHT_NUMBER8;

      stGUA_HT1628_Display.num5 = GUA_LIGHT_NUMBER8;

      stGUA_HT1628_Display.num6 = GUA_LIGHT_NUMBER8;

      stGUA_HT1628_Display.num7 = GUA_LIGHT_NUMBER8;

      stGUA_HT1628_Display.lb = GUA_LIGHT_PART_ON;

      stGUA_HT1628_Display.kg = GUA_LIGHT_PART_ON;

      stGUA_HT1628_Display.oz = GUA_LIGHT_PART_ON;

      stGUA_HT1628_Display.g = GUA_LIGHT_PART_ON;

      stGUA_HT1628_Display.point = GUA_LIGHT_PART_ON;

      stGUA_HT1628_Display.pulse_width = GUA_LIGHT_PULSE_WIDTH_13_16;   

      stGUA_HT1628_Display.onoff = GUA_LIGHT_ON;  

     

      //数据显示

      GUA_HT1628_Display();

}

2)编写驱动头文件GUA_HT1628.h

(存放在“……\Projects\MT006_StdPeriph_Templates\GUA”)

//**********************************************************************

//name:         GUA_HT1628.h

//introduce:    LED驱动的头文件

//author:       甜甜的大香瓜     

//email:        897503845@qq.com  

//shop:         opengua.taobao.com

//changetime:   2023.02.02

//**********************************************************************

#ifndef _GUA_HT1628_H_

#define _GUA_HT1628_H_

/*********************宏定义************************/

//类型宏

#ifndef GUA_C

typedef char GUA_C;

#endif

#ifndef GUA_U8

typedef unsigned char GUA_U8;

#endif

#ifndef GUA_8

typedef signed char GUA_8;

#endif

#ifndef GUA_U16

typedef unsigned short GUA_U16;

#endif

#ifndef GUA_16

typedef signed short GUA_16;

#endif

#ifndef GUA_U32

typedef unsigned long GUA_U32;

#endif

#ifndef GUA_32

typedef signed long GUA_32;

#endif

//显示结构体使用的宏

//数码管之外的灯用的宏

#define GUA_LIGHT_PART_ON                          1        //开启对应功能的灯

#define GUA_LIGHT_PART_OFF                     0        //关闭对应功能的灯

//数码管用的宏

#define GUA_LIGHT_NUMBER0                          0

#define GUA_LIGHT_NUMBER1                          1

#define GUA_LIGHT_NUMBER2                          2

#define GUA_LIGHT_NUMBER3                          3

#define GUA_LIGHT_NUMBER4                          4

#define GUA_LIGHT_NUMBER5                          5

#define GUA_LIGHT_NUMBER6                           6

#define GUA_LIGHT_NUMBER7                          7

#define GUA_LIGHT_NUMBER8                          8

#define GUA_LIGHT_NUMBER9                          9

#define GUA_LIGHT_NUMBER_OFF                   255

//控制亮度的宏

#define GUA_LIGHT_PULSE_WIDTH_1_16   0        //PWM 1/16 最暗

#define GUA_LIGHT_PULSE_WIDTH_2_16   1        //PWM 2/16

#define GUA_LIGHT_PULSE_WIDTH_4_16   2        //PWM 4/16

#define GUA_LIGHT_PULSE_WIDTH_10_16  3        //PWM 10/16

#define GUA_LIGHT_PULSE_WIDTH_11_16  4        //PWM 11/16

#define GUA_LIGHT_PULSE_WIDTH_12_16  5        //PWM 12/16

#define GUA_LIGHT_PULSE_WIDTH_13_16  6        //PWM 13/16 最亮

//控制总开关的宏

#define GUA_LIGHT_ON                                    0x08//打开显示的总开关

#define GUA_LIGHT_OFF                                   0x00//关闭显示的总开关

/*********************外部变量************************/

typedef struct

{

     GUA_U8 left_button;

     GUA_U8 right_button;

     GUA_U8 num1;

     GUA_U8 num2;

     GUA_U8 num3;

     GUA_U8 num4;

     GUA_U8 num5;

     GUA_U8 num6;

     GUA_U8 num7;

     GUA_U8 lb;

     GUA_U8 kg;

     GUA_U8 oz;

     GUA_U8 g;

     GUA_U8 point;

     GUA_U8 pulse_width;

     GUA_U8 onoff;

}GUA_HT1628_DISPLAY;

extern GUA_HT1628_DISPLAY stGUA_HT1628_Display;

/*********************外部函数声明************************/

extern void GUA_HT1628_Display(void);

extern void GUA_HT1628_Init(void);

#endif

3)工程中添加驱动文件

 

4)在MDK设置中添加驱动源文件路径

2、添加库的驱动

1)添加库的驱动文件(为了方便一次性都添加进来,已有则不用添加)

2)添加库的驱动头文件(mt006_conf.h 中)(为了方便一次性都添加进来,已有则不用添加)

3、在应用层中调用

1)添加驱动头文件(main.c中)

#include "GUA_HT1628.h"

2)添加驱动初始化代码(main.c的main函数中)

    //LED初始化

    GUA_HT1628_Init(); 

3)添加测试代码(main.c的main函数中)

                    //填充初始数据

                    stGUA_HT1628_Display.left_button = GUA_LIGHT_PART_ON;

                    stGUA_HT1628_Display.right_button = GUA_LIGHT_PART_OFF;

                    stGUA_HT1628_Display.num1 = GUA_LIGHT_NUMBER0;

                    stGUA_HT1628_Display.num2 = GUA_LIGHT_NUMBER_OFF;

                    stGUA_HT1628_Display.num3 = GUA_LIGHT_NUMBER_OFF;

                    stGUA_HT1628_Display.num4 = GUA_LIGHT_NUMBER_OFF;

                    stGUA_HT1628_Display.num5 = GUA_LIGHT_NUMBER_OFF;

                    stGUA_HT1628_Display.num6 = GUA_LIGHT_NUMBER_OFF;

                    stGUA_HT1628_Display.num7 = GUA_LIGHT_NUMBER_OFF;

                    stGUA_HT1628_Display.lb = GUA_LIGHT_PART_OFF;

                    stGUA_HT1628_Display.kg = GUA_LIGHT_PART_OFF;

                    stGUA_HT1628_Display.oz = GUA_LIGHT_PART_OFF;

                    stGUA_HT1628_Display.g = GUA_LIGHT_PART_OFF;

                    stGUA_HT1628_Display.point = GUA_LIGHT_PART_OFF;

                    stGUA_HT1628_Display.pulse_width = GUA_LIGHT_PULSE_WIDTH_13_16;   

                    stGUA_HT1628_Display.onoff = GUA_LIGHT_ON; 

                   

                    //数据显示

                    GUA_HT1628_Display();  

这里是只亮左边触摸按键边上的3个led灯,其他灭。

八、注意事项

暂无

九、实验结果

暂无

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/893684.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【实用黑科技】如何 把b站的缓存视频弄到本地——数据恢复软件WinHex 和 音视频转码程序FFmpeg

&#x1f468;‍&#x1f4bb;个人主页&#xff1a;元宇宙-秩沅 &#x1f468;‍&#x1f4bb; hallo 欢迎 点赞&#x1f44d; 收藏⭐ 留言&#x1f4dd; 加关注✅! &#x1f468;‍&#x1f4bb; 本文由 秩沅 原创 &#x1f468;‍&#x1f4bb; 收录于专栏&#xff1a;效率…

Mathematica(42)-计算N个数值的和

比如&#xff0c;我们要用Mathematica求得到下面的式子&#xff1a; 这就需要用到一个函数&#xff1a;Sum 具体地&#xff0c;Sum函数的使用形式如下&#xff1a; 因此&#xff0c;按照公式就可以得到下面的结果&#xff1a; 如果&#xff0c;我们想要将求和号也加进去&#…

三肽-32——修复受损肌肤

简介 昼夜节律是自然界最普遍的一种自然现象, 它的存在使生物体的生理、生化、行为等生命现象表现为以24小时为周期的振荡。昼夜节律发生的物质基础是分子计时器, 即昼夜节律生物钟(circadian clock) 。它由一组特异的核心元件组成, 包括CLOCK (Circadian Locomotor Output Cy…

公路桥梁有哪些安全隐患?

在现代社会&#xff0c;公路桥梁作为连接城市、串联交通的重要纽带&#xff0c;扮演着无可替代的角色。然而&#xff0c;我们常常忽视的是&#xff0c;这些高架构筑物也存在着潜在的安全隐患&#xff0c;可能随时影响着交通的畅通和人们的生命财产安全。为了更好地认识和理解这…

基于百度文心大模型创作的实践与谈论

文心概念 百度文心大模型源于产业、服务于产业&#xff0c;是产业级知识增强大模型。百度通过大模型与国产深度学习框架融合发展&#xff0c;打造了自主创新的AI底座&#xff0c;大幅降低了AI开发和应用的门槛&#xff0c;满足真实场景中的应用需求&#xff0c;真正发挥大模型…

chatglm llm实时流api接口及post访问

参考&#xff1a; https://github.com/THUDM/ChatGLM-6B/pull/573/commits/02947052eefe392fd9f9632894e9551a805c6109 https://github.com/THUDM/ChatGLM-6B/pull/573 1、代码&#xff1a; 提前安装&#xff1a; sse_starlette、fastapi python stream_api.pystream_api.p…

Linux:如何挂载Window的共享目录

本文介绍的方法操作简单快捷&#xff0c;实用性强。下面就让小编来带大家学习“Linux下怎么挂载Window中的共享目录”吧! 一、在Window下创建共享目录 1、首先&#xff0c;在Window下创建一个目录作为共享目录&#xff0c;此处创建的目录名为ShareDir 2、右键目录&#xff0c…

创建密码库/创建用户帐户/更新 Ansible 库的密钥/ 配置cron作业

目录 创建密码库 创建用户帐户 更新 Ansible 库的密钥 配置cron作业 创建密码库 按照下方所述&#xff0c;创建一个 Ansible 库来存储用户密码&#xff1a; 库名称为 /home/curtis/ansible/locker.yml 库中含有两个变量&#xff0c;名称如下&#xff1a; pw_developer&#…

LiveCharts 直方图详解,安装和使用,以及常用属性的说明

LiveCharts 直方图详解 LiveCharts 概述安装 LiveCharts 及 如何使用直方图 LineSeries 属性说明综合直方图小例子 LiveCharts 概述 LiveCharts是一个比较漂亮的WPF图表控件&#xff0c;在数据变化时还会有动画切换的效果&#xff0c;并且样式也可以控制。 安装 LiveCharts 及…

mysql 插入数据锁等待超时报错:Lock wait timeout exceeded; try restarting transaction

报错信息 Lock wait timeout exceeded; try restarting transaction 锁等待超时 Lock wait timeout exceeded; try restarting transaction&#xff0c;是当前事务在等待其它事务释放锁资源造成的 解决办法 1、数据库中执行如下sql&#xff0c;查看当前数据库的线程情况&…

【数据结构OJ题】环形链表II

原题链接&#xff1a;https://leetcode.cn/problems/linked-list-cycle-ii/description/ 1. 题目描述 2. 思路分析 如果链表存在环&#xff0c;则fast和slow会在环内相遇&#xff0c;定义相遇点到入口点的距离为X&#xff0c;定义环的长度为C&#xff0c;定义头到入口的距离为…

Swin Transformer: Hierarchical Vision Transformer using Shifted Windows

Swin Transformer: Hierarchical Vision Transformer using Shifted Windows 摘要当前的检测sota模型网络架构swin Transformer和Vision Transformer的不同之处整体架构Patch Partition结构Linear Embedding结构Swin Transformer Block结构 Patch MergingW-MSAMSA模块计算量W-M…

学术论文翻译攻略:哪家公司最靠谱?

学术论文是针对科学领域中的学术问题进行研究的理论文章&#xff0c;其目的是表述科研成果。在权威平台上发布学术论文通常要求翻译为英文文稿。那么&#xff0c;如何翻译学术论文&#xff0c;以及哪家公司在翻译学术性论文方面表现最好&#xff1f; 业内人士指出&#xff0c;学…

PSP - 扩散生成模型 (Diffusion Generative Model) 预测蛋白质结构 EigenFold 算法与环境配置

欢迎关注我的CSDN&#xff1a;https://spike.blog.csdn.net/ 本文地址&#xff1a;https://spike.blog.csdn.net/article/details/132357976 Paper: EigenFold: Generative Protein Structure Prediction with Diffusion Models EigenFold 是用于蛋白质结构预测的扩散生成模型…

Intel CPU E-core 和P-core 介绍

多年来&#xff0c;计算机 CPU 中的内核一直在以稳定的速度发展。我们最初有单核 CPU&#xff0c;但很快发展到多线程&#xff0c;然后从那里开始多核设置&#xff0c;从双核设计开始&#xff0c;然后推出四核、八核等。 英特尔的第 12 代 CPU 给我们带来了意想不到的惊喜&…

微信小程序拉起支付报: 调用支付JSAPI缺少参数: total_fee

1. 调用支付JSAPI缺少参数: total_fee 2. 检查返回给前端调起支付的参数是否正确 一开始是params.put("package", prepay_id); 回来改回params.put("package", "prepay_id"prepay_id);

LeetCode刷题——46.全排列

46. 全排列 给定一个不含重复数字的数组 nums &#xff0c;返回其 所有可能的全排列 。你可以 按任意顺序 返回答案。 【递归实现】 func permute(nums []int) [][]int {var permutation func([]int, int, int)r : make([][]int,0)permutation func(arr []int, start int,…

【动态规划】两个数组问题

文章目录 动态规划&#xff08;两个数组问题&#xff09;1. 最长公共子序列2. 不相交的线3. 不同的子序列4. 交错字符串5. 两个字符串的最小ASCII和6. 最长重复子数组7. 通配符匹配 动态规划&#xff08;两个数组问题&#xff09; 1. 最长公共子序列 题目链接 状态表示 dp[i]…

爬虫小白也能玩转!Python爬虫中的异常处理与网络请求优化

大家好&#xff0c;我是来自爬虫世界的小编。今天&#xff0c;我要和大家分享一些关于Python爬虫中的异常处理和网络请求优化的经验。不论你是初学者还是有一定经验的爬虫程序员&#xff0c;我相信这些实用的技巧和代码示例都能为你在爬取数据的过程中带来方便和效率。 1.异常…