- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
双向通信(Two-way communication)
双向通信(Two-way communication)
# include reg52.h
# include intrins.h
typedef unsigned char uchar;
typedef unsigned char uint;
/ / * * * * * * * * * * * * * * * * * * * * * * * * * * nrf24l01端口定义 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
sbit miso = p1 ^ 3; / / 数据线
sbit mosi = p1 ^ 4; / / 数据线
sbit sck = p1 ^ 2; / / 时钟线
sbit ce = p1 ^ 1; / / 模式控制线
sbit csn = p3 ^ 2; / / 片选线 (低电平有效)
sbit irq = p3 ^ 3; / / 中短信号线
/ / * * * * * * * * * * * * * * * * * * * * * 按键 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
sbit key1 = p3 ^ 6;
sbit key2 = p3 ^ 7;
/ / * * * * * * * * * * * * * * * * * * * * * * * * 数码管位选 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
sbit led3 = p2 ^ 0;
sbit led2 = p2 ^ 1;
sbit led1 = p2 ^ 2;
sbit led0 = p2 * 3;
/ / * * * * * * * * * * * * * * * * * 蜂明器 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
sbit bell = p3 ^ 4;
/ / * * * * * * * * * * * * * * * * * * * * * * * * 数码管0 - 9编码 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
uchar seg [10] = {0xc0,0xcf, 0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90}; / / 0 ~ ~ 9段码
/ / * * * * * * * * * * * * * * * * * * * * * * * nrf24l01 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
# define tx _ adr _ width 5 / / 发送地址宽度
# define rx _ adr _ width 5 / / 接收地址宽度
# define tx _ pload _ width 20 / 20 uints tx payload
# define rx _ pload _ width 20 / 20 uints tx payload
uint which tx _ address [tx _ adr _ width] = {0x34,0x43,0x10,0x10,0x01}; / / 本地地址
uint which rx _ address [rx _ adr _ width] = {0x34,0x43,0x10,0x10,0x01}; / / 接收地址
/ / * * * * * * * * * * * * * * * * * * * * * * * * * * nrf24l01寄存器指令 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
# define read _ reg 0x00 / / 读寄存器指令
# define write _ reg 0x20 / / 写寄存器指令
# define rd _ rx _ pload 0x61 / / 读取 * 接收数据指令
#
您可能关注的文档
- 化学试剂缩写(Abbreviation of chemical reagent).doc
- 化工仪表知识(Knowledge of chemical instrumentation).doc
- 化学试剂英文缩写(Chemical reagent).doc
- 化工专业部分英语词汇(Some English vocabulary for chemical engineering).doc
- 化工企业(Chemical enterprise).doc
- 化工制图基本规范(Basic specifications for chemical drawing).doc
- 化工原理1-25-总复习(General review of principles of chemical engineering 1-25-).doc
- 化工原理(Chemical principle).doc
- 化工安全8-1~2(Chemical safety 8-1~2).doc
- 化工安全培训(Chemical safety training).doc
- 双性同体的重新认识批评·理论·方法(Re understanding, criticism, theory and method of Androgyny).doc
- 双显示器的设置(Dual display settings).doc
- 双电脑usb电缆互联(Dual computer USB cable interconnection).doc
- 双绞线传输器知识问答(UTP knowledge answering).doc
- 双胞蘑菇养殖(The twin mushroom breeding).doc
- 厦门提升人居环境质量 打造真正幸福城市(Xiamen to enhance the quality of human settlements to create a truly happy city).doc
- 双节棍入门(基础篇)(An introduction to a double stick (basic article)).doc
- 双重遗产的双重属性-谢凝高(The dual nature of double inheritance - Xie Ninggao).doc
- 反不正当竞争的国际通则——wipo《反不正当竞争示范条款》述要(Anti unfair competition in international general - WIPO Anti Unfair Competition model provisions of).doc
- 反假考试(Counter test).doc
文档评论(0)