下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、C语言位域操作方法#include <avr/io.h>#ifndef _Use_AdvancedPortCommand# define _Use_AdvancedPortCommand# define PAInUse 0xff# define PBInUse 0xff# define PCInUse 0xff# define PDI
2、nUse 0xff# define PEInUse 0x00# define PFInUse 0x00# define PGInUse 0x00# define PHInUse 0
3、x00# define PIInUse 0x00# define PJInUse 0x00# define PKInUse 0x00# define PLInUse 0x00# define PMInUse
4、; 0x00# define PNInUse 0x00# define POInUse 0x00# define PPInUse 0x00# define PQInUse 0x00# define PRInUse
5、160; 0x00# define PSInUse 0x00# define PTInUse 0x00# define PUInUse 0x00# define PVInUse 0x00# define PWInUs
6、e 0x00# define PXInUse 0x00# define PYInUse 0x00# define PZInUse 0x00# define Read_PA0 (PINA<
7、<7)>>7)# define Read_PA1 (PINA<<6)>>7)# define Read_PA2 (PINA<<5)>>7)# define Read_PA3 (PINA<<4)>>7)# define Read_PA4
8、 (PINA<<3)>>7)# define Read_PA5 (PINA<<2)>>7)# define Read_PA6 (PINA<<1)>>7)# define Read_PA7 (PINA>>7)# define Read_PB0
9、 (PINB<<7)>>7)# define Read_PB1 (PINB<<6)>>7)# define Read_PB2 (PINB<<5)>>7)# define Read_PB3 (PINB<<4)>>7)# define Read_PB4
10、160; (PINB<<3)>>7)# define Read_PB5 (PINB<<2)>>7)# define Read_PB6 (PINB<<1)>>7)# define Read_PB7 (PINB>>7)# define Read_PC0
11、160; (PINC<<7)>>7)# define Read_PC1 (PINC<<6)>>7)# define Read_PC2 (PINC<<5)>>7)# define Read_PC3 (PINC<<4)>>7)# d
12、efine Read_PC4 (PINC<<3)>>7)# define Read_PC5 (PINC<<2)>>7)# define Read_PC6 (PINC<<1)>>7)# define Read_PC7 (PINC>>
13、;7)# define Read_PD0 (PIND<<7)>>7)# define Read_PD1 (PIND<<6)>>7)# define Read_PD2 (PIND<<5)>>7)# define Read_PD3 (PIND&
14、lt;<4)>>7)# define Read_PD4 (PIND<<3)>>7)# define Read_PD5 (PIND<<2)>>7)# define Read_PD6 (PIND<<1)>>7)# define Read_PD7
15、60; (PIND>>7)typedef struct BYTE_BIT unsigned Bit0:1; unsigned Bit1:1; unsigned Bit2:1; unsigned Bit3:1; unsigned Bit4:1; unsigned Bit5:1; unsigned Bit6:1; unsigned Bit7:1;PORTBIT;# define PORTA_B
16、IT (*(volatile PORTBIT *)PORTA)# define PORTB_BIT (*(volatile PORTBIT *)PORTB)# define PORTC_BIT (*(volatile PORTBIT *)PORTC)# define PORTD_BIT (*(volatile PORTBIT *)PORTD)# define DDRA_BIT (*(volatile PORTBIT *)DDRA)# define DDRB_BIT (*(volatile PORTB
17、IT *)DDRB)# define DDRC_BIT (*(volatile PORTBIT *)DDRC)# define DDRD_BIT (*(volatile PORTBIT *)DDRD)# define PORTDefine();#endif 2 第二种位操作方法 typedef union unsigned char value; struct unsigned int bit0:1; unsigned int bit1:1;
18、; unsigned int bit2:1; unsigned int bit3:1; unsigned int bit4:1; unsigned int bit5:1; unsigned int bit6:1; unsigned int bit7:1; bit_field; PORT;用法:声明:PORT pa;位操作: pa.bit_field.bit0=pa.bit_field.bit0;/位取反 PORTA=pa.value;
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年浙江大学医学院附属邵逸夫医院内分泌代谢科骨密度室技术员招聘备考题库及一套答案详解
- 四川省绵阳市三台中学2026届英语高三第一学期期末质量跟踪监视试题含解析
- 安徽省滁州市2025-2026学年高三物理上学期期末模拟卷03【含答案】
- 2026年建筑施工工程质量管理协议
- 2025至2030冷链物流基础设施网络布局与生鲜电商协同发展研究报告
- 2025-2030中国建筑陶粒行业行情监测与投融资发展状况研究报告
- 初中信息技术与人工智能教育初步渗透的课题报告教学研究课题报告
- 多终端融合的智能教育平台在智能教育评估与反馈中的应用研究教学研究课题报告
- 《数控机床》-《数控机床》-习题5 答案
- 基于国家智慧教育云平台的家校共育教师专业发展支持研究教学研究课题报告
- 生蚝课件教学课件
- 组塔架线安全培训
- 化疗神经毒性反应护理
- 2025年度运营数据支及决策对工作总结
- 2025年湖南省公务员录用考试《申论》真题(县乡卷)及答案解析
- 粉尘清扫安全管理制度完整版
- 云南省2025年高二上学期普通高中学业水平合格性考试《信息技术》试卷(解析版)
- 2025年山东青岛西海岸新区“千名人才进新区”集中引才模拟试卷及一套完整答案详解
- 四川省成都市树德实验中学2026届九年级数学第一学期期末监测试题含解析
- 与业主沟通技巧培训
- 普惠托育服务机构申请表、承诺书、认定书
评论
0/150
提交评论