Frequency acquisition method and device of single chip microcomputer

A collection method and single-chip microcomputer technology, applied in the Internet field, can solve problems such as inaccurate calculations

Inactive Publication Date: 2019-01-18
WUHAN ZHONGQI BIOLOGICAL MEDICAL ELECTRONICS
View PDF3 Cites 2 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0002] In the prior art, the frequency acquisition period is usually 1 second, but

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Frequency acquisition method and device of single chip microcomputer
  • Frequency acquisition method and device of single chip microcomputer
  • Frequency acquisition method and device of single chip microcomputer

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0043] join figure 1 A flow chart of a single-chip microcomputer frequency acquisition method shown, the method specifically includes the following steps:

[0044] In the initial stage, first clear the timer flag and counting status.

[0045] S101. Record the capture count difference and the number of capture events between two capture events;

[0046] The number of capture events refers to how many times the microcontroller captures events between two recorded capture events.

[0047] S102. Calculate the time difference between two adjacent capture events according to the capture count difference;

[0048] S103. Calculate the target frequency according to the time difference and the number of capture events.

[0049] An embodiment of the present invention provides a single-chip frequency acquisition method, including: recording the capture count difference between two capture events and the number of capture events; according to the capture count difference, calculating th...

Embodiment 2

[0051] join figure 2 The flow chart of a kind of single-chip microcomputer frequency collection shown, this method is realized on the basis of the single-chip microcomputer frequency collection provided in embodiment one, specifically comprises the following steps:

[0052] S201. Record the capture count X1 when the first capture event occurs, the capture count X2 when the second capture event occurs, the capture count update times n between two capture events, the overflow count p of the timer, and the number of capture events m;

[0053] Wherein, the capture count is that the single chip microcomputer adds one to the original count every time q within the preset time length k, and the initial count is 0. When the preset duration k ends, the capture count is reset to 0, so that the capture count is updated once, and the capture count update times is 1. Every time the capture count is reset to 0, the number of capture count updates is incremented by 1 to the original value....

Embodiment 3

[0060] join image 3 A flow chart of the frequency acquisition of a single-chip microcomputer shown, the method is applied to specifically include the following steps:

[0061] S301. Record the capture count X1 when the first capture event occurs, the capture count X2 when the second capture event occurs, the capture count update times n between two capture events, the overflow count p of the timer, and the number of capture events m;

[0062] S302. Capture count difference Y=n*p+X2-X1 between two capture events.

[0063] S303. Obtain the timer frequency HZ;

[0064] S304. The time difference T=Y*(1 / HZ).

[0065] S305. Target frequency=m / T=m*HZ / Y=m*HZ / (n*p+X2-X1).

[0066] S306. Adjust the timer frequency HZ according to the capture count update times n between two capture events.

[0067] Among them, when n>2, it means that the frequency is high, and the timer frequency HZ should be reduced;

[0068] When n=0, it means that the frequency is low, and the timer frequency HZ...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention provides a frequency acquisition method and a device of a single chip microcomputer, comprising the following steps: recording the capture counting difference between two capture eventsand the number of capture events; Calculating a time difference between two adjacent capture events according to the capture count difference; calculating A target frequency according to that time difference and the number of capture events. Thus the design calculation cycle is short and the calculation frequency is completed within the set time. The calculation precision is high, and the timer parameters can be adjusted automatically according to different frequencies, so that more accurate measurement can be realized.

Description

technical field [0001] The invention relates to the technical field of the Internet, in particular to a method and device for collecting frequency of a single-chip microcomputer. Background technique [0002] In the prior art, the frequency acquisition period is usually 1 second, but if the frequency changes within 1 second, then calculation will be inaccurate. In many applications, accurate acquisition results are required, and acquisition frequency within milliseconds is also required. Contents of the invention [0003] Aiming at the problems existing in the above-mentioned prior art, the present invention provides a single-chip microcomputer frequency acquisition method. [0004] In a first aspect, an embodiment of the present invention provides a method for acquiring a frequency of a single-chip microcomputer, the method comprising: [0005] Record the capture count difference and the number of capture events between two capture events; [0006] calculating a time d...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
IPC IPC(8): G06F3/05
CPCG06F3/05
Inventor 张义宝李毅朱涛
Owner WUHAN ZHONGQI BIOLOGICAL MEDICAL ELECTRONICS
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products