找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 11837|回復(fù): 19
收起左側(cè)

單片機(jī)水塔水位控制系統(tǒng)proteus仿真

  [復(fù)制鏈接]
ID:137190 發(fā)表于 2016-10-9 23:01 | 顯示全部樓層 |閱讀模式
單片機(jī)水塔水位控制的原理圖:
0.png
0.png

單片機(jī)水塔水位控制仿真工程文件及所有完整程序等資料下載地址:
http://www.torrancerestoration.com/bbs/dpj-56304-1.html


單片機(jī)源程序:
  1. #include<reg51.h>
  2. //定義一個數(shù)組,使數(shù)碼管顯示的數(shù)字和數(shù)組元素的下標(biāo)相等
  3. unsigned char code table[]={0x3f,0x06,0x5b,0x4f,0x66,
  4.                             0x6d,0x7d,0x07,0x7f,0x6f};
  5. sbit shuiman=P1^0;//水滿
  6. sbit sw5=P1^1;//水位5
  7. sbit sw4=P1^2;//水位4
  8. sbit sw3=P1^3;//水位3
  9. sbit sw2=P1^4;//水位2
  10. sbit sw1=P1^5;//水位1
  11. sbit shougong=P1^6;//手工上水
  12. sbit dianji=P1^7;//電機(jī)控制位
  13. sbit state=P3^7;//電機(jī)工作指示
  14. /*延時程序*/
  15. void delay02s(void)
  16. {
  17.   unsigned char i,j,k;
  18.   for(i=100;i>0;i--)
  19.   for(j=100;j>0;j--)
  20.   for(k=248;k>0;k--);
  21. }
  22. main()
  23. {
  24.         P0=0;
  25.         while(1)
  26.                 {  /*************************傳感器是設(shè)計的一次只能觸發(fā)一個傳感器單?****************************
  27.               //水滿
  28.                         if(shuiman==0&&sw5==1&&sw4==1&&sw3==1&&sw2==1&&sw1==1)//當(dāng)唯一的閉合一個傳感器單元:水位6時發(fā)生
  29.                         {
  30.                                 dianji=1;//關(guān)電機(jī)
  31.                                 state=1;//電機(jī)工作指示燈熄滅
  32.             P0=table[6];//顯示水位深度:6**** 已滿
  33.                                 delay02s();//延時一段時間讓數(shù)碼管顯示給人以提示:水已滿
  34.                         }
  35.                                 //水位5
  36.                         if(shuiman==1&&sw5==0&&sw4==1&&sw3==1&&sw2==1&&sw1==1)//當(dāng)唯一的閉合一個傳感器單元:水位5時發(fā)生
  37.                         {
  38.                                 P0=table[5];//顯示水位深度:5
  39.                         }
  40.                         //水位4
  41.                         if(shuiman==1&&sw5==1&&sw4==0&&sw3==1&&sw2==1&&sw1==1)//當(dāng)唯一的閉合一個傳感器單元:水位4時發(fā)生
  42.                         {
  43.                                 P0=table[4];//顯示水位深度:4
  44.                         }
  45.                         //水位3
  46.                         if(shuiman==1&&sw5==1&&sw4==1&&sw3==0&&sw2==1&&sw1==1)//當(dāng)唯一的閉合一個傳感器單元:水位3時發(fā)生
  47.                         {
  48.                                   P0=table[3];//顯示水位深度:5
  49.                         }
  50.                         //水位2
  51.               if(shuiman==1&&sw5==1&&sw4==1&&sw3==1&&sw2==0&&sw1==1)//當(dāng)唯一的閉合一個傳感器單元:水位2時發(fā)生
  52.                         {
  53.                                 P0=table[2];//顯示水位深度:2
  54.                         }
  55.                         //水位低
  56.                         if(shuiman==1&&sw5==1&&sw4==1&&sw3==1&&sw2==1&&sw1==0)//當(dāng)唯一的閉合一個傳感器單元:水位1時發(fā)生
  57.                         {
  58.                                 dianji=0;//開電機(jī)
  59.                                 state=0;//電機(jī)工作指示燈打開
  60.                         P0=table[1];//顯示水位深度:1
  61.                         }
  62.                         //手工上水
  63.                     if(shougong==0)//當(dāng)按手工上水按鈕時發(fā)生
  64.                         {  
  65.                       dianji=0;//開電機(jī)
  66.                                 state=0;//電機(jī)工作指示燈打開
  67.                                 P0=table[0];//顯示0表示手工上水已有反應(yīng)
  68.                                 delay02s();//延時一段時間讓數(shù)碼管顯示給人以提示:已開始手工上水
  69.                         }
  70.                
  71.                 }
  72.          
  73. }
復(fù)制代碼

評分

參與人數(shù) 1黑幣 +5 收起 理由
123342 + 5 很給力!

查看全部評分

相關(guān)帖子

回復(fù)

使用道具 舉報

ID:69408 發(fā)表于 2016-10-20 20:31 | 顯示全部樓層
不錯,謝謝分享!
回復(fù)

使用道具 舉報

ID:204130 發(fā)表于 2017-6-17 18:27 | 顯示全部樓層
在74顯示錯誤
回復(fù)

使用道具 舉報

ID:204130 發(fā)表于 2017-6-17 18:28 | 顯示全部樓層
compiling Text1.c...
Text1.c(73): error C300: unterminated comment
TEXT1.C(73): error C141: syntax error near ''
Text1.c - 2 Error(s), 0 Warning(s).
回復(fù)

使用道具 舉報

ID:204130 發(fā)表于 2017-6-17 18:30 | 顯示全部樓層
compiling Text1.c... Text1.c(73): error C300: unterminated comment TEXT1.C(73): error C141: syntax error near '' Text1.c - 2 Error(s), 0 Warning(s).
回復(fù)

使用道具 舉報

ID:192708 發(fā)表于 2017-6-22 23:57 | 顯示全部樓層
謝謝分享
回復(fù)

使用道具 舉報

ID:257829 發(fā)表于 2017-12-10 14:04 | 顯示全部樓層
不錯,謝謝分享
回復(fù)

使用道具 舉報

ID:365165 發(fā)表于 2018-7-4 21:08 | 顯示全部樓層
謝謝分享
回復(fù)

使用道具 舉報

ID:436004 發(fā)表于 2018-11-30 15:46 | 顯示全部樓層
絕世好貼
回復(fù)

使用道具 舉報

ID:436004 發(fā)表于 2018-12-6 09:46 | 顯示全部樓層
絕世好貼!
回復(fù)

使用道具 舉報

ID:439838 發(fā)表于 2018-12-6 09:49 | 顯示全部樓層
不錯。666666666
回復(fù)

使用道具 舉報

ID:450121 發(fā)表于 2018-12-19 18:57 | 顯示全部樓層
很好的學(xué)習(xí)資料
回復(fù)

使用道具 舉報

ID:432104 發(fā)表于 2018-12-19 19:22 | 顯示全部樓層
感謝分享!
回復(fù)

使用道具 舉報

ID:518167 發(fā)表于 2019-4-22 19:23 | 顯示全部樓層
標(biāo)注了電路的功能,挺好
回復(fù)

使用道具 舉報

ID:527551 發(fā)表于 2019-5-6 09:52 | 顯示全部樓層
謝謝大神
回復(fù)

使用道具 舉報

ID:553930 發(fā)表于 2019-6-10 16:26 | 顯示全部樓層
非常好
回復(fù)

使用道具 舉報

ID:735204 發(fā)表于 2020-5-17 21:51 來自觸屏版 | 顯示全部樓層
有人會這個的程序框圖嘛
回復(fù)

使用道具 舉報

ID:292518 發(fā)表于 2021-8-6 10:40 | 顯示全部樓層

很好的學(xué)習(xí)資料,感謝分享!
回復(fù)

使用道具 舉報

ID:292518 發(fā)表于 2021-8-6 10:53 | 顯示全部樓層
數(shù)碼管是共陽管?還是共陰管?
回復(fù)

使用道具 舉報

ID:585365 發(fā)表于 2021-8-10 16:56 | 顯示全部樓層
正在找這方面的資料,太好了
回復(fù)

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表