- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
单片机延时程序(MCU delay program)
单片机延时程序(MCU delay program)
F9a
Singlechip delay program (suitable for beginners)
The following is the singlechip delay procedures (including ASM and C are used in the program, I learn microcontroller in the process), in the singlechip delay procedures should be considered in the use of the crystal frequency in the 51 series microcontroller we used is a crystal oscillator 11.0592MHz and 12.0000MHz, and used in the AVR microcontroller the 8.000MHz and 4.000MH crystal so on the Internet to find the program if they involve the precise time delay should pay attention to the crystal frequency is much.
Software delay: (ASM)
Crystal 12MHZ, delay 1 second
Procedures are as follows:
DELAY:MOV, 72H, #100
LOOP3:MOV, 71H, #100
LOOP1:MOV, 70H, #47
LOOP0JNZ, 70H, LOOP0
NOP
DJNZ, 71H, LOOP1
MOV, 70H, #46
LOOP2JNZ, 70H, LOOP2
NOP
DJNZ, 72H, LOOP3
MOV, 70H, #48
LOOP4JNZ, 70H, LOOP4
Timer delay:
Crystal 12MHZ, delay 1s, timer 0, the way to work 1
DELAY1:MOV, R7, #0AH; crystal 12MHZ, delay 0.5 seconds
AJMP DELAY
DELAY2:MOV, R7, #14H; crystal 12MHZ, delay 1 second
DELAY:CLR EX0
MOV, TMOD, #01H; set the timer to work in 1
MOV, TL0, #0B0H; set the count initial value to the timer
MOV, TH0, #3CH
SETB TR0; turn on the timer
HERE:JBC, TF0, NEXT1
SJMP HERE
NEXT1:MOV, TL0, #0B0H
MOV, TH0, #3CH
DJNZ, R7, HERE
CLR TR0; the timer wants the software to clear
SETB EX0
RET
C language delay program:
Void delay_18B20 (unsigned, int, I)
{
While (i--);
}
Void Delay10us () //12mhz
{
_NOP_ ();
_NOP_ ();
_NOP_ ();
_NOP_ ();
_NOP_ ();
_NOP_ ();
}
/*****************11us delay function *************************/
/ /
Void delay (uint T)
{
For ((t0; t--);
}
1ms delay subroutine (12MHZ)
Void delay1ms (uint P) //12mhz
{uchar, I, j;
For (i=0; ip; i++)
{
For (j=0; j124; j++)
{};
}
}
10ms delay subroutine (12MHZ)
Void delay10ms (void)
{
Unsigned, char, I, J, k;
For (i=5; i0; i--)
For (j=4; j0; j--)
For (k=248; k0; k--);
}
1s delay subroutine (12MHZ)
Void delay1s (void)
{
Unsigned, char, h, I, J, k;
For (h=5; h0; h--
您可能关注的文档
- 初二语文期中考试试卷8071(Chinese mid-term exam paper 8071).doc
- 初二语文第三册第三单元测试题38629(Second language third volume third unit test questions 38629).doc
- 初二语文第二学期期末考试试卷(Chinese language examination paper for the second semester of junior middle school).doc
- 初始学车的技巧(The initial learning skills).doc
- 初始delphi(初始Delphi).doc
- 初学者爬格的系统训练方法(Systematic training method for beginners climbing lattice).doc
- 初探部分上市公司财务造假的伎俩(Preliminary exploration of financial fraud in some listed companies).doc
- 初级会计学(人大第五版)第一章课后思考及案例题答案(Junior accounting (NPC Fifth Edition), Chapter I, after-school thinking and case questions answer).doc
- 初级实务模拟(Primary practice simulation).doc
- 初高中语文教材目录(人教版)(List of Chinese textbooks for junior and senior high school (PEP)).doc
- 单片机考试复习(Review of single chip examination).doc
- 单片机接口技术及原理 1绪论(Singlechip interface technology and principle 1 Introduction).doc
- 单片机课程设计(SCM curriculum design).doc
- 单片机考试题默认(Single chip exam questions default).doc
- 单车常识(Bike common sense).doc
- 单词 短语(Word phrase).doc
- 单选变压互感器(Radio transformer).doc
- 单选高压电气设备(Radio high voltage electrical equipment).doc
- 南京中医药大学附属医院(Affiliated Hospital of Nanjing University of Chinese Medicine).doc
- 南亚(South Asia).doc
文档评论(0)