當前位置:編程學習大全網 - 編程軟體 - 用C語言編寫壹個在八個數碼管上輪流顯示1-8的程序

用C語言編寫壹個在八個數碼管上輪流顯示1-8的程序

我這個程序是在PROTUES仿真上做的 妳可以根據程序自己畫電路圖 很簡單的 這裏用到了

兩片 74HC573 芯片 顯示0---F

#include<reg51.h>

#include<intrins.h>

#define uchar unsigned char

#define uint unsigned int

sbit duan=P1^6;

sbit wei=P1^7;

uchar temp=0x01;

uchar code tab[]={ 0xc0,0xf9,0xA4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e};

uchar a=0;

void delay(uint z);

void main()

{ while(1)

{ wei=1;P2=temp;wei=0;

duan=1;P2=tab[a];duan=0;

delay(300);

temp=_crol_(temp,1);

a++;

if(a==16){a=0;}} }

void delay(uint z)

{ uint x,y;

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

for(y=120;y>0;y--);}

  • 上一篇:如何評價動畫《機動戰士高達UC》?
  • 下一篇:Linux通用命令linuxg命令
  • copyright 2024編程學習大全網