標(biāo)題: 單片機(jī)評(píng)價(jià)器制作 含仿真與程序 [打印本頁]

作者: With_commands    時(shí)間: 2017-8-3 17:40
標(biāo)題: 單片機(jī)評(píng)價(jià)器制作 含仿真與程序
最近辦了個(gè)證,看到了對(duì)工作人員的評(píng)價(jià)系統(tǒng),我想,能不能自制一個(gè)評(píng)價(jià)系統(tǒng)呢?于是花了40分鐘才完成。
希望喜歡
晶振頻率:12MHz








單片機(jī)源程序如下:
  1. #include <reg52.h>
  2. #include <intrins.h>
  3. #define uchar unsigned char
  4. #include "1602.c"

  5. sbit hello=P1^5;
  6. sbit eva=P1^6;
  7. sbit b1=P2^3;
  8. sbit b2=P2^4;
  9. sbit b3=P2^5;
  10. sbit lc1=P1^0;
  11. sbit lc2=P1^1;
  12. sbit lc3=P1^2;
  13. sbit lc4=P1^3;
  14. sbit lc5=P1^4;
  15. sbit rst=P1^7;

  16. uchar i;

  17. void calc()
  18. {
  19.           while(1){
  20.         if(b1==0){
  21.                   lc1=1;
  22.                         lc2=1;
  23.                         lc3=1;
  24.                         lc4=1;
  25.                         lc5=1;
  26.                         display_init();
  27.                         cprintf("Thank you!");
  28.                               i=1;
  29.                               return;
  30.               }
  31.               if(b2==0){
  32.                   lc1=1;
  33.                         lc2=1;
  34.                         lc3=1;
  35.                         lc4=0;
  36.                         lc5=0;
  37.                         display_init();
  38.                         cprintf("I will continue ");
  39.                         gotoxy(0,1);
  40.                         cprintf("to work hard.");
  41.                               i=1;
  42.                               return;
  43.               }
  44.               if(b3==0){
  45.                   lc1=1;
  46.                          lc2=0;
  47.                         lc3=0;
  48.             lc4=0;
  49.                         lc5=0;
  50.                         display_init();
  51.                         cprintf("Sorry, I haven't");
  52.                         gotoxy(0,1);
  53.                         cprintf("g_ good service.");
  54.                               i=1;
  55.                               return;
  56.         }
  57.     }
  58. }

  59. void main()
  60. {
  61.           while(1){
  62.               if(hello==0){
  63.                         display_init();
  64.                               cprintf("Hello!");
  65.                     }
  66.                     if(eva==0){
  67.                         display_init();
  68.                               cprintf("Please evaluate");
  69.                                           gotoxy(0,1);
  70.                                           cprintf("in my service.");
  71.                                                 calc();
  72.                                                 if(i==1){
  73.                                                           break;
  74. ……………………

  75. …………限于本文篇幅 余下代碼請(qǐng)從51黑下載附件…………
復(fù)制代碼

所有資料51hei提供下載:
(2樓)



作者: With_commands    時(shí)間: 2017-8-3 17:41
程序文件及仿真


evaluate.zip

22.92 KB, 下載次數(shù): 8, 下載積分: 黑幣 -5

程序文件及仿真






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