- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
第5章PIC16F877的外围功能模块(Chapter 5 the peripheral function module of PIC16F877)
第5章PIC16F877的外围功能模块(Chapter 5 the peripheral function module of PIC16F877)
Chapter 5: peripheral function module of PIC16F877
5.1.2 simple application instances
The example is used to light the first four lights of the eight light-emitting diodes connected with the PORTD port, and the last four to go out. Before commissioning, the eight dialing switches connected with PORTD should be removed to the corresponding position.
5.1 PORTD output
# include PIC. H
The main ()
{
TRISD = 0 x00; The / * TRISD register is assigned, and each of the PORTD is output * /
While (1); / * loop to light emitting diode (s) statement * /
{
PORTD = 0 xf0; / * send data to PORTD and light the LED (by experiment template * /
/ * the design determines that the LED will be lit when the position is low. * /
}
}
5.2.1 MSSP module SPI method function profile
The following is a simple SPI initialization routine used to use SPI to output data.
Example 5.2 SPI initializer
/ * spi initializer * /
Void SPIINIT ()
{
PIR1 = 0; / * clear off SPI interrupt flag * /
SSPCON = 0 x30; / * SSPEN = 1; CKP = 0, FOSC / 4 * /
SSPSTAT = 0 xc0;
TRISC = 0 x00; / * SDO pins for output, SCK pins for output * /
}
5.2.3 list of procedures
A program that has been debugged on the experimental board can be used as a reference for other programs.
# include pic1687x. H
/ * this program is used to display 8 characters (1 ~ 8) and 8 characters (1 ~ 8) in 8 leds
The static volatile int table [20] = {0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x92, 0x82, 0x80, 0x80, 0x90, 0x88, 0x88, 0x83, 0x8e, 0x8e, 0x8e, 0x7f, 0x7f, 0xbf, 0x89, 0xff}.
Volatile unsigned char data;
Define PORTAIT (adr, bit) (unsigned) ( adr) * 8 + (bit) / * absolute addressable bit operation instruction * /
Static bit PORTA_5 @portait (PORTA, 5);
/ * spi initializer * /
Void SPIINIT ()
{
PIR1 = 0;
SSPCON = 0 x30; / * SSPEN = 1; CKP = 0, FOSC / 4 * /
SSPSTAT = 0 xc0;
TRISC = 0 x00; / * SDO pins for output, SCK pins for output * /
}
/ * system each input and export i
您可能关注的文档
- 理正边坡水利(Slope water conservancy).doc
- 琼脂糖凝胶电泳注意事项(The attention of agarose gel electrophoresis).doc
- 璧山县学校校舍安全检查记录表(Bishan county school building safety inspection records).doc
- 瓦房店公交线路(The house bus line).doc
- 理论考核复习题(Theoretical review).doc
- 瓦房店公交车(A house bus).doc
- 瓦检员操作规程(Operation procedure of the inspector).doc
- 瓦检员考试复习题05(The wattage exam question 05).doc
- 瓦检员考试复习题07(The wattage exam question 07).doc
- 瓦赫宁根大学生活全功略(Wageningen university is full of life).doc
- 第4章 平面连杆机构(Chapter 4 planar connecting rod mechanism).doc
- 第七章CD和黏附分子(Chapter 7 CD and adhesion molecules).doc
- 第七章建筑消防设施基础知识(Chapter 7 basic knowledge of building fire control facilities).doc
- 第七部分 应急救援(Part seven emergency rescue).doc
- 第三章 配气机构(Chapter iii gas distribution mechanism).doc
- 第九章 文似看山不喜平—构思篇(Chapter nine seems to be an unpleasing idea of a mountain).doc
- 第二十一章 二次根式(Chapter 21 the second root system).doc
- 第二代308准分子紫外光治疗系统(The second generation 308 quasi-molecular uv light treatment system).doc
- 第三章 接管验收综述(Chapter iii review of acceptance and acceptance).doc
- 第二单元教材分析(Unit 2 textbook analysis).doc
文档评论(0)