📄 define._h
字号:
#define NULL 0
#define FALSE 0
#define TRUE 1
//定义接收缓冲区的长度
#define UARTRXLEN 200
#define TELLEN 30
//时间长度不超过4位(0-9999)分钟
#define TIMELEN 4
//命令编号
#define LINE 0
//
#define SETUPTEL 1
#define RTEL 2
#define CALLTEL 3
#define GET 4
#define RINGOFF 5
#define QUERY 6
#define NULLACK 7
//------------------------
#define SET_BIT(X,Y) (X|=(1<<Y))
#define CLR_BIT(X,Y) (X&=~(1<<Y))
#define GET_BIT(X,Y) (X&(1<<Y))
#define XOR_BIT(X,Y) (X^=(1<<Y))
//定时
#define timesec 20 //2s
#define time3sec 30
#define LEDON SET_BIT(PORTB,5)
#define LEDOFF CLR_BIT(PORTB,5)
/* Static Variables */
typedef unsigned char uchar;
typedef unsigned int uint;
unsigned char WorkCount; //工作指示
static unsigned char Busybz;
unsigned char *pir; //指针
static unsigned char UART_RXHEAD; //接收计数器
static unsigned char DealRxUartBz; //串口接收处理标志
static unsigned char DealTxUartBz; //串口发送标志
static unsigned char TelBuf[TELLEN+1]; //电话本缓冲区
//
union
{
uchar Buf[UARTRXLEN]; //定义接收缓冲区
struct
{
uchar sd[100];
uchar Temp[100];
}ch;
}Uart;
//时间定时器
struct
{
unsigned char Sec; //分钟计数器
unsigned int Atd; //拔号定时0-9999分钟,0为不定时
unsigned int Min; //分钟
unsigned int Mec; //分
uchar Bz; //毫秒定时到标志置1
}Time;
void delay_us(int time)
{
do
{
time--;
}
while (time>1);
}
/* 毫秒级延时程序 */
void delay_ms(unsigned int time)
{
while(time!=NULL)
{
WDR();
delay_us(825);
time--;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -