📄 hal.h
字号:
/*************************************
;Ade7169 demo program
;*************************************
;AUTHOR: Su RuTong
;DATE: 03 09 2006
;*************************************/
#ifndef _HAL_H_
#define _HAL_H_
//#define __IAR_SYSTEMS_ICC__
//#include "io8052.h"
#ifdef __IAR_SYSTEMS_ICC__
#include "ioADE7169F16.h"
#else
#include "ADE71xxFxx.h"
#endif
// Public
// Common Misc. Defines...
#ifndef TRUE
#define TRUE 0x01
#endif
#ifndef FALSE
#define FALSE 0x00
#endif
#ifndef ON
#define ON 0x01
#endif
#ifndef OFF
#define OFF 0x00
#endif
#ifndef NULL
#define NULL 0x00
#endif
#define Disable_Global_Int() (EA=FALSE)
#define Enable_Global_Int() (EA=TRUE)
#define _enable_WDT() (WDE = 0) // Enable watchdog timer by writing value to WDKEY other than 55h
#define _disable_WDT() (WDE = 1) // Disable watchdog timer
// WDTperiod = Tmach_cyc x N overflow
// Tmach_cyc = 108ns (4 MCU_CLK periods x 27ns)
// N overflow = 2^24 = 16777216 up-counts
// WDTperiod = 108ns X 16777216 = 1.82 seconds
extern void _clr_wdt(void);
#define CLR_WDT() _clr_wdt() // WDT's time-out period is 1.8 seconds.reset WDT, loading 000000h.
#ifdef __IAR_SYSTEMS_ICC__
// For IAR location keyword
#define _at_ (@)
#define bool _Bool
#define code __code
#define data __data
#define idata __idata
#define pdata __pdata
#define xdata __xdata
//#define bit (__no_init __bit bool)
#define OK 0
#define ERROR 0xFF
extern void __no_operation(void);
#define _no_operation() (__no_operation())
#else
//typedef @ _at_;
//typedef __code code;
//typedef __data data;
//typedef __idata idata;
//typedef __pdata pdata;
//typedef __xdata xdata;
#endif
// #define LCDMEM ((char*) LCDMEM_) /* LCD Memory (for C) */
#ifdef __IAR_SYSTEMS_ICC__
#define P0_2 P0_bit.CF1_S
#define P0_3 P0_bit.CF2_S
#define I2C_SDA P0_bit.SDATA
#define I2C_SCL P0_bit.T0_S
#else
sbit P0_2=P0^2;
sbit P0_3=P0^3;
sbit I2C_SDA=P0^4;
sbit I2C_SCL=P0^6;
#endif
#define SCROLL_UP_PIN (BIT3)//P1.3
#define SCROLL_DOWN_PIN (BIT2)//P2.2
#define CF1_LED (P0_2)//P0.2
#define CF2_LED (P0_3)//P0.3
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -