標(biāo)題: 51單片機(jī)+ADC0809數(shù)碼管顯示程序+Proteus仿真 [打印本頁(yè)]

作者: kechuang    時(shí)間: 2020-11-9 16:51
標(biāo)題: 51單片機(jī)+ADC0809數(shù)碼管顯示程序+Proteus仿真
一。ADC0809介紹
二。基于51單片機(jī)的原理圖
三。相關(guān)程序

一。ADC0809介紹

1、ADC0809簡(jiǎn)介2、ADC0809的引腳介紹


3、ADC0809的工作流程
二。基于51單片機(jī)的原理圖


三。相關(guān)程序
  1. #include<reg52.h>
  2. unsigned char code dispbitcode[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
  3. unsigned char dispbuf[4];
  4. unsigned int i;
  5. unsigned int j;
  6. unsigned char getdata;
  7. unsigned int temp;
  8. unsigned int temp1;
  9. unsigned char count;
  10. unsigned char d;
  11. sbit ST=P3^0;
  12. sbit OE=P3^1;
  13. sbit EOC=P3^2;
  14. sbit CLK=P3^3;
  15. //sbit P34=P3^4;
  16. //sbit P35=P3^5;
  17. //sbit P36=P3^6;
  18. sbit P20=P2^0;
  19. sbit P21=P2^1;
  20. sbit P22=P2^2;
  21. sbit P23=P2^3;
  22. sbit P17=P1^7;
  23. void TimeInitial();
  24. void Delay(unsigned int i);

  25. void TimeInitial()
  26. {
  27.          TMOD=0x10;
  28.          TH1=(65536-200)/256;
  29.          TL1=(65536-200)%256;
  30.          EA=1;
  31.          ET1=1;
  32.          TR1=1;
  33. }

  34. void Delay(unsigned int i)
  35. {
  36.   unsigned int j;
  37.   for(;i>0;i--)
  38.   {
  39.   for(j=0;j<125;j++)
  40.   {;}
  41.   }
  42. }

  43. void Display()
  44. {
  45.            P1=dispbitcode[dispbuf[3]];
  46.                  P20=0;
  47.                  P21=1;
  48.                  P22=1;
  49.                  P23=1;
  50.                  Delay(10);
  51.                  P1=0x00;
  52.                  P1=dispbitcode[dispbuf[2]];
  53.                  P17=1;
  54.                  P20=1;
  55.                  P21=0;
  56.                  P22=1;
  57.                  P23=1;
  58.                  Delay(10);
  59.                  P1=0x00;
  60.                  P1=dispbitcode[dispbuf[1]];
  61.                  P20=1;
  62.                  P21=1;
  63.                  P22=0;
  64.                  P23=1;
  65.                  Delay(10);
  66.                  P1=0x00;
  67.                  P1=dispbitcode[dispbuf[0]];
  68.                  P20=1;
  69.                  P21=1;
  70.                  P22=1;
  71.                  P23=0;
  72.                  Delay(10);
  73.                  P1=0x00;
  74. }
  75. void main()
  76. {
  77.                 TimeInitial();
  78.                 while(1)
  79.                 {
  80.                                 ST=0;
  81.                                 OE=0;
  82.                                 ST=1;
  83.                                 ST=0;
  84. //                                P34=0;
  85. //                                P35=0;
  86. //                                P36=0;
  87.                                 while(EOC==0);
  88.                                 OE=1;
  89.                                 getdata=P0;
  90.                                 OE=0;
  91.                                 temp=getdata*1.0/256*500;
  92.                                 dispbuf[0]=temp%10;
  93.                                 dispbuf[1]=temp/10%10;
  94.                                 dispbuf[2]=temp/100%10;
  95.                                 dispbuf[3]=temp/1000;
  96.                                 Display();
  97.                 }
  98. }

  99. void t1(void) interrupt 3 using 0
  100. {
  101.   TH1=(65536-200)/256;
  102.   TL1=(65536-200)%256;
  103.   CLK=~CLK;
  104.   }
復(fù)制代碼

全部資料51hei下載地址:
ADC0809.7z (101.46 KB, 下載次數(shù): 71)


作者: seenian    時(shí)間: 2020-11-30 13:52
老哥,實(shí)物的話,51時(shí)鐘怎么達(dá)到500khz呢




歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1