?? hardware.h
字號:
/*********************************************************************
微 雪 電 子 WaveShare http://www.waveShare.net
目 的: 建立AVR的硬件提取庫,增加各類補丁,方便移植
目標系統: 基于AVR單片機
應用軟件: ICCAVR
版 本: Version 1.0
圓版時間: 2005-06-25
開發人員: SEE
說 明: 若用于商業用途,請保留此段文字或注明代碼來源
深 圳 微 雪 電 子 保 留 所 有 的 版 權
*********************************************************************/
/*01010101010101010101010101010101010101010101010101010101010101010101
----------------------------------------------------------------------
版本更新記錄:
----------------------------------------------------------------------
入口參數說明:
----------------------------------------------------------------------
待定參數說明:
----------------------------------------------------------------------
對外變量說明:
----------------------------------------------------------------------
對外函數說明:
----------------------------------------------------------------------
10101010101010101010101010101010101010101010101010101010101010101010*/
#ifndef Hardware_H
#define Hardware_H
#include <math.h>
#include <string.h>
#include <stdio.h>
#include <macros.h>
#include <eeprom.h>
//#include <wdt.h>
#include "D:\ICC_H\I2C.H" //i2c即AVR的"twi"
/* hard configs */
#ifndef flash
#define flash const
#endif
#ifndef code
#define code const
#endif
#ifndef NOP
#define NOP() asm("nop")
#endif
/* io configs */
#define sbi(io,bit) ( io |= (1<<bit) ) //example: sbi(PORTA,0);sbi(DDRA,0);
#define cbi(io,bit) ( io &= ~(1<<bit) ) //example: cbi(PORTA,0);cbi(DDRA,0);
#define gbi(pin ,bit) ( pin & (1<<bit) ) //example: gbi(PINA,0);
/* interrupt configs */
#define DIS_INT asm("sei")
#define EN_INT asm("cli")
/* wdt configs */
#define WDT() asm("wdr")
/* bit operation */
//#ifndef BIT
//#define BIT(x) ( 1<<(x) )
//#endif
/* USART configs for 4 Mhz crystal */
//#define BAUD9600 25
//#define BAUD19000 12
//#define UART_TRAN_ON() UCR |= 0x08
//#define UART_TRAN_OFF() UCR &= ~0x08
//#define UART_RCV_ON() UCR |= 0x10
//#define UART_RCV_OFF() UCR &= ~0x10
/*--------------------------------------------------------------------
函數全稱:50us 延時
函數功能:當然是 50us延時 啦
注意事項:基于7.3728M晶振,稍微有點誤差
提示說明:調用Delay50us(20),得到1ms延時
輸 入:
返 回:無
--------------------------------------------------------------------*/
void delay50us(sint16 t)
{
uint8 j;
for(;t>0;t--)
for(j=0;j<70;j++)
;
}
/*--------------------------------------------------------------------
函數全稱:50ms 延時
函數功能:當然是 50ms延時 啦
注意事項:基于7.3728M晶振,稍微有點誤差
提示說明:調用delay50ms(20),得到1s延時
輸 入:
返 回:無
--------------------------------------------------------------------*/
void delay50ms(sint16 t)
{
uint16 i;
for(;t>0;t--)
for(i=0;i<52642;i++)
;
}
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -