I also play with single-chip microcomputers: 8 digital tubes scroll to display a single number

Publisher:TurquoiseLatest update time:2024-08-19 Source: cnblogs Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Scrolling display 0~7

2653ab2d670754a63cad11f543c33976

source code

1 #include

2 #define uchar unsigned char

3 #define uint unsigned int

4 uchar code table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0xff}; //Code table for numbers 0~F. This program only uses 0~7

5 uchar code tab[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80}; //The address changes from left to right. 1~8 correspond to pins with high level valid. This program is better to use bit left shift operation.

6 void delay(uint z)

7 {

8 uint x,y;

9 for(x=z;x>0;x--)

10 for(y=110;y>0;y--);

11 }

12 void main()

13 {

14 uint i;

15 while(1)

16 {

17 for(i=0;j<8;i++)

18 {

19 P0=table[i];

20 P2=tab[i];

21 delay(500);

twenty two

twenty three }

twenty four }

25 }


Reference address:I also play with single-chip microcomputers: 8 digital tubes scroll to display a single number

Previous article:I also play with single chip microcomputer: running water lamp
Next article:Microcontroller: The smallest unit of STC89C52

Latest Microcontroller Articles
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号