- 1、本文档共8页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
c语言在单片机中的应用(Application of C language in single chip microcomputer)
c语言在单片机中的应用(Application of C language in single chip microcomputer)
C language in the development of single-chip application time: 2011-05-21 22:30:57 source: the author: in the development and application of SCM, has gradually begun to introduce high-level language,
C is one of them. For those who are used to the compilation, they always feel that the high-level language controllability is not good, so it is better than the assembly.
But as long as we master a certain C language knowledge, some things still easy to do, the following is the author of several problems encountered in practical work, I hope for beginners C51 who will help.
First, the preparation of C51 hot boot code
For industrial control computers, there is usually a watchdog circuit that acts as a watchdog and resets the computer, which is called hot start.
Thermal startup is generally not allowed to start from scratch, which will cause the existing measured or calculated values to reset, resulting in system work anomalies.
As a result, when the program must judge whether it is hot or cold start, the usual method is to identify a memory unit as a flag bit (such as 0x7F bits and 0x7e bits),
When you start, you read the contents of the memory cell first, and if it is equal to a particular value (for example, two memory cells are 0XAA), it is considered a hot boot,
It is a cold start, the execution of the program initialization part, and 0XAA to the two memory unit.
According to the above design idea, when programming, set a pointer, so that it points to a specific memory unit, such as 0x7F, and then in the program to determine the procedures as follows:
Void, main ()
{char, data, *HotPoint= (char *) 0x7f;
If ((*HotPoint==0xaa) (* (--HotPoint) ==0xaa))
{/ * hot start processing
}
Else
{HotPoint=0x7e; / * cold start point
*HotPoint=0xaa;
* (++HotPoint) =0xaa;
}
Normal working code * / / *
}
However, the actual debugging found that, whether it is hot start or cold start, after the boot, all memory units
您可能关注的文档
- 10个励志故事(10 inspiring stories).doc
- 10大管理讲解(Top 10 management explanations).doc
- 10年动画谈(10 years animation talk).doc
- 10款海绵蛋糕制作方法(10 sponge cake making method).doc
- 10款海绵蛋糕配方(10 sponge cake recipe).doc
- 10通经力士乐4we10g3x(10 - Rexroth 4we10g3x).doc
- 112佛与魔(112 Buddhas and Demons).doc
- 11、 领袖素质(11, leader quality).doc
- 11个坏习惯竟有益身心(11 bad habits are good for the mind and body).doc
- 11年四月新番动漫列表(11 April - animation list).doc
- 话题写作三 假期活动.pptx
- Unit 4 SectionA 3a-3b课件+嵌入音频 2024-2025学年九年级人教版英语Un.pptx
- 外研版八年级下册Module 3 Journey to space Unit 2 课件(共16张P.pptx
- 第2课时 法律保障生活.pptx
- 第二单元 理解权利义务 复习课件.pptx
- 1.2治国安邦的总章程.pptx
- 考点六 宋元时期的大发展.pptx
- Unit 7 Being a Smart Shopper Lesson 6 Oral Communi教育教学资料.pptx
- 01-第六课 传承核心思想理念-第1课时 历久弥新的思想理念.pptx
- 陆丽-《雨中情》教育教学资料.pptx
文档评论(0)