当前位置:网站首页>Timer and counter of 51 single chip microcomputer
Timer and counter of 51 single chip microcomputer
2022-07-03 09:55:00 【Yiao】
One · The principle of timer and counter
They are automatically added with the input pulse of the counter 1, Every pulse , Counter auto Jia 1, When the counters are all 1 when , Then input a pulse counter back 0, And the overflow of the counter makes the corresponding interrupt flag position 1, towards CPU Make an interrupt request . In the timing mode, it means that the time has come , In counting mode, the count is full .
Two · Timer structure
timing / The counter is essentially a plus 1 Counter . It adds itself with the input pulse of the counter 1, That is, every pulse , The counter automatically adds 1,, When added to the counter, it is all 1 when , One more pulse will set the counter back to zero , And the overflow of the counter makes the corresponding interrupt flag position 1, towards CPU Make an interrupt request ( timing / When the Counter interrupt is allowed ). If timing / The counter operates in timing mode , It means that the timing time has expired ; If working in counting mode , Indicates that the count value is full .
so , The initial value of the count is subtracted from the value of the counter at the time of overflow 1 The count value of the counter .
3、 ... and · Timer counter structure
TMOD Decide whether the working mode is counting or timing ,TCON Then control the start and interrupt application of the counter timer working principle ( With TH0,TL0) For example : Pulse at TL0( low 8 position ) Add up in , After filling up ,TH0 Add 1,TL0 return 0; wait until TH1 Also accumulated after full , overflow TF0 Set up 1. 1·TMOD

(1)GATE Gate control position There are two ways to start the timer ; The first one is :GATE=0,TR0/1=1; The second kind ;GATE=1,TR0/1=1;INT0/1=1; (2)C/T;C/T=0 For timing mode ,C/T=1 In counting mode ; (3)M1M0

2.TCON The upper four bits control the start and interrupt application of the timing counter , Low four bit control external interrupt

(1)TF1:T1 Overflow request flag bit .T1 When count overflows , The hardware is set automatically TF1 by 1,CPU After responding to the interrupt, the hardware automatically clears it 0.T1 Working hours ,CPU Check at any time TF1 Working state of , Once detected TF1 Set up 1,CPU Respond immediately . (2)TR1:T Operation control bit .TR1 Set up 1 Start working , Set up 0 Stop when .TR1 Set by software 1 or 0. TF0 and TR0 Be similar to TR1 and TF1.
Four · How the timer works

1. Operation mode 0 TL0 The lower five bits of overflow forward TH0 High octave carry of ,TH0 Overflow time , Set up TF0,TF0 towards CPU Apply for interruption 2. Operation mode 1 16 Bit working mode ,TH0 It's the top eight ,TL0 It's eight lower 3. Operation mode 2
For automatic reload timer
边栏推荐
- Error output redirection
- 2020-08-23
- Qt QComboBox QSS样式设置
- UCI and data multiplexing are transmitted on Pusch (Part 4) --small block lengths
- JS foundation - prototype prototype chain and macro task / micro task / event mechanism
- 要选择那种语言为单片机编写程序呢
- Runtime. getRuntime(). GC () and runtime getRuntime(). The difference between runfinalization()
- Exception handling of arm
- Learn the contents of 5g toolbox supporting NR through the NR resources provided by MATLAB
- Introduction to chromium embedded framework (CEF)
猜你喜欢

Gpiof6, 7, 8 configuration

Fundamentals of Electronic Technology (III)__ Fundamentals of circuit analysis__ Basic amplifier operating principle

SSB Introduction (PbCH and DMRs need to be supplemented)

el-table X轴方向(横向)滚动条默认滑到右边

编程思想比任何都重要,不是比谁多会用几个函数而是比程序的理解
![[CSDN]C1训练题解析_第二部分_Web基础](/img/91/72cdea3eb3f61315595330d2c9016d.png)
[CSDN]C1训练题解析_第二部分_Web基础

There is no specific definition of embedded system

內存數據庫究竟是如何發揮內存優勢的?

当你需要使用STM32某些功能,而51实现不了时, 那32自然不需要学

Error output redirection
随机推荐
干单片机这一行的时候根本没想过这么多,只想着先挣钱养活自己
Oracle数据库 SQL语句执行计划、语句跟踪与优化实例
Design and development of biological instruments
Convert IP address to int
An executable binary file contains more than machine instructions
01仿B站项目业务架构
Project scope management__ Scope management plan and scope specification
在三线城市、在县城,很难毕业就拿到10K
Project cost management__ Cost management technology__ Article 8 performance review
[combinatorics] Introduction to Combinatorics (combinatorial thought 2: mathematical induction | mathematical induction promotion | multiple induction thought)
Windows下MySQL的安装和删除
Development of fire power monitoring system
[CSDN] C1 training problem analysis_ Part II_ Web Foundation
[graduation successful] [1] - tour [Student Management Information System]
顺利毕业[3]-博客系统 更新中。。。
Chromium Embedded Framework (CEF) 介绍
内存数据库究竟是如何发挥内存优势的?
自动装箱与拆箱了解吗?原理是什么?
Happy Dragon Boat Festival—— Zongzi written by canvas~~~~~
Programming ideas are more important than anything, not more than who can use several functions, but more than the understanding of the program