CN109831205A - A kind of pulse counting method based on SoC - Google Patents

A kind of pulse counting method based on SoC Download PDF

Info

Publication number
CN109831205A
CN109831205A CN201910039956.5A CN201910039956A CN109831205A CN 109831205 A CN109831205 A CN 109831205A CN 201910039956 A CN201910039956 A CN 201910039956A CN 109831205 A CN109831205 A CN 109831205A
Authority
CN
China
Prior art keywords
counter
direct memory
timer
access device
memory access
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910039956.5A
Other languages
Chinese (zh)
Inventor
林忠侣
林聪聪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xiamen Xin De Information Technology Co Ltd
Original Assignee
Xiamen Xin De Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xiamen Xin De Information Technology Co Ltd filed Critical Xiamen Xin De Information Technology Co Ltd
Priority to CN201910039956.5A priority Critical patent/CN109831205A/en
Publication of CN109831205A publication Critical patent/CN109831205A/en
Pending legal-status Critical Current

Links

Landscapes

  • Measuring Frequencies, Analyzing Spectra (AREA)

Abstract

The present invention relates to a kind of pulse counting methods based on SoC, an analog comparator, a timer, a direct memory access device to SoC is used only in it, resource consumption is considerably less, and only terminating to be measured preprocessor in signal just needs intervention to handle, and the time for occupying processor is very short.In entire pulse counting process, SOC does not increase external circuit, also the not maximum time width T of setting pulse signal, the more not intervention of software, is achieved that the purpose of accurate measurement number of pulses.

Description

A kind of pulse counting method based on SoC
Technical field
The present invention relates to step-by-step counting fields, and in particular to a kind of pulse counting method based on SoC.
Background technique
SoC is system on chip, refers to and is integrated with MCU, RAM, FLASH on a single die and a series of relative to MCU's Peripheral hardware, including Timer, DMA, COMP, ADC, DAC etc..
The pulse counting method of base SoC must know in advance that the maximum time width T of signal at present, prolong after signal appearance Time T reads counter afterwards.There are the following problems for this method:
1, since signal does not have beginning flag, can only judge according to there are several pulses, if system is interfered, it is easy to There is error starting tally function, causes measuring error;
2, the starting for judging signal according to several pulses that signal starts due to needs, needs system to have the response being exceedingly fast Speed, therefore the design difficulty of system and the investment of SoC resource are increased, or even software can only be allowed on certain SoC to intervene The execution of measurement affects the real-time of system;
3, when actual environment is run, the variation of temperature and the measured factors such as measurement range that exceed are likely to cause system Maximum time width T exceeds the delay time of system design, causes measuring error.
In view of this, the present inventor's deep design for problems existing for step-by-step counting field, and then develop The present invention.
Summary of the invention
In view of the above-mentioned problems, the purpose of the present invention is to provide a kind of pulse counting method based on SoC, without setting The maximum time width T of pulse signal is the purpose that can reach accurate measurement number of pulses.
To achieve the above object, the technical solution adopted by the present invention is that:
A kind of pulse counting method based on SoC utilizes analog comparator, timer, direct memory access device and the place of SOC It manages device cooperation and carries out step-by-step counting, specific as follows:
Firstly, carrying out Initialize installation to analog comparator, timer and direct memory access device:
The comparison threshold value of analog comparator is set, and setting timer is input pattern, and setting direct memory access device is cyclic module Formula, and the triggering mode of direct memory access device and its initial value of counter Counter are set;
Then, starting timer starts to carry out step-by-step counting:
When pulse signal is via analog comparator, if pulse signal is higher than the comparison threshold value of analog comparator, digital arteries and veins is formed Signal is rushed to be input in timer;
Digital pulse signal is input to direct memory access device by timer, according to the triggering mode of direct memory access device, number Word pulse signal triggers DMA event, subtracts 1 for the counter Counter of direct memory access device, while by the counter of timer It resets;
When pulse signal stops, the counter of timer, which is counted, generates Update event interrupt until overflowing, at this point, place The value that device reads the counter Counter of direct memory access device is managed, and calculates the number of pulses of pulse signal, number of pulses Initial value-the Counter of=Counter.
The triggering mode of the direct memory access device is failing edge triggering mode or failing edge triggering mode.
The initial value of the counter Counter of the direct memory access device is 65535.
After adopting the above scheme, the present invention be used only to an analog comparator of SoC, a timer, one directly Internal storage access device, resource consumption is considerably less, and only terminates to be measured preprocessor in signal and just intervention is needed to handle, and accounts for It is very short with the time of processor, so, without excessive operation time, thereby reducing arteries and veins in entire pulse counting process Rush the time-consuming counted and the bring error due to time-consuming excessive.Moreover, comparison of the present invention by setting analog comparator Threshold value, come avoid system to pulse signal interference and caused by measuring error.In entire pulse counting process, SOC does not increase Add external circuit, also the maximum time width T of setting pulse signal, the more not intervention of software are not achieved that accurate survey Measure the purpose of number of pulses.
Detailed description of the invention
Fig. 1 is invention's principle block diagram;
Fig. 2 is Initialize installation flow chart of the present invention;
Fig. 3 is Update interrupt processing flow chart of the present invention.
Specific embodiment
As shown in Figure 1 to Figure 3, present invention discloses a kind of pulse counting methods based on SoC, utilize the simulation of SOC Comparator COMP, timer Timer, direct memory access device DMA and processor MCU cooperation carry out step-by-step counting, specific as follows:
Firstly, carrying out Initialize installation to analog comparator COMP, timer Timer and direct memory access device DMA: setting The comparison threshold value of analog comparator COMP, setting timer Timer are input pattern, and setting direct memory access device DMA is to follow Ring mode, and the triggering mode of direct memory access device DMA and its initial value of counter Counter are set.Specifically, directly The triggering mode of internal storage access device DMA is failing edge triggering mode or failing edge triggering mode, and counter Counter's is initial Value is 65535.
Then, starting timer Timer starts to carry out step-by-step counting:
It, can if pulse signal is higher than the comparison threshold value of analog comparator COMP when pulse signal is via analog comparator COMP Digital pulse signal is formed to be input in timer Timer.
Digital pulse signal is input to direct memory access device DMA by timer Timer, and digital pulse signal is in failing edge When trigger DMA event, the counter Counter of direct memory access device DMA is subtracted 1, while by the counter of timer Timer It resets.If there is pulse signal inputs, then the persistently counter O reset to timer Timer, when pulse signal stops, timing The counter of device Timer, which is counted, generates Update event interrupt until overflowing, and processor MCU reads direct memory access device The counter of DMA, and the number of pulses of pulse signal is calculated, number of pulses=65535-Counter.
The present invention is used only to an analog comparator COMP of SoC, a timer Timer, a direct memory and visits Ask device DMA, resource consumption is considerably less, and only terminates to be measured preprocessor MCU in signal and just intervention is needed to handle, and accounts for Time with processor MCU is very short, so, without excessive operation time, thus reducing in entire pulse counting process The time-consuming of step-by-step counting and the bring error due to time-consuming excessive.Moreover, the present invention passes through setting analog comparator The comparison threshold value of COMP, come avoid system to pulse signal interference and caused by measuring error.In entire pulse counting process, SOC does not increase external circuit, and also the maximum time width T of setting pulse signal, the more not intervention of software are not just realized The purpose of accurate measurement number of pulses.
The above is only the embodiment of the present invention, is not intended to limit the scope of the present invention, therefore all Any subtle modifications, equivalent variations and modifications to the above embodiments according to the technical essence of the invention still fall within this In the range of inventive technique scheme.

Claims (3)

1. a kind of pulse counting method based on SoC, it is characterised in that: the method utilizes the analog comparator of SOC, timing Device, direct memory access device and processor cooperation carry out step-by-step counting, specific as follows:
Firstly, carrying out Initialize installation to analog comparator, timer and direct memory access device:
The comparison threshold value of analog comparator is set, and setting timer is input pattern, and setting direct memory access device is cyclic module Formula, and the triggering mode of direct memory access device and its initial value of counter Counter are set;
Then, starting timer starts to carry out step-by-step counting:
When pulse signal is via analog comparator, if pulse signal is higher than the comparison threshold value of analog comparator, digital arteries and veins is formed Signal is rushed to be input in timer;
Digital pulse signal is input to direct memory access device by timer, according to the triggering mode of direct memory access device, number Word pulse signal triggers DMA event, subtracts 1 for the counter Counter of direct memory access device, while by the counter of timer It resets;
When pulse signal stops, the counter of timer, which is counted, generates Update event interrupt until overflowing, at this point, place The value that device reads the counter Counter of direct memory access device is managed, and calculates the number of pulses of pulse signal, number of pulses Initial value-the Counter of=Counter.
2. a kind of pulse counting method based on SoC according to claim 1, it is characterised in that: the direct memory is visited The triggering mode for asking device is failing edge triggering mode or failing edge triggering mode.
3. a kind of pulse counting method based on SoC according to claim 1, it is characterised in that: the direct memory is visited The initial value for asking the counter Counter of device is 65535.
CN201910039956.5A 2019-01-16 2019-01-16 A kind of pulse counting method based on SoC Pending CN109831205A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910039956.5A CN109831205A (en) 2019-01-16 2019-01-16 A kind of pulse counting method based on SoC

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910039956.5A CN109831205A (en) 2019-01-16 2019-01-16 A kind of pulse counting method based on SoC

Publications (1)

Publication Number Publication Date
CN109831205A true CN109831205A (en) 2019-05-31

Family

ID=66860361

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910039956.5A Pending CN109831205A (en) 2019-01-16 2019-01-16 A kind of pulse counting method based on SoC

Country Status (1)

Country Link
CN (1) CN109831205A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4580281A (en) * 1984-10-15 1986-04-01 Tektronix, Inc. Self-arming, prescaling frequency counter system
CN102128981A (en) * 2010-12-29 2011-07-20 上海大学 Method for measuring pulse signal period
CN105629284A (en) * 2015-12-28 2016-06-01 广州兰泰胜辐射防护科技有限公司 Ionizing radiation dose acquisition method and device
CN106053931A (en) * 2016-08-09 2016-10-26 河南森尼瑞电气有限公司 Relay protection device based on 12-bit AD in SOC chip
CN107133192A (en) * 2017-05-11 2017-09-05 北方电子研究院安徽有限公司 High speed loader and pulse counter circuit in a kind of SoC systems

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4580281A (en) * 1984-10-15 1986-04-01 Tektronix, Inc. Self-arming, prescaling frequency counter system
CN102128981A (en) * 2010-12-29 2011-07-20 上海大学 Method for measuring pulse signal period
CN105629284A (en) * 2015-12-28 2016-06-01 广州兰泰胜辐射防护科技有限公司 Ionizing radiation dose acquisition method and device
CN106053931A (en) * 2016-08-09 2016-10-26 河南森尼瑞电气有限公司 Relay protection device based on 12-bit AD in SOC chip
CN107133192A (en) * 2017-05-11 2017-09-05 北方电子研究院安徽有限公司 High speed loader and pulse counter circuit in a kind of SoC systems

Similar Documents

Publication Publication Date Title
CN100575965C (en) A kind of method of measuring frequency of single-chip
JPS6183U (en) Radar signal tracking device
CN101221200A (en) Frequency measurement method and apparatus
CN109944020B (en) Method for detecting water consumption of washing machine, washing machine and computer readable storage medium
JP6941738B2 (en) Level transmitter and level measurement method
CN111189368B (en) System and method for improving detonator delay precision and calibration efficiency
CN109831205A (en) A kind of pulse counting method based on SoC
JP6973131B2 (en) Control device and control method
US20170172436A1 (en) Electronic device and computer-readable recording medium
CN112383498B (en) Low-frequency clock compensation method and device, storage medium and terminal
CN113970698A (en) Method and system for calibrating off-chip crystal oscillator
SE7605915L (en) PROCESS CONTROL CIRCUIT FOR METAL DEPOSIT BATH
CN116300377B (en) Time-to-digital converter and laser radar
CN109509506B (en) Method and device for detecting Vcc during power-on test
CN110413461B (en) System and method for measuring transmission delay between accelerator card and host and accelerator card
US4127809A (en) Pulse modulated wave measuring device
CN116047533B (en) Ambient light interference suppression method and device and application thereof
JP2000074962A (en) Cycle-measuring device and method therefor, and storage medium
CN117706465A (en) Electric energy error measurement method, chip and standard electric energy meter
CN113030567B (en) Frequency measurement method and device based on single chip microcomputer
SU393724A1 (en) METHOD OF MEASURING THE DURATION OF SINGLE
US20220334233A1 (en) Distance measurement device and control method of same
RU82881U1 (en) COMPLEX FORM PULSE DURATION METER
SU980019A1 (en) Method of discrete measuring of electric pulse duration
CN117706464A (en) Electric energy error verification method, chip and error plate

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20190531

WD01 Invention patent application deemed withdrawn after publication