Single chip microcomputer dynamic digital display technology

Publisher:MysticSerenadeLatest update time:2012-09-12 Source: 21ic Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Experimental tasks

As shown in Figure 4.13.1, the P0 port of the AT89S51 microcontroller is connected to the font code pen segment of the dynamic digital tube, the P2 port is connected to the digit selection end of the dynamic digital tube, and P1.7 is connected to a switch. When the switch is connected to a high level, "12345" is displayed; when the switch is connected to a low level, "HELLO" is displayed.

2. Circuit diagram

Click to browse the next page

Figure 4.13.1

3. Hardware connection on the system board

(1. Connect P0.0/AD0-P0.7/AD7 in the "MCU System" area to ports a-h in the "Dynamic Digital Display" area using an 8-core cable;

(2. Connect P2.0/A8-P2.7/A15 in the "MCU System" area to the S1-S8 ports in the "Dynamic Digital Display" area using an 8-core cable;

(3. Connect the P1.7 port in the "MCU System" area to the SP1 port in the "Standalone Keyboard" area with a wire;

4. Programming content

(1. Dynamic scanning method

The dynamic interface uses a method in which each digital tube is displayed in a cycle. When the cycle display frequency is high, the human eye's retention characteristics are used to prevent the flickering display phenomenon from being visible. This display requires one interface to complete the output of the glyph code (glyph selection) and another interface to complete the lighting of each digital tube in turn (digit selection).

(2. When performing digital display, 8 display buffers should be opened for the display unit, and each display buffer is loaded with different display data.

(3. For the displayed glyph code data, we use the table lookup method to complete [page]

5. Flowchart

Click to browse the next page Click to browse the next page

Figure 4.13.2

6. Assembly source program

ORG 00H

START: JB P1.7,DIR1

MOV DPTR,#TABLE1

SJMP DIR

DIR1: MOV DPTR,#TABLE2

DIR: MOV R0,#00H

MOV R1,#01H

NEXT: MOV A,R0

MOVC A,@A+DPTR

MOV P0,A

MOV A,R1

MOV P2,A

LCALL DAY

INC R0

RL A

MOV R1,A

CJNE R1,#0DFH,NEXT

SJMP START

DAY: MOV R6,#4

D1: MOV R7,#248

DJNZ R7,$

DJNZ R6,D1

RET

TABLE1: DB 06H,5BH,4FH,66H,6DH

TABLE2: DB 78H,79H,38H,38H,3FH

END

[page]

7. C language source program

#include

unsigned char code table1[]={0x06,0x5b,0x4f,0x66,0x6d};

unsigned char code table2[]={0x78,0x79,0x38,0x38,0x3f};

unsigned char i;

unsigned char a,b;

unsigned char temp;

void main(void)

{

while(1)

{

temp=0xfe;

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

{

if(P1_7==1)

{

P0=table1[i];

}

else

{

P0=table2[i];

}

P2=temp;

a=temp<<(i+1);

b=temp>>(7-i);

temp=a|b;

for(a=4;a>0;a--)

for(b=248;b>0;b--);

}

}

}

Reference address:Single chip microcomputer dynamic digital display technology

Previous article:Serial communication program of microcontroller
Next article:Design of single chip flashing light

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号