Single chip microcomputer experiment --- control the dynamic display of digital tube

Publisher:心灵之舞Latest update time:2020-04-11 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The tasks of this experiment are as follows:

mission details

1. Comparison between dynamic display and static display

1. What is dynamic display?

The driving circuit can make the digital tube display data normally. There are two driving modes of the digital tube: dynamic display driving and static display driving.


Dynamic driving is to connect the same-named ends of the 8 display strokes a, b, c, d, e, f, g, and dp of all digital tubes together.


In addition, a bit selection control circuit is added to the common pole COM of each digital tube, and the bit selection is controlled by each independent I/O line.


When the single-chip microcomputer outputs the glyph code, all the digital tubes receive the same glyph code, but which digital tube will display the glyph depends on the single-chip microcomputer's control of the bit-select COM terminal circuit.


2. What is static display?

Static display drive Static drive is also called DC drive.


Static drive means that each segment code of each digital tube is driven by an I/O port of a microcontroller.


3. Comparison of advantages and disadvantages

image.png

2. How to control multiple digital tubes

1. Circuit diagram

Circuit Diagram

Use the trigger as an intermediate link to control the digital tube.

U2 is a segment trigger that controls the display of the digital tube.

U3 is a bit select trigger that controls the selection of the digital tube.

Port P0 is used as the data output port.

2. Code

ORG 0000H

LJMP MAIN

ORG 30H

;..................................................................

; Digital tube DS0 displays '0'

;..................................................................

MAIN: MOV P0,#0C0H ; segment selection data 0

CLR P1.0; Select U2 as the segment select chip and write U2's Ē to low level

CLR P1.2; Timing pin CKL is low level, ready to receive data

SETB P1.2; The timing is rising edge, that is, data is transmitted to U2

SETB P1.0 ; Turn off U2 so that U2 no longer receives data

////////////////////

MOV P0,#0FEH; The bit selection data is given by port P0, and DS0 is selected for digital display

CLR P1.1 ; Select U3 bit select chip and write U3 to low level

CLR P1.2; Timing pin CKL is low level, ready to receive data

SETB P1.2; The timing is rising edge, that is, data is transmitted to U3

SETB P1.1 ; Turn off U3 so that U3 no longer receives data

///////////////////

LCALL DELAY ; Delay for a period of time

MOV P0,#0FFH ; Turn off the digital tube and prepare for the next digital tube display

CLR P1.0 ; Select U3 bit select chip, write U3 to low level

CLR P1.2; Timing pin CKL is low level, ready to receive data

SETB P1.2; The timing is rising edge, that is, data is transmitted to U3

SETB P1.1 ; Turn off U3 so that U3 no longer receives data

///////////////////

;..................................................................

; Digital tube DS1 displays '1'

;..................................................................

      MOV P0,#0F9H

CLR P1.0

CLR P1.2

SETB P1.2

SETB P1.0

////////////////////

MOV P0,#0FDH

CLR P1.1

CLR P1.2

SETB P1.2

SETB P1.1

///////////////////

LCALL DELAY

MOV P0,#0FFH

CLR P1.1

CLR P1.2

SETB P1.2

SETB P1.1

///////////////////

;..................................................................

; Digital tube DS1 displays '2'

;..................................................................

      MOV P0,#0A4H

CLR P1.0

CLR P1.2

SETB P1.2

SETB P1.0

////////////////////

MOV P0,#0FBH

CLR P1.1

CLR P1.2

SETB P1.2

SETB P1.1

///////////////////

LCALL DELAY

MOV P0,#0FFH

CLR P1.1

CLR P1.2

SETB P1.2

SETB P1.1

///////////////////

;..................................................................

; Digital tube DS1 displays '3'

;..................................................................

      MOV P0,#0B0H

CLR P1.0

CLR P1.2

SETB P1.2

SETB P1.0

////////////////////

MOV P0,#0F7H

CLR P1.1

CLR P1.2

SETB P1.2

SETB P1.1

///////////////////

LCALL DELAY

MOV P0,#0FFH

CLR P1.1

CLR P1.2

SETB P1.2

SETB P1.1

///////////////////

;..................................................................

; Delay program

;..................................................................

DELAY: MOV R7,#200 ; Delay subroutine

DJNZ R7,$

RET ; Return to the main program

END


3. Program Analysis

The program is divided into two parts: the main program and the subprogram.

The main program is divided into four parts, which control the display of four digital tubes.

The function of the subroutine is to delay.

3. Methods for controlling multiple digital tubes

From the above experiment, we know that the display of multiple digital tubes is controlled by segment selection and bit selection together.

The segment selection program controls the display of the digital tube.

The bit selection program controls the selection of the digital tube.

The segment selection and bit selection procedures are as follows:

;*****Segment selection procedure*********

CLR P1.0

CLR P1.2

MOV P0,#0B0H

SETB P1.2

SETB P1.0

;********Position selection procedure*********

CLR P1.1

CLR P1.2

MOV P0,#0F7H

SETB P1.2

SETB P1.1


Here is a simplified version of the previous program - using a lookup table to implement

;**************The digital tube dynamically displays '0, 1, 2, 3'*************************

ORG 0000H

LJMP MAIN

ORG 30H

;............................................................

; Initialization definition

;............................................................

MAIN: MOV R0,#0; segment selection data pointer

MOV R1,#0FEH ; Initialize segment selection data

MOV DPTR,#TAB ;“0~9” data table

;............................................................

; Main program

;............................................................

;****Change segment code and bit code****

LOOP: MOV A,R0; data pointer RO to accumulator A

MOVC A,@ A+DPTR; transfer the data corresponding to the pointer in the data table to A

MOV P0,A; data is transmitted to each segment of the digital tube

CLR P1.0

CLR P1.2

SETB P1.2

SETB P1.0

////////////////////////

MOV P0, R1; send the bit selection data to port P0 to light up the required digital tube

CLR P1.1

CLR P1.2

SETB P1.2

SETB P1.1

////////////////////////

LCALL DELAY ; Delay for a period of time

MOV P0,#0FFH ; Turn off the digital tube and prepare for the next digital tube display

CLR P1.1

CLR P1.2

SETB P1.2

SETB P1.1

;****Change segment code and bit code****

INC R0; data pointer plus 1, pointing to the next data address

MOV A, R1; Move the bit selection digital tube to the left, ready for the next digital tube to light up

RL A

MOV R1,A

CJNE R1,#0EFH,LOOP; Determine whether the DS3 digital tube is lit up

LJMP MAIN ; loop this program

;............................................................

; Delay program

;............................................................

DELAY: MOV R7,#200 ; Delay subroutine

DJNZ R7,$

RET ; Return to main program instruction

;............................................................

; Digital tube data sheet

;............................................................

TAB: DB 000H, 0F9H, 0A4H, 0B0H, 099H; 0-9 data table

DB 092H,082H,0F8H,080H,090H

END


Time: October 19, 2018 13:28:43


-END-

Reference address:Single chip microcomputer experiment --- control the dynamic display of digital tube

Previous article:51 MCU one-digit digital tube assembly program
Next article:51 static and dynamic display digital tube

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号