文档介绍:定时插座设计
毕业设计题目:
《定时插座:智能插座》
程序完全正确;请放心下载;
想具体了解加本人qq984514922. 将有详细的软硬件资料。
单片机为:STC15F408AD
#include<>
#include<>
#define uchar unsigned char
#define uint unsigned int
char zdj,zjbk,zjbg;//中间变量开,中间变量关。
uchar tyue=11,tri=15,tzhou=3,tshi=12,tfen=30,tmiao=0;
uchar t,n,f,u,w,x,y,z,zhjca,zhjcb; //smbzh数码标志zhjca,zhjcb;转换寄存
uchar kss=20,ksf=10,jss=7,jsf=10,zdjk,zdjg,jdkf,jdgf;//开始时,开始分,结束时,结束分
uint tfz,fzq; // dlzd低电压 dyzg高电压设置dlz电流值dlz1,dlz2电流值1 电流值2(判断漏电)
uint zdz,zxz,zhz,mcs=0;
uint m=0,q=0,ql=0,d=0;
uchar ssz=0,ssdl=0,gbz,sss=0, sd;//关标志
sbit p30=P3^0;
bit mcsbz=0;
uchar sjkzy,sjkzl,xsmiao;
uchar shujdz,jdkf=5,jdgf=2;//间断开分,间断关分;// 调分钟,调小时
char sec=12, min=34, hour=12,day=8, month=8, zhou=1,tfzg=0,tfzs=0,tfzb=6,dlz=60;
uchar code baojing[10] = {0x43,0x8f,0x25,0xe3};//报警数d,l,s,j
uchar code table[10] = {0x81,0xf3,0x49,0x61,0x33,0x25,0x05,0xf1,0x01,0x21};
uchar code daima[60]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,
0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,
0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,
0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,
0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,
0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59, };
/*P2数据口, 点;P3位选口;
clk, io , ce;;;;; ,,,,*/
sbit ACC0 = ACC^0;
sbit ACC7 = ACC^7;
sbit gnaj = P0^0; //功能按键
sbit xzaj = P0^1; //选择按键
sbit zjaj = P0^2; //增加按键
sbit jsaj = P0^3; //减少按键
sbit wcaj = P1^4; //完成按键
sbit dian = P2^0;//点
sbit T_CLK = P1^0; /*实时时钟时钟线引脚*/
sbit T_IO = P1^1; /*实时时钟数据线引脚*/
sbit T_RST = P1^2; /*实时时钟复位线引脚*/
sbit kg=P1^6;
sbit p13=P1^7; //总开关
//AD定义
sfr P1_ASF=0x9d; //模拟通道选择不能位寻址地址9DH,置1则选通该通道,P1_ASF=0x20
sfr AD_CONTR=0xbc; //控制寄存器写入控制字地址BCh,开始控制,转换速度控制,转换标志位,转换开始,通道选择
sfr CLK_DIV=0x97; //结果存储选择寄存器地址97h,
sfr ADC_RES=0xbd; //结果地址高位地址BDh,高八位数据存放