13002s引脚参数作用_8550引脚图

13002s引脚参数作用_8550引脚图51单片机电阻测量(2路,TLC1543,恒流源)多路电阻测试仪的设计的要求1.电阻的测量范围1欧—1千欧2.可以设定电阻测量的上限值、下限值,另外还有大于上限报警、小于下限报警,正常测量指示灯(用不同

51单片机电阻测量(2路,TLC1543,恒流源)   多路电阻测试仪的设计的要求   1.电阻的测量范围1欧—1千欧   2.可以设定电阻测量的上限值、下限值,另外还有大于上限报警、小于下限报警,正常测量指示灯(用不同颜色LED进行显示)   3.设计有两个测量通道,可以通过按键进行通道的选择,另外还可以两个通道进行互不干扰测量(也就是全通道测量)   4.测量的数据可以通过LCD显示屏或者OLED显示屏显示测量数据,并且测量数据要分辨出是哪一个通道   5.可以将测量数据进行存储,并且可以进行存储数据的读取显示   扩展项   1.外部语音芯片进行读取测量数据   2.开机上电自检测,意思就是上电可以正常读取设定好的数据
13002s引脚参数作用_8550引脚图
13002s引脚参数作用_8550引脚图   #include “reg51.h”   #include”i2c.h”   #include “lcd1602.h”   #include”TLC1543.h”   #define uchar unsigned char   #define uint unsigned int   sbit led1=P3^5;//led   sbit led2=P3^6;   sbit led3=P3^7;   sbit beep=P3^4;//蜂鸣器   uchar time=0,mode=0,flag=0;//系统变量   uint res1=0,res2=0;//电阻   uint set1=10,set2=800;//报警值   uchar num=0;//存储变量   uchar cha=0;//查询变量   uchar disp1[]=”0000 “;   uchar disp2[]=”num1:”;   uchar disp3[]=”1:0000 2:0000 “;   uchar key_scan()//按键检测   {   uchar i,j;   i=0;   j=0;   P1=0x0f;   if(P1!=0x0f) //检测有无按下   {   switch(P1)//检测行   {   case 0x0e:i=3;break;   case 0x0d:i=2;break;   case 0x0b:i=1;break;   case 0x07:i=0;   }   P1=0xf0;   switch(P1)//检测列   {   case 0xe0:j=13;break;   case 0xd0:j=9;break;   case 0xb0:j=5;break;   case 0x70:j=1;   }   while(P1!=0xf0);//等待按键松开   }   return i+j;   }   void clear()//清屏   {   write_string(1,0,” “);   write_string(2,0,” “);   }   void main()//主函数   {   uchar i=0;   disp1[4]=0xf4;   //初始化存储   set2=At24c02Read(40);   set2=set2<<8;   set2=set2+At24c02Read(41);   if(set2>1000)   {   set2=800;   }   set1=At24c02Read(42);   set1=set1<<8;   set1=set1+At24c02Read(43);   if(set1>1000)   {   set1=10;   }   init_1602();//初始化LCD1602   TMOD|=0X01;//初始化定时器   TH0=0X3C;   TL0=0XB0;   ET0=1;   EA=1;   TR0=1;   while(1)   {   i=key_scan();//按键检测   if(i==1)//通道1   {   mode=0;flag=0;   clear();   }   if(i==2)//通道2   {   mode=0;flag=1;   clear();   }   if(i==3)//全通道   {   mode=0;flag=2;   clear();   }   if(i==4)//保存   {   At24c02Write(4*num,res1>>8);   At24c02Write(4*num+1,res1);   At24c02Write(4*num+2,res2>>8);   At24c02Write(4*num+3,res2);   if(num<9)   num++;   else   num=0;   }   if(i==5)//设置   {   mode=1;flag=0;   clear();   }   if(mode==1)//设置报警值   {   if(i==9)   {   if(set2<1000)   set2++;   At24c02Write(40,set2>>8);   At24c02Write(41,set2);   }   if(i==10)   {   if(set1<set2)   set1++;   At24c02Write(42,set1>>8);   At24c02Write(43,set1);   }   if(i==13)   {   if(set2>set1)   set2–;   At24c02Write(40,set2>>8);   At24c02Write(41,set2);   }   if(i==14)   {   if(set1>1)   set1–;   At24c02Write(42,set1>>8);   At24c02Write(43,set1);   }   }   if(i==6)//查询模式   {   mode=2;clear();   }   if(mode==2)   {   if(i==7)//上一个   {   if(cha>0)   cha–;   else   cha=9;   res1=At24c02Read(4*cha);   res1=res1<<8;   res1=res1+At24c02Read(4*cha+1);   res2=At24c02Read(4*cha+2);   res2=res1<<8;   res2=res1+At24c02Read(4*cha+3);   }   if(i==8)//下一个   {   if(cha<9)   cha++;   else   cha=0;   res1=At24c02Read(4*cha);   res1=res1<<8;   res1=res1+At24c02Read(4*cha+1);   res2=At24c02Read(4*cha+2);   res2=res1<<8;   res2=res1+At24c02Read(4*cha+3);   }   }   //报警   if(mode==0)   {   if((res1>set2)||(res1<set1))   {   led1=0;   }   else   led1=1;   if((res2>set2)||(res2<set1))   {   led2=0;   }   else   led2=1;   beep=led1 && led2;   led3=!beep;   }   else   beep=1;   }   }   //定时器中断   void Timer0() interrupt 1   {   uchar i=0;   unsigned long j=0;   if(time<10)//0.5s   time++;   else   {   time=0;   if(mode==0)   {   for(i=0;i<10;i++)//测量电阻1   {   res1=TLC1543_read(0);   delay_uint(100);   }   j=4096-res1;   j=j*100/324;   res1=j;   for(i=0;i<10;i++)//测量电阻2   {   res2=TLC1543_read(1);   delay_uint(100);   }   j=4096-res2;   j=j*100/324;   res2=j;   }   //阻值显示   if(mode==0)   {   if(flag==0)   {   if(res1/1000>0)   disp1[0]=res1/1000+0x30;   else   disp1[0]=’ ‘;   if(res1/100>0)   disp1[1]=res1%1000/100+0x30;   else   disp1[1]=’ ‘;   if(res1/10>0)   disp1[2]=res1%100/10+0x30;   else   disp1[2]=’ ‘;   disp1[3]=res1%10+0x30;   write_string(1,0,”RES1:”);   write_string(2,4,disp1);   }   if(flag==1)   {   if(res2/1000>0)   disp1[0]=res2/1000+0x30;   else   disp1[0]=’ ‘;   if(res2/100>0)   disp1[1]=res2%1000/100+0x30;   else   disp1[1]=’ ‘;   if(res2/10>0)   disp1[2]=res2%100/10+0x30;   else   disp1[2]=’ ‘;   disp1[3]=res2%10+0x30;   write_string(1,0,”RES2:”);   write_string(2,4,disp1);   }   if(flag==2)   {   if(res1/1000>0)   disp1[0]=res1/1000+0x30;   else   disp1[0]=’ ‘;   if(res1/100>0)   disp1[1]=res1%1000/100+0x30;   else   disp1[1]=’ ‘;   if(res1/10>0)   disp1[2]=res1%100/10+0x30;   else   disp1[2]=’ ‘;   disp1[3]=res1%10+0x30;   write_string(1,0,”RES1:”);   write_string(1,5,disp1);   if(res2/1000>0)   disp1[0]=res2/1000+0x30;   else   disp1[0]=’ ‘;   if(res2/100>0)   disp1[1]=res2%1000/100+0x30;   else   disp1[1]=’ ‘;   if(res2/10>0)   disp1[2]=res2%100/10+0x30;   else   disp1[2]=’ ‘;   disp1[3]=res2%10+0x30;   write_string(2,0,”RES2:”);   write_string(2,5,disp1);   }   }   //显示设置信息   if(mode==1)   {   if(set2/1000>0)   disp1[0]=set2/1000+0x30;   else   disp1[0]=’ ‘;   if(set2/100>0)   disp1[1]=set2%1000/100+0x30;   else   disp1[1]=’ ‘;   if(set2/10>0)   disp1[2]=set2%100/10+0x30;   else   disp1[2]=’ ‘;   disp1[3]=set2%10+0x30;   write_string(1,0,”UP:”);   write_string(1,5,disp1);   if(set1/1000>0)   disp1[0]=set1/1000+0x30;   else   disp1[0]=’ ‘;   if(set1/100>0)   disp1[1]=set1%1000/100+0x30;   else   disp1[1]=’ ‘;   if(set1/10>0)   disp1[2]=set1%100/10+0x30;   else   disp1[2]=’ ‘;   disp1[3]=set1%10+0x30;   write_string(2,0,”DOWN:”);   write_string(2,5,disp1);   }   //查询显示   if(mode==2)   {   disp2[3]=cha+0x30;   write_string(1,0,disp2);   if(res1/1000>0)   disp3[2]=res1/1000+0x30;   else   disp3[2]=’ ‘;   if(res1/100>0)   disp3[3]=res1%1000/100+0x30;   else   disp3[3]=’ ‘;   if(res1/10>0)   disp3[4]=res1%100/10+0x30;   else   disp3[4]=’ ‘;   disp3[5]=res1%10+0x30;   if(res2/1000>0)   disp3[10]=res2/1000+0x30;   else   disp3[10]=’ ‘;   if(res2/100>0)   disp3[11]=res2%1000/100+0x30;   else   disp3[11]=’ ‘;   if(res2/10>0)   disp3[12]=res2%100/10+0x30;   else   disp3[12]=’ ‘;   disp3[13]=res2%10+0x30;   write_string(2,0,disp3);   }   }   TH0=0X3C;   TL0=0XB0;   }

2024最新激活全家桶教程,稳定运行到2099年,请移步至置顶文章:https://sigusoft.com/99576.html

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。 文章由激活谷谷主-小谷整理,转载请注明出处:https://sigusoft.com/31495.html

(0)
上一篇 2024年 9月 11日
下一篇 2024年 9月 11日

相关推荐

关注微信