The tasks of this experiment are as follows:
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
2. How to control multiple digital tubes
1. 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-
Previous article:51 MCU one-digit digital tube assembly program
Next article:51 static and dynamic display digital tube
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- [Recruitment] Shenzhen foreign companies are urgently recruiting RF antenna engineers, looking forward to your joining
- No more confusion! A guide to choosing a cordless vacuum cleaner
- [Raspberry Pi 3B+ Review] GCC Compiles HelloWorld & Lighting Program
- 【Evaluation of EVAL-M3-TS6-665PN development board】——by landeng1986
- [GD32E231 DIY Contest] (I): Development Environment Construction + TIMER5
- How to use the USB port as an external circuit to power other devices
- Detailed explanation of the three major weapons to eliminate EMC: capacitors/inductors/magnetic beads
- Embedded operating systems I have come into contact with - time-slice-based embedded systems, RTX, FREERTOS, RT-THREAD
- How much do you know about RF semiconductor technology in the wireless era?
- How to design the vias on the heat sink? The problem is not solved, please help me