新闻中心

EEPW首页>嵌入式系统>设计应用> 1602 AVR单片机版 报警指示功能

1602 AVR单片机版 报警指示功能

作者: 时间:2016-11-30 来源:网络 收藏
使用的是ATMEGA16芯片
功能说明:正常状态下,8个LED不停闪烁,1602显示normal indication指示
报警状态下, 8个LED全发亮不闪烁,1602显示alarm报警,只有按复位按钮才能解除报警.
alarm状态时,由于PB口的低3位和,1602时能,读写,数据指令寄存器选择位复用,所以有点暗.
#include
#include
#define uchar unsigned char
#define uint unsigned int
#define RS1 PORTB_Bit0=1 //数据指令寄存器选择
#define RS0 PORTB_Bit0=0
#define RW1 PORTB_Bit1=1 //读写选择
#define RW0 PORTB_Bit1=0
#define EN1 PORTB_Bit2=1 //读写时能
#define EN0 PORTB_Bit2=0
#define DATAPORT PORTA //1602数据口
#define busy 0x80 //繁忙标志
#include "ku.h" //调用函数库
//-------------------------------------------
uchar alarm[]={"alarm "}; //报警字符串
uchar normal[]={"normal"}; //正常字符串
uchar indication[]={"indication"};
//-------------------------函数声明--------------

上一页 1 2 下一页

评论


技术专区

关闭