电子制作吧 关注:22,509贴子:117,170
  • 5回复贴,共1

PCB感光蓝油与阻焊蓝油烘干器

取消只看楼主收藏回复



1楼2014-09-19 15:27回复









    2楼2014-09-19 15:31
    回复
      SET——》用于选择设置时间、下限温度、上限温度;最大时间99分钟,由于加热片等因素限制最高温只能到60度。
      +、- -——》用于调结大小;
      START——》开始键;


      3楼2014-09-19 15:35
      回复
        当温度小于下限温度时,加热器进行加热;
        当温度大于下线温度小于上限温度时,加热器停止加热;
        当温度大于上限温度时,散热风扇进行工作。
        原理图如下:



        4楼2014-09-19 15:39
        回复
          源程序:
          #include<reg51.h>
          #define uchar unsigned char
          #define uint unsigned int
          sbit rs=P1^5;
          sbit rw=P1^6;
          sbit en=P1^7;
          //sbit rs=P2^6;
          //sbit rw=P2^5;
          //sbit en=P2^7;
          sbit DQ=P2^0; //18b20
          //sbit DQ=P1^7;
          sbit jdq=P1^1; //继电器
          sbit fj=P1^0;
          sbit fmq=P2^5; //蜂鸣器
          // sbit fmq=P1^5;
          sbit key1=P3^0;//设置
          sbit key2=P3^1;//加
          sbit key3=P3^2;//减
          sbit key4=P3^3;//开始
          uchar b,c,t,t1,t2,d1,d2,start;
          void init();
          void delay1(uint i);
          void delay5us();
          void delay(uint z);
          void Init_DS18B20(void);
          uchar ReadOneChar(void);
          void WriteOneChar(uchar dat);
          uint ReadTemperature(void);
          void write_1602byte(uchar date);
          void write_1602order(uchar date);
          void display();
          void keysan();
          void comper();
          void fengminqi();
          void main()
          {
          init();
          while(1)
          {
          keysan();
          comper();
          display();
          }
          }
          void init()//初始化程序
          {
          TMOD = 0x01; //定时器初始化
          TH0 = 0x4c;
          TL0 = 0x00;
          EA = 1;
          ET0 = 1;
          TR0 = 0;
          en=0;//初始化1602液晶
          rs=0;
          rw=1;
          start=0;
          fmq=0;
          jdq=0;
          fj=0;
          d1=5;
          d2=15 ;
          delay(5);
          write_1602order(0x38);
          write_1602order(0x0c);
          write_1602order(0x06);
          write_1602order(0x10);
          }
          void delay1(uint i)//延时函数
          {
          while(i--);
          }
          void delay5us() //延时5us
          {;;}
          void delay(uint z) //延时ms
          {
          uint x,y;
          for(x=z;x>0;x--)
          for(y=123;y>0;y--);
          }
          void Init_DS18B20(void)//18b20初始化
          {
          uchar x=0;
          DQ = 1; //DQ复位
          delay1(8); //稍做延时
          DQ = 0; //单片机将DQ拉低
          delay1(80); //精确延时 大于 480us
          DQ = 1; //拉高总线
          delay1(10);
          x=DQ; //稍做延时后 如果x=0则初始化成功 x=1则初始化失败
          delay1(5);
          }
          uchar ReadOneChar(void) //18b20读一个字节
          {
          uchar i=0;
          uchar dat = 0;
          for (i=8;i>0;i--)
          {
          DQ = 0; // 给脉冲信号
          dat>>=1;
          DQ = 1; // 给脉冲信号
          if(DQ)
          dat|=0x80;
          delay1(5);
          }
          return(dat);
          }
          void WriteOneChar(uchar dat)//18b20写一个字节
          {
          unsigned char i=0;
          for (i=8; i>0; i--)
          {
          DQ = 0;
          DQ = dat&0x01;
          delay1(5);
          DQ = 1;
          dat>>=1;
          }
          delay1(5);
          }
          uint ReadTemperature(void) //18b20读温度
          {
          uchar a=0;
          uint b=0;
          uint t=0;
          Init_DS18B20();
          WriteOneChar(0xCC); // 跳过读序号列号的操作
          WriteOneChar(0x44); // 启动温度转换
          delay1(200);
          Init_DS18B20();
          WriteOneChar(0xCC); //跳过读序号列号的操作
          WriteOneChar(0xBE); //读取温度寄存器等(共可读9个寄存器) 前两个就是温度
          a=ReadOneChar(); //低位
          b=ReadOneChar(); //高位
          b<<=8;
          t=a+b;
          return(t);
          }


          5楼2014-09-19 15:41
          回复
            void write_1602byte(uchar date) //1602写数据
            {
            rs=1;
            rw=0;
            delay5us();
            P0=date;
            delay5us();
            en=1;
            delay5us();
            en=0;
            delay5us();
            rw=1;
            rs=0;
            delay5us();
            delay5us();
            delay5us();
            delay5us();
            }
            void write_1602order(uchar date)//1602写指令
            {
            rs=0;
            rw=0;
            delay5us();
            P0=date;
            delay5us();
            en=1;
            delay5us();
            en=0;
            delay5us();
            rw=1;
            rs=1;
            delay5us();
            delay5us();
            delay5us();
            delay5us();
            }
            void display() //显示函数
            {
            t=(ReadTemperature()>>4)&0x00ff;
            write_1602order(0X80);
            write_1602byte(*S*);
            write_1602byte(*J*);
            write_1602byte(0X30+c/10);
            write_1602byte(0X30+c%10);
            write_1602byte(*:*);
            write_1602byte(0X30+b/10);
            write_1602byte(0X30+b%10);
            write_1602order(0X80+9);
            write_1602byte(*W*);
            write_1602byte(*D*);
            write_1602byte(0X30+t/100);
            write_1602byte(0X30+t%100/10);
            write_1602byte(0X30+t%10);
            write_1602byte(0xdf);
            write_1602byte(*c*);
            write_1602order(0X80+0x40);
            write_1602byte(*X*);
            write_1602byte(*X*);
            write_1602byte(0X30+t1/100);
            write_1602byte(0X30+t1%100/10);
            write_1602byte(0X30+t1%10);
            write_1602byte(0xdf);
            write_1602byte(*c*);
            write_1602order(0X80+0x40+9);
            write_1602byte(*S*);
            write_1602byte(*X*);
            write_1602byte(0X30+t2/100);
            write_1602byte(0X30+t2%100/10);
            write_1602byte(0X30+t2%10);
            write_1602byte(0xdf);
            write_1602byte(*c*);
            }
            /************************比较电路程序******************************
            ****当实际温度大于上限温度时,停止加热,同时散热风扇开始工作*******
            *******当实际温度小于下限温度时,开始加热,散热风扇未工作**********
            ******当实际温度在上限、下限温度之间时加热器与风扇都未工作*********
            *****当工作时间为零时,定时器停止工作,蜂鸣器开始报警**************/
            void comper()
            {
            if(start==1)
            {
            write_1602order(0X80+7);
            write_1602byte(0x7F);
            write_1602byte(0x7e);
            write_1602order(0X80+0x40+7);
            write_1602byte(0x7F);
            write_1602byte(0x7e);
            if((t>=t1)&&(t<=t2))
            {
            jdq=0;
            fj=0;
            }
            if(t<t1)
            {
            jdq=1;
            fj=0;
            }
            if(t>t2)
            {
            jdq=0;
            fj=1;
            }
            if((b==0)&&(c==0))
            {
            TR0=0;
            fengminqi();
            start=0;
            }
            }
            else
            {
            jdq=0;
            fj=0;
            TR0=0;
            write_1602order(0X80+7);
            write_1602byte(0x7e);
            write_1602byte(0x7f);
            write_1602order(0X80+0x40+7);
            write_1602byte(0x7e);
            write_1602byte(0x7f);
            }
            }
            void keysan()
            {
            uchar i,tp1,tp2,tp3;
            if(key1==0)
            {
            delay(d1);
            if(key1==0)
            {
            i++;
            if(i==9)
            i=0;
            }
            while(!key1);
            delay(d2);
            while(!key1);
            }
            /*************************时间设置,最大时间99分钟***********************************/
            while(i==1)//十分位
            {
            tp2=c/10;
            tp1=c%10;
            write_1602order(0X80+2);
            write_1602order(0X0f);//光标闪烁
            if(key2==0)
            {
            delay(d1);
            if(key2==0)
            {
            tp2++;
            if(tp2>9)
            tp2=0;
            }
            while(!key2);
            delay(d2);
            while(!key2);
            }
            if(key3==0)
            {
            delay(d1);
            if(key3==0)
            {
            tp2--;
            if(tp2>9)
            tp2=9;
            }
            while(!key3);
            delay(d2);
            while(!key3);
            }
            c=tp2*10+tp1;
            display();
            if(key1==0)
            {
            delay(d1);
            if(key1==0)
            {
            i++;
            if(i==9)
            i=0;
            }
            while(!key1);
            delay(d2);
            while(!key1);
            }
            }
            while(i==2)//分位
            {
            tp2=c/10;
            tp1=c%10;
            write_1602order(0X80+3);
            if(key2==0)
            {
            delay(d1);
            if(key2==0)
            {
            tp1++;
            if(tp1>9)
            tp1=0;
            }
            while(!key2);
            delay(d2);
            while(!key2);
            }
            if(key3==0)
            {
            delay(d1);
            if(key3==0)
            {
            tp1--;
            if(tp1>9)
            tp1=9;
            }
            while(!key3);
            delay(d2);
            while(!key3);
            }
            c=tp2*10+tp1;
            display();
            if(key1==0)
            {
            delay(d1);
            if(key1==0)
            {
            i++;
            if(i==9)
            i=0;
            }
            while(!key1);
            delay(d2);
            while(!key1);
            }
            }
            /*************************下限温度设置,最大温度150度***********************************/
            while(i==3)//百分位
            {
            tp3=t1/100;
            tp2=t1%100/10;
            tp1=t1%10;
            write_1602order(0X80+0x40+2);
            write_1602order(0X0f);//光标闪烁
            if(key2==0)
            {
            delay(d1);
            if(key2==0)
            {
            tp3++;
            if(tp3>1)
            tp3=0;
            }
            while(!key2);
            delay(d2);
            while(!key2);
            }
            if(key3==0)
            {
            delay(d1);
            if(key3==0)
            {
            tp3--;
            if(tp3>1)
            tp3=1;
            }
            while(!key3);
            delay(d2);
            while(!key3);
            }
            t1=tp3*100+tp2*10+tp1;
            display();
            if(key1==0)
            {
            delay(d1);
            if(key1==0)
            {
            i++;
            if(i==9)
            i=0;
            }
            while(!key1);
            delay(d2);
            while(!key1);
            }
            }
            while(i==4)//十分位
            {
            write_1602order(0X80+0x40+3);
            if(key2==0)
            {
            delay(d1);
            if(key2==0)
            {
            tp2++;
            if(tp2>=10)
            tp2=0;
            }
            while(!key2);
            delay(d2);
            while(!key2);
            }
            if(key3==0)
            {
            delay(d1);
            if(key3==0)
            {
            tp2--;
            if(tp2>9)
            tp2=9;
            }
            while(!key3);
            delay(d2);
            while(!key3);
            }
            t1=tp3*100+tp2*10+tp1;
            display();
            if(key1==0)
            {
            delay(d1);
            if(key1==0)
            {
            i++;
            if(i==9)
            i=0;
            }
            while(!key1);
            delay(d2);
            while(!key1);
            }
            }
            while(i==5)
            {
            write_1602order(0X80+0x40+4);
            if(key2==0)
            {
            delay(d1);
            if(key2==0)
            {
            tp1++;
            if(tp1>=10)
            tp1=0;
            }
            while(!key2);
            delay(d2);
            while(!key2);
            }
            if(key3==0)
            {
            delay(d1);
            if(key3==0)
            {
            tp1--;
            if(tp1>9)
            tp1=9;
            }
            while(!key3);
            delay(d2);
            while(!key3);
            }
            t1=tp3*100+tp2*10+tp1;
            display();
            if(key1==0)
            {
            delay(d1);
            if(key1==0)
            {
            i++;
            if(i==9)
            i=0;
            }
            while(!key1);
            delay(d2);
            while(!key1);
            }
            }
            /*************************上限温度设置,最大温度199度,实际温度不会超过120***********************************/
            while(i==6)//白分位
            {
            tp3=t2/100;
            tp2=t2%100/10;
            tp1=t2%10;
            write_1602order(0X80+0x40+11);
            if(key2==0)
            {
            delay(d1);
            if(key2==0)
            {
            tp3++;
            if(tp3>1)
            tp3=0;
            }
            while(!key2);
            delay(d2);
            while(!key2);
            }
            if(key3==0)
            {
            delay(d1);
            if(key3==0)
            {
            tp3--;
            if(tp3>1)
            tp3=1;
            }
            while(!key3);
            delay(d2);
            while(!key3);
            }
            t2=tp3*100+tp2*10+tp1;
            display();
            if(key1==0)
            {
            delay(d1);
            if(key1==0)
            {
            i++;
            if(i==9)
            i=0;
            }
            while(!key1);
            delay(d2);
            while(!key1);
            }
            }
            while(i==7)//十分位
            {
            write_1602order(0X80+0x40+12);
            if(key2==0)
            {
            delay(d1);
            if(key2==0)
            {
            tp2++;
            if(tp2>=10)
            tp2=0;
            }
            while(!key2);
            delay(d2);
            while(!key2);
            }
            if(key3==0)
            {
            delay(d1);
            if(key3==0)
            {
            tp2--;
            if(tp2>9)
            tp2=9;
            }
            while(!key3);
            delay(d2);
            while(!key3);
            }
            t2=tp3*100+tp2*10+tp1;
            display();
            if(key1==0)
            {
            delay(d1);
            if(key1==0)
            {
            i++;
            if(i==9)
            i=0;
            }
            while(!key1);
            delay(d2);
            while(!key1);
            }
            }
            while(i==8)//分位
            {
            write_1602order(0X80+0x40+13);
            if(key2==0)
            {
            delay(d1);
            if(key2==0)
            {
            tp1++;
            if(tp1>=10)
            tp1=0;
            }
            while(!key2);
            delay(d2);
            while(!key2);
            }
            if(key3==0)
            {
            delay(d1);
            if(key3==0)
            {
            tp1--;
            if(tp1>9)
            tp1=9;
            }
            while(!key3);
            delay(d2);
            while(!key3);
            }
            t2=tp3*100+tp2*10+tp1;
            display();
            if(key1==0)
            {
            delay(d1);
            if(key1==0)
            {
            i++;
            if(i==9)
            {
            i=0;
            write_1602order(0x0c);
            }
            }
            while(!key1);
            delay(d2);
            while(!key1);
            }
            }
            /**********************************按下key4开始启动*********************************/
            if(key4==0)
            {
            delay(d1);
            if(key4==0)
            {
            start++;
            if(start>=2)
            start=0;
            TR0=~TR0;
            }
            while(!key4);
            delay(d2);
            while(!key4);
            }
            }
            void fengminqi()//蜂鸣器报警程序时间为5秒钟
            {
            uchar i=20;
            while(i!=0)
            {
            fmq=~fmq;
            delay(500);
            i--;
            }
            }
            void time0()interrupt 1
            {
            uchar a;
            TH0 = 0x4c;
            TL0 = 0x00;
            a++;
            if(a==20)
            {
            a=0;
            b--;
            if(b>59)
            {
            b=59;
            c--;
            if(c>90)
            c=0;
            }
            }
            }


            6楼2014-09-19 15:41
            回复