typedef struct bit0 : 1
来源:互联网 发布:淘宝页面显示不全 编辑:程序博客网 时间:2024/05/23 19:31
#define Uint unsigned inttypedef struct{Uint bit0 : 1;Uint bit1 : 1;Uint bit2 : 1;Uint bit3 : 1;Uint bit4 : 1;Uint bit5 : 1;Uint bit6 : 1;Uint bit7 : 1;Uint bit8 : 1;Uint bit9 : 1;Uint bit10 : 1;Uint bit11 : 1;Uint bit12 : 1;Uint bit13 : 1;Uint bit14 : 1;Uint bit15 : 1;}Bit;typedef struct{Uint bytel : 8;Uint byteh : 8;}Byte;typedef union{Bit bit;Byte byte;Uint port;}UNport;#define PA ((volatile UNport *)(0x7000))#define PA_Buffer ((volatile UNport *)(0x7001))#define PA_Dir ((volatile UNport *)(0x7002))#define PA_Attrib ((volatile UNport *)(0x7003))#define PA_Latch ((volatile UNport *)(0x7004))#define PB ((volatile UNport *)(0x7005))#define PB_Buffer ((volatile UNport *)(0x7006))#define PB_Dir ((volatile UNport *)(0x7007))#define PB_Attrib ((volatile UNport *)(0x7008))#define Poscu ((volatile UNport *)(0x7013))#define Ptbu ((volatile UNport *)(0x700e))#define Ptbc ((volatile UNport *)(0x700f))#define Pt0 ((volatile UNport *)(0x700a))#define Pt1 ((volatile UNport *)(0x700c))#define Pt0u ((volatile UNport *)(0x700b))#define Pt1u ((volatile UNport *)(0x700d))#define Pintu ((volatile UNport *)(0x7010))#define Pintc ((volatile UNport *)(0x7011))#define Padm ((volatile UNport *)(0x7014))#define Padl ((volatile UNport *)(0x702c))#define Padu ((volatile UNport *)(0x7015))#define Padmuxu ((volatile UNport *)(0x702b))#define Pda0 ((volatile UNport *)(0x7017))#define Pda1 ((volatile UNport *)(0x7016))#define Pdau ((volatile UNport *)(0x702a))#define Pwdogc ((volatile UNport *)(0x7012))#define Pflashu ((volatile UNport *)(0x7555))//-------------------------------------------------------------------------------------------------------//以下部分在编程中直接调用使用;#define Watchdog_Clear Pwdogc->port#define P0_0 PA->bit.bit0#define P0_1 PA->bit.bit1#define P0_2 PA->bit.bit2#define P0_3 PA->bit.bit3#define P0_4 PA->bit.bit4#define P0_5 PA->bit.bit5这种结构体定义方式书上没有解释?不明白什么意思?Uint bit: 1;: 1?没见过?为什么这样可以将凌阳单片机的接口进行位定义?
回答:
一.
二.
- typedef struct bit0 : 1
- 1、typedef 与 define 区别 2、 struct和typedef struct
- typedef struct
- typedef struct
- typedef struct
- typedef struct
- Struct && typedef
- struct / typedef
- typedef struct
- typedef struct
- typedef struct
- typedef struct
- typedef struct
- typedef 与 typedef struct
- typedef与typedef struct
- struct和typedef struct
- struct和typedef struct
- struct和typedef struct
- 第13章 复制控制 (part2) 消息处理示例
- 爱是永久相思情
- 看到这张图,你有什么启发?
- vim插件
- Hibernate的save(transientInstance)引发的持久化对象三种状态思考
- typedef struct bit0 : 1
- 由于代码已经过优化或者本机框架位于调用堆栈之上,无法计算表达式的值”的解决方法
- 旧工程适配iOS 6和iPhone 5之第三方静态库
- 基于ARM-μCLinux嵌入式系统
- 工具分享:Dynamics CRM Job Editor
- C++中 explicit关键字
- 如何处理变大的EXCEL文件
- 内核链表中container_of实现
- 面试题五答案