6677 views|0 replies

1379

Posts

0

Resources
The OP
 

I/O parallel port directly drives LED display [Copy link]

1. Experimental Tasks

As shown in the figure below, P0.0 - P0.7 of the P0 port of the AT89S51 microcontroller are connected to the a - h segments of a common cathode digital tube , and the common end of the digital tube is grounded. The digital tube displays 0 - 9 numbers in a cycle , with a time interval of 0.2 seconds.

2. Circuit Schematic

 

3. Hardware connection on the system board

Our test board comes with 8 LED displays. The segment selection line is connected to the P1.0--P1.7 pin. The common selection line is connected to the P3.0-P3.7 pin. No special settings are required. You can do this test.

4. Programming content

(1. LED digital display principle

The seven-segment LED display consists of seven strip-shaped light-emitting diodes and one small dot light-emitting diode. According to the wiring form of the poles of each tube, it can be divided into common cathode type and common anode type.

The seven light-emitting diodes g~a of the LED digital tube light up when a positive voltage is applied, and do not light up when a zero voltage is applied. The combination of different brightness and darkness can form different characters. This combination is called a character code. The following is a common cathode character code, see Table 2

" 0 "

3FH

" 8 "

7F

" 1 "

06H

" 9 "

6FH

" 2 "

5BH

" A "

77H

" 3 "

4F

" b "

7CH

" 4 "

66H

" C "

39H

" 5 "

6DH

" d "

5E

" 6 "

7D

" E "

79H

" 7 "

07H

" F "

71H

(2. Since there is no regular pattern in the displayed digits 0-9 , we can only use a table lookup to meet our needs. In this way , we arrange the segment codes of each digit in the order of digits 0-9 ! The established table is as follows: TABLE DB 3FH , 06H , 5BH , 4FH , 66H , 6DH , 7DH , 07H , 7FH , 6FH  

5. Flowchart

 

6. Assembly source program

ORG 0

START: MOV R1,#00H

NEXT: MOV A,R1

MOV DPTR,#TABLE

MOVC A,@A+DPTR

MOV P0,A

LCALL DELAY

INC R1

CJNE R1,#10,NEXT

LJMP START

DELAY: MOV R5,#20

D2: MOV R6,#20

D1: MOV R7,#248

DJNZ R7,$

DJNZ R6,D1

DJNZ R5,D2

RET

TABLE: DB 3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FH

END

This post is from MCU
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list