AVR ATmega8中用到的macros.h源程序
请问谁有AVRATmega8中用到的macros.h源程序?一定要能用到ATmega8中。急!!!谢谢!...
请问谁有AVR ATmega8中用到的macros.h源程序?一定要能用到ATmega8中。急!!!谢谢 !
展开
展开全部
/**************************************************
*
* Common macro declarations used for peripheral I/O
* declarations for ARM IAR C/C++ Compiler and Assembler.
*
* Copyright 1999-2005 IAR Systems. All rights reserved.
*
* $Revision: 13625 $
*
**************************************************/
#ifndef __IO_MACROS_H
#define __IO_MACROS_H
/***********************************************
* C specific macros
***********************************************/
#ifdef __IAR_SYSTEMS_ICC__
#ifndef _SYSTEM_BUILD
#pragma system_include
#endif
#pragma language=save
#pragma language=extended
/* SFR sizes */
#define __REG8 unsigned char
#define __REG16 unsigned short
#define __REG32 unsigned long
/***********************************************
* I/O reg attributes
***********************************************/
#define __READ_WRITE
#ifdef __cplusplus
#define __READ /* Not supported */
#else
#define __READ const
#endif
#define __WRITE /* Not supported */
/***********************************************
* I/O reg bits (default names)
***********************************************/
typedef struct
{
unsigned char no0:1;
unsigned char no1:1;
unsigned char no2:1;
unsigned char no3:1;
unsigned char no4:1;
unsigned char no5:1;
unsigned char no6:1;
unsigned char no7:1;
} __BITS8;
typedef struct
{
unsigned short no0:1;
unsigned short no1:1;
unsigned short no2:1;
unsigned short no3:1;
unsigned short no4:1;
unsigned short no5:1;
unsigned short no6:1;
unsigned short no7:1;
unsigned short no8:1;
unsigned short no9:1;
unsigned short no10:1;
unsigned short no11:1;
unsigned short no12:1;
unsigned short no13:1;
unsigned short no14:1;
unsigned short no15:1;
} __BITS16;
typedef struct
{
unsigned long no0:1;
unsigned long no1:1;
unsigned long no2:1;
unsigned long no3:1;
unsigned long no4:1;
unsigned long no5:1;
unsigned long no6:1;
unsigned long no7:1;
unsigned long no8:1;
unsigned long no9:1;
unsigned long no10:1;
unsigned long no11:1;
unsigned long no12:1;
unsigned long no13:1;
unsigned long no14:1;
unsigned long no15:1;
unsigned long no16:1;
unsigned long no17:1;
unsigned long no18:1;
unsigned long no19:1;
unsigned long no20:1;
unsigned long no21:1;
unsigned long no22:1;
unsigned long no23:1;
unsigned long no24:1;
unsigned long no25:1;
unsigned long no26:1;
unsigned long no27:1;
unsigned long no28:1;
unsigned long no29:1;
unsigned long no30:1;
unsigned long no31:1;
} __BITS32;
/***********************************************
* Define NAME as an I/O reg
* Access of 8/16/32 bit reg: NAME
***********************************************/
#define __IO_REG8(NAME, ADDRESS, ATTRIBUTE) \
volatile __no_init ATTRIBUTE unsigned char NAME @ ADDRESS
#define __IO_REG16(NAME, ADDRESS, ATTRIBUTE) \
volatile __no_init ATTRIBUTE unsigned short NAME @ ADDRESS
#define __IO_REG32(NAME, ADDRESS, ATTRIBUTE) \
volatile __no_init ATTRIBUTE unsigned long NAME @ ADDRESS
/***********************************************
* Define NAME as an I/O reg
* Access of 8/16/32 bit reg: NAME
* Access of bit(s): NAME_bit.noX (X=1-31)
***********************************************/
#define __IO_REG8_BIT(NAME, ADDRESS, ATTRIBUTE, BIT_STRUCT)\
volatile __no_init ATTRIBUTE union \
{ \
unsigned char NAME; \
BIT_STRUCT NAME ## _bit; \
} @ ADDRESS
#define __IO_REG16_BIT(NAME, ADDRESS, ATTRIBUTE,BIT_STRUCT)\
volatile __no_init ATTRIBUTE union \
{ \
unsigned short NAME; \
BIT_STRUCT NAME ## _bit; \
} @ ADDRESS
#define __IO_REG32_BIT(NAME, ADDRESS, ATTRIBUTE, BIT_STRUCT)\
volatile __no_init ATTRIBUTE union \
{ \
unsigned long NAME; \
BIT_STRUCT NAME ## _bit; \
} @ ADDRESS
#pragma language=restore
#endif /* __IAR_SYSTEMS_ICC__ */
/***********************************************
* Assembler specific macros
***********************************************/
#ifdef __IAR_SYSTEMS_ASM__
/***********************************************
* I/O reg attributes (ignored)
***********************************************/
#define __READ_WRITE 0
#define __READ 0
#define __WRITE 0
/***********************************************
* Define NAME as an I/O reg
***********************************************/
#define __IO_REG8(NAME, ADDRESS, ATTRIBUTE) \
NAME DEFINE ADDRESS
#define __IO_REG16(NAME, ADDRESS, ATTRIBUTE) \
NAME DEFINE ADDRESS
#define __IO_REG32(NAME, ADDRESS, ATTRIBUTE) \
NAME DEFINE ADDRESS
/***********************************************
* Define NAME as an I/O reg
***********************************************/
#define __IO_REG8_BIT(NAME, ADDRESS, ATTRIBUTE, BIT_STRUCT) \
NAME DEFINE ADDRESS
#define __IO_REG16_BIT(NAME, ADDRESS, ATTRIBUTE, BIT_STRUCT) \
NAME DEFINE ADDRESS
#define __IO_REG32_BIT(NAME, ADDRESS, ATTRIBUTE, BIT_STRUCT) \
NAME DEFINE ADDRESS
#endif /* __IAR_SYSTEMS_ASM__ */
#endif /* __IO_MACROS_H */
一字不漏的拷贝过来了 ,看下可以用不!记得给分哟
*
* Common macro declarations used for peripheral I/O
* declarations for ARM IAR C/C++ Compiler and Assembler.
*
* Copyright 1999-2005 IAR Systems. All rights reserved.
*
* $Revision: 13625 $
*
**************************************************/
#ifndef __IO_MACROS_H
#define __IO_MACROS_H
/***********************************************
* C specific macros
***********************************************/
#ifdef __IAR_SYSTEMS_ICC__
#ifndef _SYSTEM_BUILD
#pragma system_include
#endif
#pragma language=save
#pragma language=extended
/* SFR sizes */
#define __REG8 unsigned char
#define __REG16 unsigned short
#define __REG32 unsigned long
/***********************************************
* I/O reg attributes
***********************************************/
#define __READ_WRITE
#ifdef __cplusplus
#define __READ /* Not supported */
#else
#define __READ const
#endif
#define __WRITE /* Not supported */
/***********************************************
* I/O reg bits (default names)
***********************************************/
typedef struct
{
unsigned char no0:1;
unsigned char no1:1;
unsigned char no2:1;
unsigned char no3:1;
unsigned char no4:1;
unsigned char no5:1;
unsigned char no6:1;
unsigned char no7:1;
} __BITS8;
typedef struct
{
unsigned short no0:1;
unsigned short no1:1;
unsigned short no2:1;
unsigned short no3:1;
unsigned short no4:1;
unsigned short no5:1;
unsigned short no6:1;
unsigned short no7:1;
unsigned short no8:1;
unsigned short no9:1;
unsigned short no10:1;
unsigned short no11:1;
unsigned short no12:1;
unsigned short no13:1;
unsigned short no14:1;
unsigned short no15:1;
} __BITS16;
typedef struct
{
unsigned long no0:1;
unsigned long no1:1;
unsigned long no2:1;
unsigned long no3:1;
unsigned long no4:1;
unsigned long no5:1;
unsigned long no6:1;
unsigned long no7:1;
unsigned long no8:1;
unsigned long no9:1;
unsigned long no10:1;
unsigned long no11:1;
unsigned long no12:1;
unsigned long no13:1;
unsigned long no14:1;
unsigned long no15:1;
unsigned long no16:1;
unsigned long no17:1;
unsigned long no18:1;
unsigned long no19:1;
unsigned long no20:1;
unsigned long no21:1;
unsigned long no22:1;
unsigned long no23:1;
unsigned long no24:1;
unsigned long no25:1;
unsigned long no26:1;
unsigned long no27:1;
unsigned long no28:1;
unsigned long no29:1;
unsigned long no30:1;
unsigned long no31:1;
} __BITS32;
/***********************************************
* Define NAME as an I/O reg
* Access of 8/16/32 bit reg: NAME
***********************************************/
#define __IO_REG8(NAME, ADDRESS, ATTRIBUTE) \
volatile __no_init ATTRIBUTE unsigned char NAME @ ADDRESS
#define __IO_REG16(NAME, ADDRESS, ATTRIBUTE) \
volatile __no_init ATTRIBUTE unsigned short NAME @ ADDRESS
#define __IO_REG32(NAME, ADDRESS, ATTRIBUTE) \
volatile __no_init ATTRIBUTE unsigned long NAME @ ADDRESS
/***********************************************
* Define NAME as an I/O reg
* Access of 8/16/32 bit reg: NAME
* Access of bit(s): NAME_bit.noX (X=1-31)
***********************************************/
#define __IO_REG8_BIT(NAME, ADDRESS, ATTRIBUTE, BIT_STRUCT)\
volatile __no_init ATTRIBUTE union \
{ \
unsigned char NAME; \
BIT_STRUCT NAME ## _bit; \
} @ ADDRESS
#define __IO_REG16_BIT(NAME, ADDRESS, ATTRIBUTE,BIT_STRUCT)\
volatile __no_init ATTRIBUTE union \
{ \
unsigned short NAME; \
BIT_STRUCT NAME ## _bit; \
} @ ADDRESS
#define __IO_REG32_BIT(NAME, ADDRESS, ATTRIBUTE, BIT_STRUCT)\
volatile __no_init ATTRIBUTE union \
{ \
unsigned long NAME; \
BIT_STRUCT NAME ## _bit; \
} @ ADDRESS
#pragma language=restore
#endif /* __IAR_SYSTEMS_ICC__ */
/***********************************************
* Assembler specific macros
***********************************************/
#ifdef __IAR_SYSTEMS_ASM__
/***********************************************
* I/O reg attributes (ignored)
***********************************************/
#define __READ_WRITE 0
#define __READ 0
#define __WRITE 0
/***********************************************
* Define NAME as an I/O reg
***********************************************/
#define __IO_REG8(NAME, ADDRESS, ATTRIBUTE) \
NAME DEFINE ADDRESS
#define __IO_REG16(NAME, ADDRESS, ATTRIBUTE) \
NAME DEFINE ADDRESS
#define __IO_REG32(NAME, ADDRESS, ATTRIBUTE) \
NAME DEFINE ADDRESS
/***********************************************
* Define NAME as an I/O reg
***********************************************/
#define __IO_REG8_BIT(NAME, ADDRESS, ATTRIBUTE, BIT_STRUCT) \
NAME DEFINE ADDRESS
#define __IO_REG16_BIT(NAME, ADDRESS, ATTRIBUTE, BIT_STRUCT) \
NAME DEFINE ADDRESS
#define __IO_REG32_BIT(NAME, ADDRESS, ATTRIBUTE, BIT_STRUCT) \
NAME DEFINE ADDRESS
#endif /* __IAR_SYSTEMS_ASM__ */
#endif /* __IO_MACROS_H */
一字不漏的拷贝过来了 ,看下可以用不!记得给分哟
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
上海德康电子
2023-06-12 广告
2023-06-12 广告
ALPS Bluetooth 模块是一种支持蓝牙协议的无线通信模块,通常用于连接蓝牙设备,如手机、耳机、音箱等。ALPS Bluetooth 模块有多种类型,其中包括:1. UGZZC-G 车载用Bluetooth模块:这是一种内置蓝牙协议...
点击进入详情页
本回答由上海德康电子提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询