51 single-chip microcomputer (Puzhong HC6800-EM3 V3.0) experimental routine software analysis experiment six static digital tube display

Table of contents

foreword

1. Schematic diagram and introduction of knowledge points

1.1. Schematic diagram of the digital tube:

 2. Code Analysis


foreword

The first experiment: 51 single-chip microcomputer (Puzhong HC6800-EM3 V3.0) experimental routine software analysis experiment one point lights up the first LED_ManGo CHEN's Blog-CSDN Blog

The second experiment: 51 single-chip microcomputer (Puzhong HC6800-EM3 V3.0) experimental routine software analysis experiment 2 LED flicker_ManGo CHEN's Blog-CSDN Blog

The third experiment: 51 single-chip microcomputer (Puzhong HC6800-EM3 V3.0) experimental routine software analysis experiment three LED water lights_ManGo CHEN's Blog-CSDN Blog

The fourth experiment: 51 single-chip microcomputer (Puzhong HC6800-EM3 V3.0) experimental routine software analysis experiment four buzzers_ManGo CHEN's Blog-CSDN Blog

The fifth experiment: https://blog.csdn.net/qq_42700289/article/details/132219189

The sixth experiment: static digital tube display

1. Schematic diagram and introduction of knowledge points

1.1. Schematic diagram of the digital tube:

The digital tube circuit is as follows:

The schematic diagram of the digital tube is as shown above:

1. Mainly understand what is a digital tube?

2. What is a common anode digital tube?

3. What is the segment selection of the digital tube? What is the bit selection of the digital tube?

I hope you will study this article with questions, there are a lot of Baidu, so I won’t go into details here.

 2. Code Analysis

Let me introduce the project first:

 Let's go directly to the code:

/**************************************************************************************
*		              静态数码管显示实验												  *
实现现象:下载程序后数码管静态显示0。
注意事项:																				  
***************************************************************************************/

#include "reg52.h"			 //此文件中定义了单片机的一些特殊功能寄存器

typedef unsigned int u16;	  //对数据类型进行声明定义
typedef unsigned char u8;


u8 code smgduan[17]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,
					0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};//显示0~F的值


/*******************************************************************************
* 函 数 名       : main
* 函数功能		 : 主函数
* 输    入       : 无
* 输    出    	 : 无
*******************************************************************************/
void main()
{	
	P0=~smgduan[0];
	while(1);
}


The program here is very simple. This section is mainly to understand the above three problems, and basically there is no problem. The eight ports of P0 are directly connected to the segment selection of the digital tube, and each group of values ​​​​in the array is traversed in turn, and 0 is displayed. ~F, the principle is the common anode digital tube, if the segment is selected as 0, it will light up, by lighting up the 8 segments of abcdefgdp, the effect of displaying the value can be achieved.

Guess you like

Origin blog.csdn.net/qq_42700289/article/details/132219395