JPS58214951A - Time counting system using free running counter - Google Patents
Time counting system using free running counterInfo
- Publication number
- JPS58214951A JPS58214951A JP57098119A JP9811982A JPS58214951A JP S58214951 A JPS58214951 A JP S58214951A JP 57098119 A JP57098119 A JP 57098119A JP 9811982 A JP9811982 A JP 9811982A JP S58214951 A JPS58214951 A JP S58214951A
- Authority
- JP
- Japan
- Prior art keywords
- value
- borrow
- overflow
- time interval
- counter
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F1/00—Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
- G06F1/04—Generating or distributing clock signals or signals derived directly therefrom
Abstract
Description
【発明の詳細な説明】
本発明は、フリーラン力ろンタを用いた計時方式に関す
る。DETAILED DESCRIPTION OF THE INVENTION The present invention relates to a timekeeping system using a free-running rotor.
マイクロコンピュータには電源を投入すると動き出すフ
リーランカウンタがあり、これを用いて例えば割込みか
ら次の割込みまでの時間を計測する。計測対象となるタ
イムインターバルが一定の範囲内に限られる場合は、フ
リーランカウンタのビット数は通常その範囲内が計測で
きるように設定される。この範囲内では計測開始時(S
)のタイムデータT1と針側終了時(E)のタイムデー
タT2との差を算出することでタイムインタバルTを求
めることができる。A microcomputer has a free-run counter that starts when the power is turned on, and is used to measure, for example, the time from one interrupt to the next. When the time interval to be measured is limited to a certain range, the number of bits of the free run counter is usually set so that it can measure within that range. Within this range, at the start of measurement (S
The time interval T can be determined by calculating the difference between the time data T1 at ) and the time data T2 at the end of the hand side (E).
T=72−T+
しかし自動車用の制御機器のタイムインタバルデータ、
例えばエンジン回転数の逆数はエンジン始動前および始
動中は弗素に大きな値になるので、上式を用いてもその
間に何回オーバーフローしたかを検知していなければ無
意味なデータとなる。T=72−T+ However, time interval data of automotive control equipment,
For example, the reciprocal of the engine rotational speed has a large value before and during engine startup, so even if the above formula is used, the data will be meaningless unless it is detected how many times overflow occurred during that time.
しかも、この値がオーバーフローを無視して使用される
人中、高速回転時のデータと見做されるので不都合が生
じる。Moreover, this value is considered to be data during high-speed rotation and is used without regard to overflow, which causes an inconvenience.
第1図はこの説明図で、Iは16ビツトのフリーランカ
ウンタである。16ビツトであるから計数値は0000
〜FFFF(16進)の範囲で変化するが、図では説明
を判りやすくするため左端が0000、右端がFFFF
としである。そして、計測開始時Sと終了時Eの間の実
線矢印がタイムインタバルTを示すものとしである。(
A)のケースは短いインクハルTであるから単純な減算
T=E−3で簡単にインタバルTを算出できる。(B)
および(C)のケースはそれぞれオーバーフローをする
が、いずれも終了時Eが開始時Sを越えないのでボロー
(極性反転)を無視すれば同じ<T=E−3でタイムイ
ンタバルを算出できる。FIG. 1 is an explanatory diagram of this, where I is a 16-bit free-run counter. Since it is 16 bits, the count value is 0000.
It changes in the range of ~FFFF (hexadecimal), but in the diagram, the left end is 0000 and the right end is FFFF to make the explanation easier to understand.
It's Toshide. It is assumed that a solid line arrow between the measurement start time S and the measurement end time E indicates a time interval T. (
In case A), since the ink hull T is short, the interval T can be easily calculated by simple subtraction T=E-3. (B)
Cases (C) and (C) each overflow, but in both cases the end time E does not exceed the start time S, so if borrow (polarity reversal) is ignored, the time interval can be calculated as <T=E-3.
しかし、(D)のケースになるとT=E−3は(A)と
同様の短かい値になり、これに1周期分の値を加算しな
ければ著しく不正確な値となる。However, in case (D), T=E-3 becomes a short value similar to (A), and unless a value for one cycle is added to this value, it becomes a significantly inaccurate value.
従来はこの様な場合に(A)〜(C)のケースが正確に
計時できればよいという観点から、(D)のケースのイ
ンタバルデータを除去する目的で第2図のようにコンベ
アレジスタ2を用いている。Conventionally, in such cases, a conveyor register 2 was used as shown in Fig. 2 for the purpose of removing the interval data in case (D) from the viewpoint that it was sufficient to be able to accurately time the cases (A) to (C). ing.
このコンベアレジスタ2には計測開始点Sより1カウン
ト前の値E′をセットし、これを限界値としてオーバー
フローがあったときはE<E′の範囲内でのみT=E−
3を有効にし、E≧E′ではそのデータを無効にする処
理をしている。しかしながらこのようにするためにはコ
ンベアレジスタ2に16ビツト必要となるので、RAM
の占有度が高まる上、常時比較をしなければならないの
でプログラムが複雑になる欠点がある。A value E' one count before the measurement start point S is set in this conveyor register 2, and with this as the limit value, if an overflow occurs, T=E- only within the range of E<E'.
3 is made valid, and when E≧E', the data is made invalid. However, in order to do this, 16 bits are required for conveyor register 2, so the RAM
This has the disadvantage that the program becomes more complex because it occupies more space and requires constant comparison.
本発明はオーバーフローとボローに関する2種類のフラ
グを設けるだけでタイムインタバルデータの有効性を判
断しようとするものである。The present invention attempts to determine the validity of time interval data by simply providing two types of flags regarding overflow and borrow.
本発明の特徴とするところは、電源投入中は常時動作す
るフリーランカウンタを用いて計測開始時の値と計測終
了時の値との差からタイムインタバルを算出する計時方
式において、該算出時のボローの有無を示す第1のフラ
グと、計測期間中のオーバーフロー回数を示す第2のフ
ラグとを設定し、そしてこれらのフラグからオーバーフ
ローとボローが共にないと判断された場合、およびオー
バーフローが1回で且つボローが有ると判断された場合
のみ、算出されたタイムインタバルデータを有効にする
ことを特徴とするになるが、以下図示の実施例を参照し
ながらこれを詳細に説明する。The present invention is characterized in that a time interval is calculated from the difference between a value at the start of measurement and a value at the end of measurement using a free-run counter that operates constantly while the power is turned on. A first flag indicating the presence or absence of a borrow and a second flag indicating the number of overflows during the measurement period are set, and if it is determined from these flags that there are no overflows and borrows, and there is one overflow. The calculated time interval data is validated only when it is determined that there is a borrow. This will be explained in detail below with reference to the illustrated embodiment.
第3図は本発明の一実施例を示す概略構成図である。本
例では第3図に示すようにオーバーフローの回数を示す
フラグ3とボローの有無を示すフラグ4を設け、そして
カウンタlを用いてタイムインタバルの計測を開始した
らこれらのフラグ3.4に該当事項を書込む(ボロー、
オーバーフローの判定機能は通常のマイクロコンピュー
タ中にある)。フラグ4は1ビツトで、ボローの有無が
1、Oで示される。これに対しフラグ3は2ビツトでオ
ーバーフローの回数を0回、1回、そして2回以上の3
種類に分けて表わす。これらのフラグ3.4を用いたイ
ンタバルデータの有効性の判断は下表の通りである。FIG. 3 is a schematic diagram showing an embodiment of the present invention. In this example, as shown in Fig. 3, a flag 3 indicating the number of overflows and a flag 4 indicating the presence or absence of a borrow are provided, and when the time interval measurement is started using the counter l, the corresponding items are displayed in these flags 3.4. write (borrow,
The overflow determination function is in a normal microcomputer). Flag 4 is 1 bit, and the presence or absence of a borrow is indicated by 1 or O. On the other hand, flag 3 is a 2-bit flag that indicates the number of overflows: 0, 1, and 2 or more.
Shown by type. The validity of interval data is judged using these flags 3.4 as shown in the table below.
表 1
上表で有効(A)は第1図(A)のケース、有効(B、
C)は同図(B)、 (C)のケース、無効(D)は
同図(、D)のケースである。第4図は上表に従かいデ
ータの有効、無効を判断する処理フローである。Table 1 In the table above, valid (A) is the case in Figure 1 (A), valid (B,
C) is the case of (B) and (C) in the same figure, and invalidity (D) is the case of (,D) in the same figure. FIG. 4 is a processing flow for determining whether data is valid or invalid according to the above table.
以上述べたように本発明によれば、カウンタのオーバー
フローの回数およびタイムインタバルを計測する演算結
果のボローの有無を判定するのみでデータが有効か無効
か判断できるので、従来のコンベアレジスタ等のRAM
領域が不要となり、かつコンベアレジスタとカウンタの
常時比較が不要となる利点がある。As described above, according to the present invention, it is possible to judge whether data is valid or invalid only by determining the number of counter overflows and the presence or absence of a borrow in the calculation result for measuring the time interval.
This has the advantage that no area is required and constant comparison between the conveyor register and the counter is not required.
第1図はフリーランカウンタを用いたタイムインタバル
計測の説明図、第2図は従来の計時方式の説明図、第3
図は本発明の一実施例を示す構成図、第4図は有効性判
断のフローチャートである。
図中、1はフリーランカウンタ、3はオーバーフロー回
数を示すフラグ、4はボローの有無を示すフラグである
。
第1図
第2図 第3図
第4図Figure 1 is an explanatory diagram of time interval measurement using a free run counter, Figure 2 is an explanatory diagram of the conventional time measurement method, and Figure 3 is an explanatory diagram of time interval measurement using a free run counter.
The figure is a block diagram showing one embodiment of the present invention, and FIG. 4 is a flowchart for determining effectiveness. In the figure, 1 is a free run counter, 3 is a flag indicating the number of overflows, and 4 is a flag indicating the presence or absence of a borrow. Figure 1 Figure 2 Figure 3 Figure 4
Claims (1)
計測開始時の値と針側終了時の値との差からタイムイン
タバルを算出する計時方式において、該算出時のボロー
の有無を示す第1のフラグと、針側期間中のオーバーフ
ロー回数を示す第2のフラグとを設定し、そしてこれら
のフラグからオーバーフローとボローが共にないと判断
された場合、およびオーバーフローが1回で且つボロー
が有ると判断された場合のみ、算出されたタイムインタ
バルデータを有効にすることを特徴とする、フリーラン
カウンタを用いた計時方式。In a timekeeping method that uses a free-run counter that operates at all times while the power is turned on to calculate the time interval from the difference between the value at the start of measurement and the value at the end of the hand side, the first counter indicates the presence or absence of a borrow at the time of calculation. A flag and a second flag indicating the number of overflows during the needle side period are set, and if it is determined from these flags that there is no overflow or borrow, or it is determined that there is one overflow and a borrow. A timekeeping method using a free-run counter, which is characterized in that calculated time interval data is validated only when the time interval data is calculated.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP57098119A JPS58214951A (en) | 1982-06-08 | 1982-06-08 | Time counting system using free running counter |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP57098119A JPS58214951A (en) | 1982-06-08 | 1982-06-08 | Time counting system using free running counter |
Publications (1)
Publication Number | Publication Date |
---|---|
JPS58214951A true JPS58214951A (en) | 1983-12-14 |
Family
ID=14211406
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP57098119A Pending JPS58214951A (en) | 1982-06-08 | 1982-06-08 | Time counting system using free running counter |
Country Status (1)
Country | Link |
---|---|
JP (1) | JPS58214951A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH0296685A (en) * | 1988-10-04 | 1990-04-09 | Mitsubishi Electric Corp | Measurement of time |
JP2002168890A (en) * | 2000-11-30 | 2002-06-14 | Matsushita Electric Ind Co Ltd | Frequency detection method and device and recording medium |
WO2007026405A1 (en) * | 2005-08-30 | 2007-03-08 | Fujitsu Limited | Information processor for measuring operating time |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPS51137343A (en) * | 1975-05-02 | 1976-11-27 | Sperry Rand Corp | Timeeoffevent recorder |
JPS54124929A (en) * | 1978-03-22 | 1979-09-28 | Fujitsu Ltd | Timer unit |
-
1982
- 1982-06-08 JP JP57098119A patent/JPS58214951A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPS51137343A (en) * | 1975-05-02 | 1976-11-27 | Sperry Rand Corp | Timeeoffevent recorder |
JPS54124929A (en) * | 1978-03-22 | 1979-09-28 | Fujitsu Ltd | Timer unit |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH0296685A (en) * | 1988-10-04 | 1990-04-09 | Mitsubishi Electric Corp | Measurement of time |
JP2002168890A (en) * | 2000-11-30 | 2002-06-14 | Matsushita Electric Ind Co Ltd | Frequency detection method and device and recording medium |
WO2007026405A1 (en) * | 2005-08-30 | 2007-03-08 | Fujitsu Limited | Information processor for measuring operating time |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US4569027A (en) | Method and apparatus for detecting rotational speed of rotary member | |
US4527248A (en) | Engine speed sensing device | |
JPS58214951A (en) | Time counting system using free running counter | |
JPH0217831B2 (en) | ||
KR850002115A (en) | Electronic ignition control | |
JPH0365739A (en) | Control device | |
JPH034174A (en) | Speed detecting device for vehicle | |
JPS59109867A (en) | Speed detection system | |
JP3145937B2 (en) | Runaway detection method for microcomputer | |
JPH09114541A (en) | Interruption generation time confirming circuit and processor | |
GB1149970A (en) | Improvements relating to measurement | |
JP2780282B2 (en) | Method and apparatus for measuring rotational speed | |
JP2002162407A (en) | Measuring method for distance synchronization system | |
JPS63215968A (en) | Speed measuring instrument | |
JPH0592814U (en) | Detector | |
JPS61254863A (en) | Method for calculating velocity | |
JPS59122954A (en) | Automatic analyzing apparatus | |
JPH0535889A (en) | Microprocessor circuit | |
JPH0498540A (en) | Processor load monitoring system | |
JPS61239163A (en) | Rotation measuring instrument | |
JPS5445180A (en) | Measuring method of speeds | |
JPH048823B2 (en) | ||
JPS60143710A (en) | Apparatus for measuring flow rate of fluid | |
JPH0527065B2 (en) | ||
JPS6227835A (en) | Measuring method for load of microprogram controller |