下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 科室规范化服务奖惩制度
- 经费管理及绩效考核制度
- 美国ipo审批制度
- 股份制公司奖惩制度
- 草拟两项档案工作制度
- 衡阳诫勉谈话工作制度
- 认真贯彻落实审计制度
- 谷歌员工工作制度
- 财务轮岗工作制度及流程
- 车间部门奖惩制度
- 2025年人教版初中七年级地理下册(全册)知识点梳理
- 泰国中小学汉语教学课件
- T/SHPTA 075-2024125 ℃汽车线用聚氯乙烯塑料
- 第6课《我参与我奉献》教学设计(教学设计)-部编版道德与法治五年级下册
- 《项目前期调研与分析》课件
- TSG D2002-2006燃气用聚乙烯管道焊接技术规则
- 学位英语语法
- 出院病人随访内容
- 陕西邮政招聘考试真题2024
- 西部计划面试题目及答案
- GB/T 320-2025工业用合成盐酸
评论
0/150
提交评论