新聞中心

EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 基于單片機(jī)的數(shù)碼管顯示實(shí)現(xiàn)自加功能

基于單片機(jī)的數(shù)碼管顯示實(shí)現(xiàn)自加功能

作者: 時(shí)間:2012-07-30 來(lái)源:網(wǎng)絡(luò) 收藏

 本文主要介紹MCS-51自加1,從1一直到999.以下是硬件電路圖、圖以及源代碼。(電路:使用74HC573鎖存器控制段選,74H138控制位選;)

本文引用地址:http://www.butianyuan.cn/article/171112.htm



管自加的代碼:

  #include

  #define uchar unsigned char

  #define uint unsigned int

  uchar code table[16] = {0x3f,0x06,0x5b,0x4f,

  0x66,0x6d,0x7d,0x07,0x7f,

  0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71}; //數(shù)字表

  uchar flag,bai,shi,ge;

  uint temp;

  void xunhuan();

  void delay(uint z);

  void init();

  void main()

  {

  init();

  while(1)

  {

  if(flag==20)

  {

  flag=0;

  temp++;

  if(temp==1000)

  {

  temp=0;

  }

  }

  bai=temp/100;

  shi=temp%100/10;


上一頁(yè) 1 2 下一頁(yè)

評(píng)論


相關(guān)推薦

技術(shù)專區(qū)

關(guān)閉