编辑: kr9梯 | 2013-05-23 |
满足要求进行下一项.浸泡30秒倒计时,倒计时完成提示浸泡完毕.洗涤分三种模式,弱洗、中洗、强洗,按键选择控制电机转动模式.漂洗可进行次数选择,0-9次之间.甩干高速正转,可进行时间控制,0-99秒之间. 3.2 主程序 * 文件名: check..c * 文件描述: 全自动洗衣机控制应用程序,单片机89C51,晶振6MHz * 关联文件: * 创建人: 邹春宇, 2008/07/10 * 版本号: 1.0 * 修改记录: * * #include 地址头文件*/ #include 绝对地址访问头文件*/ #include 数学库函数*/ #include 内部函数库*/ #define uint unsigned int;
#define uchar unsigned char;
sbit Speaker=P1^7;
蜂鸣器*/ sbit TLC549_DO=P1^6;
TLC549数据*/ sbit TLC549_CS=P1^5;
TLC549片选*/ sbit TLC549_CLK=P1^4;
TLC549时钟*/ sbit LED=P3^5;
LED小灯*/ #define w_c_add XBYTE[0x2070]写命令字地址 */ #define w_d_add XBYTE[0x2071]写数据地址 */ #define r_s_add XBYTE[0x2072]读状态字地址 */ #define r_d_add XBYTE[0x2073]读数据地址 */ #define c8279 XBYTE [0x2021]命令/状态口的地址 */ #define d8279 XBYTE [0x2020]数据口地址 */ /* 四相八拍控制 A-AB-B-BC-C-CD-D-DA */ unsigned char idata inc[10]={0x01,0x03,0x02,0x06,0x04,0x0c,0x08,0x09,0x00};
/*正转*/ unsigned char idata dec[10]={0x09,0x08,0x0c,0x04,0x06,0x02,0x03,0x01,0x00};
/*反转*/ unsigned char Motor_VE;
unsigned char Motor_DR;
unsigned char Motor_TIME;
unsigned char idata *x;
unsigned char int_time=0;
unsigned char second=0;
unsigned char bdata status;
可位寻址片内数据存储器,允许位与字节混合访问 */ sbit busy=status^7;
忙"线的第7位*/ unsigned char lcd_chr_x,lcd_chr_y;
当前坐标 */ unsigned char lcd_chr_half;
sbit clflag=ACC^7;
unsigned char key;
unsigned char keyflag=0;
unsigned char water_level;
unsigned char high_level=255;
unsigned char low_level=0;
unsigned char wash_time;
unsigned char piao_time;
unsigned char pause=0;
void init_timer(void);
void init_lcd(void);
void init_8279(void);
unsigned char TLC549_CONVERT(void)启动AD转换函数*/ void Motor_Control(unsigned char VE,unsigned char DR,unsigned char TIME);
函数名:delay 函数功能:延时函数 void delay1(unsigned int t) { unsigned int i,j;
for(i=0;
i