📄 def._h
字号:
/****************************************/
//定义MCU与LCD的接口
/******************************************
MS1602 PIN DEFINE:
RS PA2
EN PA3
D4~D7 PB0~PB3
******************************************/
#define LCD_DATA_PORT PORTB
#define LCD_CONTROL_PORT PORTA
#define LCD_DATA_DDR DDRB
#define LCD_CONTROL_DDR DDRA
#define LCD_DATA_MASK 0x0F
#define RS (1<<2)
#define EN (1<<3)
#define SET_RS() LCD_CONTROL_PORT |= RS
#define CLR_RS() LCD_CONTROL_PORT &= ~RS
#define SET_EN() LCD_CONTROL_PORT |= EN
#define CLR_EN() LCD_CONTROL_PORT &= ~EN
#define xtal 8 //晶振调整 MHz
#define uint8_t unsigned char
#define uint16_t unsigned int
/****************************************/
/******************************************
DS18B20 PIN DEFINE:
Dout PD7
******************************************/
#define BEEP (1<<2)
#define BEEP_PORT PORTD
#define BEEP_DDR DDRD
#define BEEP_ON(); BEEP_PORT |= BEEP;
#define BEEP_OFF(); BEEP_PORT &= ~BEEP;
#define DS18B20_IO (1<<7)
#define DS18B20_PORT PORTD
#define DS18B20_DDR DDRD
#define Set_high(); DS18B20_DDR |= (1<<7);DS18B20_PORT |= (1<<7);
#define Set_low(); DS18B20_DDR |= (1<<7);DS18B20_PORT &= ~(1<<7);
#define Read(); DS18B20_DDR &= ~(1<<7);
#define Units(); LCD_write_byte(0,0xdf);LCD_write_byte(0,'C');
#define Negative(); LCD_write_byte(0,'-');
#define Positive(); LCD_write_byte(0,'+');
/****************************************/
/******************************************
DS1302 PIN DEFINE:
/RST PD6
SCLK PD4
IO PD5
******************************************/
#define SCLK (1<<3)
#define IO (1<<4)
#define RST (1<<5)
#define RET_PORT PORTD
#define SCLK_PORT PORTD
#define IO_PORT PORTD
#define IO_DDR DDRD
#define IO_PIN PIND
#define DS1302_DDR DDRD
#define DS1302_PORT PORTD
#define SET_RST() {RET_PORT |= RST;}
#define CLR_RST() {RET_PORT &=~ RST;}
#define SET_SCLK() {SCLK_PORT |= SCLK;}
#define CLR_SCLK() {SCLK_PORT &=~ SCLK;}
#define SET_IO() {IO_PORT |= IO;}
#define CLR_IO() {IO_PORT &=~ IO;}
#define SET_IO_INPUT() {IO_DDR &=~ IO;}
/***************************************************************
COMMAND/ADDRESS FORMAT
bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
1 RAM/CK A4 A3 A2 A1 A0 R/W
***************************************************************/
// second,mintue,hour,date,month,day,year,control,trickle charge,clock burst
//adderss: 0 1 2 3 4 5 6 7 8 9
/**************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -