CN106774638B - A kind of timer calibration method - Google Patents

A kind of timer calibration method Download PDF

Info

Publication number
CN106774638B
CN106774638B CN201710055340.8A CN201710055340A CN106774638B CN 106774638 B CN106774638 B CN 106774638B CN 201710055340 A CN201710055340 A CN 201710055340A CN 106774638 B CN106774638 B CN 106774638B
Authority
CN
China
Prior art keywords
timer
central processing
processing unit
target data
sample frequency
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.)
Active
Application number
CN201710055340.8A
Other languages
Chinese (zh)
Other versions
CN106774638A (en
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.)
SHENZHEN BETTERLIFE ELECTRONIC SCIENCE AND TECHNOLOGY Co Ltd
Original Assignee
SHENZHEN BETTERLIFE ELECTRONIC SCIENCE AND 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 SHENZHEN BETTERLIFE ELECTRONIC SCIENCE AND TECHNOLOGY Co Ltd filed Critical SHENZHEN BETTERLIFE ELECTRONIC SCIENCE AND TECHNOLOGY Co Ltd
Priority to CN201710055340.8A priority Critical patent/CN106774638B/en
Publication of CN106774638A publication Critical patent/CN106774638A/en
Application granted granted Critical
Publication of CN106774638B publication Critical patent/CN106774638B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/04Generating or distributing clock signals or signals derived directly therefrom
    • G06F1/14Time supervision arrangements, e.g. real time clock
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/24Arrangements for testing

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Signal Processing (AREA)
  • Electric Clocks (AREA)

Abstract

The invention discloses a kind of timer calibration methods, it is realized based on a system, the system comprises central processing unit, timer and clock modules, the clock module is for providing system clock, described method includes following steps: step S1, when the central processing unit samples target data, the number of samples N of target data is recorded by timer;Step S2, the central processing unit call clock module, obtain the initial time T0' and finish time TN' of target data;Step S3, the central processing unit calculate sample frequency Fs':Fs'=N/ by following formula;Step S4, timer is written in sample frequency Fs' by the central processing unit, to enable timer be timed and counted on the basis of sample frequency Fs'.The present invention can avoid influencing precision of timer because of message processing procedure delay, and then improve data processed result accuracy.

Description

A kind of timer calibration method
Technical field
The present invention relates to timer more particularly to a kind of timer calibration methods.
Background technique
In the prior art, the timer of some intelligent platforms including smart phone is realized by software timer, soft One feature of part timer be event arrive after message send to message queue, operating system according to the principle of first in first out at Manage the message in message queue.Since operating system event to be processed has Unpredictability, often handle what message was spent Time different length causes the delay for handling timer message, precision of timer is influenced, so that calculating according to sampled data The result inaccuracy come.
Summary of the invention
The technical problem to be solved in the present invention is that in view of the deficiencies of the prior art, providing a kind of can avoid at because of message Reason process is delayed and influences precision of timer, and then improves the timer calibration method of data processed result accuracy.
In order to solve the above technical problems, the present invention adopts the following technical scheme that.
A kind of timer calibration method, based on a system realize, the system comprises central processing unit, timer and when Clock module, the clock module is for providing system clock, and described method includes following steps: step S1, the central processing When device samples target data, the number of samples N of target data is recorded by timer;Step S2, the central processing Device calls clock module, obtains the initial time T0' and finish time TN' of target data;Step S3, the central processing unit are logical It crosses following formula and calculates sample frequency Fs':Fs'=N/;Timing is written in sample frequency Fs' by step S4, the central processing unit Device, to enable timer be timed and count on the basis of sample frequency Fs'.
Preferably, original sampling frequency Fs is preset in the timer, in the step S4, the central processing unit will After timer is written in sample frequency Fs', original sampling frequency Fs is replaced by sample frequency Fs'.
Preferably, the system is Android system.
Preferably, the system loading is on a smart phone.
Preferably, the target data is heart rate data.
In timer calibration method disclosed by the invention, after central processing unit receives target data, mentioned with clock module On the basis of the system clock of confession, target data actual initial time T0' and finish time TN' is obtained, in conjunction with the period The actual samples frequency Fs' of target data is calculated in interior number of samples, and timer is written in sample frequency Fs' later, is made Timer sampled and counted according to sample frequency Fs', be based on the above process, the invention avoids because message queue it is excessive And processing accuracy is influenced, and then improve the accuracy of data processed result.
Detailed description of the invention
The system block diagram of Fig. 1 timer calibration method to realize the present invention.
Fig. 2 is the flow chart of timer calibration method of the present invention.
Fig. 3 is the timing comparison diagram of timer original sampling frequency and actual samples frequency.
Specific embodiment
The present invention is described in more detail with reference to the accompanying drawings and examples.
The invention discloses a kind of timer calibration methods, referring to figs. 1 and 2, are realized based on a system, described System includes central processing unit 1, timer 2 and clock module 3, and the clock module 3 is for providing system clock, the method Include the following steps:
Step S1 when the central processing unit 1 samples target data, records target data by timer 2 Number of samples N;
Step S2, the central processing unit 1 call clock module 3, obtain the initial time T0' of target data at the end of Carve TN';
Step S3, the central processing unit 1 calculate sample frequency Fs' by following formula:
Fs'=N/TN'-T0';
Timer 2 is written in sample frequency Fs' by step S4, the central processing unit 1, to enable timer 2 with sampling frequency It is timed and counts on the basis of rate Fs'.
In above-mentioned timer calibration method, after central processing unit 1 receives target data, it is with what clock module 3 provided It unites on the basis of clock, target data actual initial time T0' and finish time TN' is obtained, in conjunction with adopting in the period The actual samples frequency Fs' of target data is calculated in sample number, and timer 2 is written in sample frequency Fs' later, so that fixed When device 2 sampled and counted according to sample frequency Fs', be based on the above process, the invention avoids due to message queue is excessive Processing accuracy is influenced, and then improves the accuracy of data processed result.
In the present embodiment, original sampling frequency Fs is preset in the timer 2, in the step S4, the centre Device 1 is managed by after sample frequency Fs' write-in timer 2, original sampling frequency Fs is replaced by sample frequency Fs'.
The system is Android system as a preferred method,.The system loading is on a smart phone.Actually answer In, the target data is heart rate data.
Timer calibration method disclosed by the invention, working principle can refer to following examples:
Referring to figure 3., on intelligent mobile phone platform, by presetting, signal is carried out with the speed of sample frequency Fs The time cycle of sampling, data acquisition is Ts=1/Fs.N number of data can be theoretically acquired in T time.However actual In sampling process, since intelligent platform uses the reason of software timer, the time interval of actually every segment data acquisition all can More than or equal to Ts, it is denoted as T1 ', T2 ' ..., TN respectively '.
In order to calibrate the precision of timer, T0, n times sampling are denoted as in the time for an initial time for carrying out signal acquisition Time later is denoted as TN.Sample frequency after calibration are as follows:
Fs'=N/TN'-T0';
Sample frequency Fs ' after the calibration newly obtained is substituted original Fs to calculate, can effectively improve number It is worth precision.In order to track the drift of timer, the real time of the N number of data costs of acquisition is obtained again every the segment record time Timer is calibrated, the moment obtains the variation of timer.
Such as under smart phone Android operation system, heart rate data acquisition is carried out.Sample frequency 250Hz, sampling are set Period 4ms.But the sampling period drifts around in 4.3ms in actual sampling process.It is 75 times/min to a heart rate value People, the heart rate value actually obtained are near 81.In order to calibrate timer, time T0 is recorded at the beginning of being sampled, Time T250 is recorded after 250 sampled points, calculates new sample frequency are as follows:
Fs'=250/ (T250'-T0');
Sample frequency after the calibration calculated is 233Hz.Before then recalculating the available ratio calibration of heart rate value More accurate heart rate value.
Timer calibration method disclosed by the invention, can be effectively relieved the signal errors of the elegant generation of timer, make It obtains and is possibly realized on intelligent platform according to timer sampling.Meanwhile the present invention can be adopted in the quasi- timer of intelligent platform colonel The precision of sample, and some numerical value calculated by the data of acquisition can be corrected, for example, by the electrocardiogram of acquisition or The heart rate value that person's pulse wave data is calculated.
The above is preferred embodiments of the present invention, is not intended to restrict the invention, all in technology model of the invention Interior done modification, equivalent replacement or improvement etc. are enclosed, should be included in the range of of the invention protect.

Claims (5)

1. a kind of timer calibration method, which is characterized in that based on a system realize, the system comprises central processing unit (1), Timer (2) and clock module (3), the clock module (3) is for providing system clock, and described method includes following steps:
Step S1 when the central processing unit (1) samples target data, records target data by timer (2) Number of samples N;
Step S2, the central processing unit (1) call clock module (3), obtain the initial time T0' of target data at the end of Carve TN';
Step S3, the central processing unit (1) calculate sample frequency Fs' by following formula:
Fs'=N/ (TN'-T0');
Step S4, timer (2) are written in sample frequency Fs' by the central processing unit (1), to enable timer (2) with the sampling It is timed and counts on the basis of frequency Fs'.
2. timer calibration method as described in claim 1, which is characterized in that preset in the timer (2) and initially adopt In sample frequency Fs, the step S4, after timer (2) are written in sample frequency Fs' by the central processing unit (1), by sampling frequency Rate Fs' replaces original sampling frequency Fs.
3. timer calibration method as described in claim 1, which is characterized in that the system is Android system.
4. timer calibration method as described in claim 1, which is characterized in that the system loading is on a smart phone.
5. timer calibration method as described in claim 1, which is characterized in that the target data is heart rate data.
CN201710055340.8A 2017-01-25 2017-01-25 A kind of timer calibration method Active CN106774638B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710055340.8A CN106774638B (en) 2017-01-25 2017-01-25 A kind of timer calibration method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710055340.8A CN106774638B (en) 2017-01-25 2017-01-25 A kind of timer calibration method

Publications (2)

Publication Number Publication Date
CN106774638A CN106774638A (en) 2017-05-31
CN106774638B true CN106774638B (en) 2019-09-10

Family

ID=58941921

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710055340.8A Active CN106774638B (en) 2017-01-25 2017-01-25 A kind of timer calibration method

Country Status (1)

Country Link
CN (1) CN106774638B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110968148A (en) * 2018-09-28 2020-04-07 珠海格力电器股份有限公司 Timing calibration method and device and timer

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109492185B (en) * 2018-10-18 2022-11-25 南京丰道电力科技有限公司 Method and device for processing sampled data

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7203858B2 (en) * 2003-12-19 2007-04-10 Intel Corporation Program clock synchronization in multimedia networks
CN101754468B (en) * 2008-12-18 2013-10-30 展讯通信(上海)有限公司 Mobile terminal and clock design method for mobile terminal
US9036756B2 (en) * 2013-01-25 2015-05-19 Cambridge Silicon Radio Limited Receiver and methods for calibration thereof
US9788164B2 (en) * 2013-07-14 2017-10-10 David Martin Method and apparatus for determination of kinematic parameters of mobile device user
US9685966B2 (en) * 2014-12-02 2017-06-20 Mediatek Inc. Fractional dividing module and related calibration method
CN104570012B (en) * 2014-12-29 2017-03-08 北京无线电计量测试研究所 A kind of system and method for Beidou navigation signal hardware simulator time-delay calibration

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110968148A (en) * 2018-09-28 2020-04-07 珠海格力电器股份有限公司 Timing calibration method and device and timer

Also Published As

Publication number Publication date
CN106774638A (en) 2017-05-31

Similar Documents

Publication Publication Date Title
CN104330082B (en) A kind of MEMS/GNSS integrated navigation systems real-time data synchronization method
CN108519610B (en) Multi-sensor combined navigation system time synchronization and real-time data acquisition method
CN106774638B (en) A kind of timer calibration method
CN103368676B (en) A kind of strange land based on cyclic pulse signal synchronous data sampling method and system
CN111431650B (en) Satellite signal real-time service method and system based on FPGA
CN107145468A (en) Signal generating and reading device and control method
CN108438279B (en) Intelligent measurement and control system and method for high-precision liquid filling
CN103048508B (en) Improve the method for digital oscilloscope activation levels precision, device and digital oscilloscope
CN109302255A (en) Time synchronization control method, device, system and computer readable storage medium
CN112633749A (en) Staff working time counting method, system and medium based on face recognition
CN107229219A (en) It is a kind of based on GPS module, the computer precision time service method of embedded system and its to realize system
CN111181711B (en) Method and system for synchronously sampling signals, storage medium and application equipment
CN115755564A (en) Alarm clock control method based on sleep stage prediction, radar and storage medium
EP1412764A1 (en) System and method for waveform processing
US20090287863A1 (en) Real time data interface
CN116932333B (en) AXI bus real-time performance monitoring method for post-silicon verification
CN109412939A (en) Record the communication gate and working method of industrial network communication cycle process data
CN106326639B (en) A kind of ECG emulation signal modeling and segmentation method for generation
CN104410483B (en) One kind receives packet sequencing and invalid bag processing system
CN105653877B (en) A kind of infusion data processing system and method
CN113607269B (en) Sound dose determination method, device, electronic equipment and storage medium
CN112305256B (en) Self-adaptive MT transition speed measurement method
CN109303953A (en) Drip monitoring method and system
CN108549329B (en) Method and device for realizing uniform pulse output based on FPGA
CN103915051B (en) Method for controlling display of nixie tube

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
GR01 Patent grant
GR01 Patent grant