Programming calculation using the square wave pulse signal output by the internal timer T0 of the single chip microcomputer

Publisher:一条属马的龙Latest update time:2017-10-13 Source: eefocusKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The internal timer T0 of the microcontroller works in mode 1, and a square wave pulse signal with a period of 1ms is output from P1.0. It is known that the crystal oscillator frequency of the microcontroller is 6MHZ.

Please (1) calculate the time constant X, using the formula X = 216 - t (f/12)


(2) Write a program list



Solution: Solution: X=216-t(F/12)


=216-0.5*10-3*6*106/12 

=FF06H


ORG 3000H 

START:MOV TMOD,#01H 

MOV TL0,#06H

MOV THO,#FFH 

SETB TR0

LOOP: JBC TFO,DONE


SJMP LOOP

DONE: MOV TL0,#06H


MOV THO,#FFH

CPL P1.0

SJMP LOOP 


Keywords:MCU Reference address:Programming calculation using the square wave pulse signal output by the internal timer T0 of the single chip microcomputer

Previous article:Count the number of input pulses of MCU pins, edge-triggered programming
Next article:What you should know about the timer/counter of MCS-51 microcontroller

Recommended ReadingLatest update time:2024-11-16 21:52

The magic of define in single chip C language
The magic of define in the C language of single-chip microcomputers. Recently, a problem was found during the debugging of a product, and we checked a friend's C program together. The problem is not big, but it exposed a little problem. For example: PORTB=0x23; //He means to set the 5th and 2nd positions to 1.
[Microcontroller]
How to make a microcontroller timer
1. Experimental tasks Use the timer/counter T0 of the AT89S51 microcontroller to generate a one-second timing time as the second counting time. When one second is generated, the second counting increases by 1. When the second counting reaches 60, it automatically starts from 0. Now I will start to introduce how to mak
[Microcontroller]
How to make a microcontroller timer
Design and implementation of GPS vehicle terminal based on single chip microcomputer
The command and dispatch of police vehicles, the monitoring and safety dispatch of cash transport vehicles, the operation and management of taxis and reasonable dispatch have become increasingly important issues in the public security, banking and public transportation systems. The emergence of GPS global positionin
[Microcontroller]
Design and implementation of GPS vehicle terminal based on single chip microcomputer
51 MCU Registers-3.1 MCU Timer
Earlier, we explained how to delay the time by software, thereby increasing the interval between the light on and off. The process is to let the CPU do other things, so as to achieve the delay effect. However, software delay is not very accurate. Here we will learn a more accurate hardware delay, also called a timer. H
[Microcontroller]
51 MCU Registers-3.1 MCU Timer
Summary of 51 MCU Timer
1. Timer TMOD register C/T is used to control the working mode of the timer. Originally, there is a horizontal line on T to indicate that the low level is valid. C is the count, which is the number of external pulses, and also the timer overflow and interrupt. GATE is used to set whether the external interrupt pulse
[Microcontroller]
MCU ISP download circuit diagram (74hc244)
MCU ISP download circuit diagram (74hc244)
[Analog Electronics]
MCU ISP download circuit diagram (74hc244)
Detailed Analysis of C51 MCU Timer/Counter Interrupt Function (Part 2)
1. External interrupt related registers 1. Timer/Counter Control Register Control Register (TCON)    IT0: External Interrupt 0 Trigger Mode Control Bit  When IT0=0, it is level trigger mode (low level is valid)  When IT0=1, it is edge trigger mode (falling edge is valid)  IT1: External Interrupt 1 Trigger Mode Contro
[Microcontroller]
Detailed Analysis of C51 MCU Timer/Counter Interrupt Function (Part 2)
What are the application advantages of PIC series microcontrollers?
I. Introduction According to statistics, the annual capacity of single-chip microcomputers in my country has reached 100-300 million pieces, and it is growing at a rate of about 16% per year, but my country's share of the world market is less than 1%. This shows that the application of single-chip microcomputers in my
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号