• 大小: 105KB
    文件类型: .zip
    金币: 2
    下载: 0 次
    发布日期: 2024-02-06
  • 语言: 其他
  • 标签:

资源简介

温度控制,随温度的变化电机转速也随着变化,包含仿真图,源程序

资源截图

代码片段和文件信息

#include 
#include 

extern char fnLCMInit(); // LCM 初始化
extern void at(unsigned char xunsigned char y);/*设定文本xy值*/
extern void cls();  // 清屏
extern void charout(unsigned char *str); //ASCII(8*8) 显示函数
extern void fnSetPos(unsigned char urow unsigned char  ucol); // 设置当前地址
extern uchar dprintf(uchar xuchar ychar *fmt);// ASCII(8*16) 及 汉字(16*16) 显示函数
extern uchar fnPR12(uchar uCmd); // 写无参数的指令
extern uchar fnPR13(uchar uData); // 写数据
extern unsigned int Adc0832(unsigned char channel);
extern void Line( unsigned char x1 unsigned char y1 unsigned char x2 unsigned char y2 bit Mode);
extern void Pixel(unsigned char PointXunsigned char PointY bit Mode);



uchar dsp[10]={0000000000};
char abc[3]={000};
uchar key=0;
uint a=100;
uchar n=5;
uchar count=1; 
uint k1=0;

uchar GeyKey();
void delay(uchar i);
void control();


main()
{  
     
  fnLCMInit();
fnSetPos(00);
dprintf(00“直流电机加-减速及测速系统“);
dprintf(012“键盘+:步长加速“);
dprintf(024“键盘-:步长减速“);
dprintf(036“键盘=:顺时针转“);
dprintf(048“键盘on/c:逆时针转“);
     
     dprintf(072“方向:“);
    dprintf(084“转速:“);  
    
 P1_1=0;
     TMOD=0x15;
 TH1=0x3c;
 TL1=0xb0;
     TH0=0x00;
 TL0=0x00;
 ET0=1;
 ET1=1;
 TR0=1;
 TR1=1;
    
    while(1)
{  key=GeyKey();
      switch(key)
       {   case ‘1‘: {          a=10;
                            //sprintf(abc“%3.2f“a/255.0);
                        dprintf(096“  5    r/min“);   
                                //dprintf(096abc);  
                                dprintf(6096“r/min“);
                            break;      }
       case ‘2‘: {          a=25;dprintf(096“  25    r/min“);    break;      }
   case ‘3‘: {          a=40; dprintf(096“ 40    r/min“);   break;      }
   case ‘4‘: {          a=55; dprintf(096“ 60    r/min“);   break;      }
   case ‘5‘: {          a=70; dprintf(096“ 80    r/min“);   break;      }
   case ‘6‘: {          a=90; dprintf(096“100    r/min“);   break;      }
   case ‘7‘: {          a=110; dprintf(096“120    r/min“);   break;      }
   case ‘8‘: {          a=130; dprintf(096“135    r/min“);   break;      }
   case ‘9‘: {          a=150; dprintf(096“150    r/min“);   break;      }
       case ‘+‘: {          dprintf(072“方向: 顺时针“);
                            control();
break;
}
           case ‘-‘: {         P1_0=0;
                        dprintf(072“方向: 逆时针“);
                         control();
                        break;
}
           case ‘=‘: {P1_0=1;dprintf(072“方向: 顺时针“);break;}
           case ‘c‘: {P1_0=0;dprintf(072“方向: 逆时针“);break;}
           case ‘/‘: {dprintf(072“方向: 顺时针“);
                            control();}
   default:  break;
        }
    }
}


uchar GeyKey()
{
  P1_4=0;
  P1_5=1;
  P1_6=1;
  P1_7=1;
P3_0=1;
P3_1=1;
P3_2=1;
    P3_3=1;
_nop_();_nop_();
if(!P3_0)retur

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2011-04-05 15:48  zhiliudianjice\
     文件         198  2008-11-05 23:18  zhiliudianjice\新势力单片机嵌入式.url
     文件         186  2008-11-23 13:51  zhiliudianjice\新势力论坛.txt
     目录           0  2011-04-05 15:48  zhiliudianjice\电机最终版\
     文件       17686  2007-06-05 15:43  zhiliudianjice\电机最终版\001
     文件       88402  2007-06-05 15:43  zhiliudianjice\电机最终版\001.DSN
     文件       23220  2007-06-05 15:43  zhiliudianjice\电机最终版\001.hex
     文件          40  2007-06-05 15:43  zhiliudianjice\电机最终版\001.lnp
     文件       46704  2007-06-05 15:43  zhiliudianjice\电机最终版\001.M51
     文件        1127  2011-01-10 17:55  zhiliudianjice\电机最终版\001.Opt
     文件         232  2011-01-10 17:55  zhiliudianjice\电机最终版\001.plg
     文件        1222  2011-04-05 15:48  zhiliudianjice\电机最终版\001.PWI
     文件        2094  2011-01-10 17:55  zhiliudianjice\电机最终版\001.Uv2
     文件        1340  2007-06-05 16:01  zhiliudianjice\电机最终版\001_Opt.Bak
     文件        1680  2007-06-05 04:26  zhiliudianjice\电机最终版\001_Uv2.Bak
     文件       88402  2007-06-05 15:36  zhiliudianjice\电机最终版\Last Loaded 001.DBK
     文件        4732  2007-06-05 15:43  zhiliudianjice\电机最终版\main.c
     文件        8769  2007-06-05 15:43  zhiliudianjice\电机最终版\main.LST
     文件        6169  2007-06-05 15:43  zhiliudianjice\电机最终版\main.OBJ
     文件          29  2007-06-05 15:43  zhiliudianjice\电机最终版\main.__i
     文件       20738  2007-06-02 22:07  zhiliudianjice\电机最终版\show.fun
     文件       23451  2007-06-03 01:59  zhiliudianjice\电机最终版\showfun.c
     文件        2393  2007-06-02 22:15  zhiliudianjice\电机最终版\showfun.h
     文件       35071  2007-06-05 15:43  zhiliudianjice\电机最终版\showfun.LST
     文件       15272  2007-06-05 15:43  zhiliudianjice\电机最终版\showfun.OBJ
     文件          32  2007-06-05 15:43  zhiliudianjice\电机最终版\showfun.__i
     文件         337  2007-06-03 00:30  zhiliudianjice\电机最终版\time.c
     文件        1143  2007-06-03 00:30  zhiliudianjice\电机最终版\time.LST
     文件         198  2008-11-05 23:18  zhiliudianjice\电机最终版\新势力单片机嵌入式.url
     文件         186  2008-11-23 13:51  zhiliudianjice\电机最终版\新势力论坛.txt
     文件         186  2008-11-23 13:52  zhiliudianjice\电机最终版\重要说明.txt
............此处省略1个文件信息

评论

共有 条评论

相关资源