1602 AVR單片機版 報警指示功能
功能說明:正常狀態下,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"};
//-------------------------函數聲明--------------
關鍵詞:
1602AVR單片機報警指
評論