基于单片机自动水龙头倒计时仿真设计-毕设课设资料

百度网盘下载地址(1135):点击下载

#include <reg52.h>
#define uchar	unsigned char
#define uint	unsigned int
#define duan	P1
#define wei	P3
sbit	key1	= P2 ^ 3;                                                                               /* 设置 */
sbit	key2	= P2 ^ 4;                                                                               /* 加 */
sbit	key3	= P2 ^ 5;                                                                               /* 减 */
sbit	key4	= P2 ^ 6;                                                                               /* 启动 */
sbit	key5	= P2 ^ 7;                                                                               
sbit	out	= P2 ^ 2;                                                                               /* 输出控制 ,低电平有效 */
sbit	di	= P2 ^ 0;                                                                               /* 蜂鸣器 */
sbit	water	= P2 ^ 1;

bit		flag = 0, flag1 = 0, shan = 0;
uchar		knum, shan_cont;
uchar		shi		= 0, fen = 0, miao = 0, cont, cont1, cont2;
uchar code	duanma[]	= { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f };       /* 共阴段码表 */
/* uchar code weima[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};//位码 */
uchar code weima[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };                                /* 位码	加反相器用 */

void delay( uint z )
{
	uint x, y;
	for ( x = z; x > 0; x-- )
		for ( y = 114; y > 0; y-- )

posted @ 2021-02-20 11:23  roadroad  阅读(102)  评论(0编辑  收藏  举报
电设屋
上千套电子毕设课设方案