1. 程式人生 > 實用技巧 >589【畢設課設】基於51微控制器溫度控制電機攪拌系統設計

589【畢設課設】基於51微控制器溫度控制電機攪拌系統設計

【資源下載】下載地址如下:
https://docs.qq.com/doc/DTlRSd01BZXNpRUxl

#include"delay.h"
#include"ds1302.h"
#include"key.h"
#include"24c02.h"
#include"draw.h"

unsigned char PWM_ON;   //定義速度等級
#define CYCLE 10     //週期


unsigned int TempH,TempL,temp;//溫度相關引數

unsigned char tab_wendu[6];
//unsigned char K;
unsigned char L;
uchar flag=0;
bit write=0;
uchar mstcnt=0;
bit outflag;

sbit out=P2^3;    //定義繼電器輸出埠
sbit DCOUT = P1^3;//定義電機訊號輸出埠
sbit k1=P3^4;
sbit k2=P3^5;

//顯示日期時間
void display_time(void)
{
	uchar i; 
   	//年
	Display8x16(0,8,time_buf1[1]/10+0x30);
	Display8x16(0,9,time_buf1[1]%10+0x30);
	//月
	Display8x16(0,12,time_buf1[2]/10+0x30);
	Display8x16(0,13,time_buf1[2]%10+0x30);
	//日
	Display8x16(0,16,time_buf1[3]/10+0x30);
	Display8x16(0,17,time_buf1[3]%10+0x30);
   	//時
	if(flag==2)
	{
		i++;
		if(i>=6)
			i=0;
		if(i<3)
		{
			Display8x16(20,6,0xff);
			Display8x16(20,7,0xff);	
		}
		else
		{
			Display8x16(20,6,time_buf1[4]/10+0x30);
			Display8x16(20,7,time_buf1[4]%10+0x30);
		}
	}
	else
	{
		Display8x16(20,6,time_buf1[4]/10+0x30);
		Display8x16(20,7,time_buf1[4]%10+0x30);
	}
	//分
	if(flag==1)
	{
		i++;
		if(i>=6)
			i=0;
		if(i<3)