JPH04205230A - Data processor - Google Patents

Data processor

Info

Publication number
JPH04205230A
JPH04205230A JP2329807A JP32980790A JPH04205230A JP H04205230 A JPH04205230 A JP H04205230A JP 2329807 A JP2329807 A JP 2329807A JP 32980790 A JP32980790 A JP 32980790A JP H04205230 A JPH04205230 A JP H04205230A
Authority
JP
Japan
Prior art keywords
count
timer
correction
data
interrupt processing
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
JP2329807A
Other languages
Japanese (ja)
Inventor
Osamu Kinoshita
理 木下
Atsushi Hiraishi
平石 敦史
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.)
Toshiba Corp
Toshiba System Technology Corp
Original Assignee
Toshiba Corp
Toshiba System Technology Corp
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 Toshiba Corp, Toshiba System Technology Corp filed Critical Toshiba Corp
Priority to JP2329807A priority Critical patent/JPH04205230A/en
Publication of JPH04205230A publication Critical patent/JPH04205230A/en
Pending legal-status Critical Current

Links

Landscapes

  • Bus Control (AREA)

Abstract

PURPOSE:To correct the deviation of a control timing to keep the control timing to a fixed cycle and to enable high-reliability data processing corresponding to time by providing a timer for correcting control timing. CONSTITUTION:A timer 10 for correcting control timing is provided, and the correcting timer 10 counts the same clock signal as a timer 5 for generating control timing. Then, the control timer 5 resets current timing based on the count of the correcting timer 10 so that the control timing can be the fixed interval, and corresponding to the reset of the control timer 5, the correcting timer 10 is reset to prescribed counting. Thus, the deviation of the control timing for the control timer with interrupting processing inhibition caused by the other program processing is corrected, and high-reliability data processing is enabled while making the time and data correspondent.

Description

【発明の詳細な説明】 [発明の目的] (産業上の利用分野) 本発明は、割り込み処理を行なうための制御タイミング
を補正するデータ処理装置に関する。
DETAILED DESCRIPTION OF THE INVENTION [Object of the Invention] (Industrial Application Field) The present invention relates to a data processing device that corrects control timing for interrupt processing.

(従来の技術) 従来、マイクロコンピュータ等のプロセッサにおいて、
一定の周期でデータを処理する必要かある場合には、一
般に、内部タイマーを使用して、一定時間毎の割り込み
処理により行っている。
(Prior Art) Conventionally, in a processor such as a microcomputer,
If it is necessary to process data at regular intervals, an internal timer is generally used to process interrupts at regular intervals.

第7図は、上記した従来例を示すデータ処理装置のブロ
ック構成図である。
FIG. 7 is a block configuration diagram of a data processing device showing the above-described conventional example.

このデータ処理装置は、プロセッサ1、データ保存メモ
リ2、共有メモリ3、入力部4および制御タイミング発
生用タイマ5等より構成される。また、プロセッサ1、
データ保存メモリ2、共有メモリ3、および制御タイミ
ング発生用タイマ5は相互に共通バス6により接続され
ている。さらに、上記構成の他共通バス6には図示しな
い各種処理部が接続されている。なお、7はプロセスデ
ータシリアル入力用の信号線、8は入力部4からのプロ
セスデータパラレル入力用信号線、9は割り込み処理信
号線を各々示す。
This data processing device includes a processor 1, a data storage memory 2, a shared memory 3, an input section 4, a timer 5 for generating control timing, and the like. In addition, processor 1,
The data storage memory 2, the shared memory 3, and the control timing generation timer 5 are connected to each other by a common bus 6. Furthermore, in addition to the above configuration, various processing units (not shown) are connected to the common bus 6. Note that 7 is a signal line for serial input of process data, 8 is a signal line for parallel input of process data from the input section 4, and 9 is an interrupt processing signal line.

ここで、プロセッサlは、図示せぬグロック発生器から
のタロツクに同期して各種処理プログラムを実行すると
共に、プログラムに従って共有メモリ3のデータを読み
出しデータ保存メモリ2に保存する。共有メモリ3は、
入力部4からのパラレルデータを1時的に更新、保存す
る。入力部4はプラントからのプロセス量を示すシリア
ルデータを取り込み、パラレルデータに変換して共有メ
モリ3に出力する。制御タイミング発生用タイマ(以下
「制御タイマ」という)5は図示せぬクロック発生器か
らのクロック信号をカウントして、所定のカウントとな
るとプロセッサlに割り込み信号を発生すると共に、割
り込み処理終了により再起動するタイマ動作を繰り返す
Here, the processor 1 executes various processing programs in synchronization with a tarlock from a Glock generator (not shown), and also reads data from the shared memory 3 and stores it in the data storage memory 2 according to the program. Shared memory 3 is
The parallel data from the input section 4 is temporarily updated and saved. The input unit 4 takes in serial data indicating the process amount from the plant, converts it into parallel data, and outputs it to the shared memory 3. A control timing generation timer (hereinafter referred to as "control timer") 5 counts clock signals from a clock generator (not shown), and when a predetermined count is reached, generates an interrupt signal to the processor 1, and also generates a restart upon completion of interrupt processing. Repeat the timer operation that starts.

以上の構成で、一定の周期TIで送られてくる入力デー
タは入力部4から共有メモリ3に順次一定周期分一時保
存される。
With the above configuration, input data sent at a constant period TI is temporarily stored from the input unit 4 to the shared memory 3 sequentially for a constant period.

制御タイマ5は、第8図の正常時の動作に示す如く一定
の間隔T3の制御タイミングでプロセッサ1に割り込み
信号を発生する。プロセッサ1はこの割り込み処理信号
に応じて共有メモリ3からデータ保存メモリ2へT4間
隔でデータ転送処理する。このように制御タイマ5の一
定の間隔T3のタイマ動作により、この共有メモリ3の
データは一定間隔の制御タイミングで時系列に共有メモ
リ3のデータをデータ保存メモリ2に保存する。
The control timer 5 generates an interrupt signal to the processor 1 at a control timing at a constant interval T3, as shown in the normal operation in FIG. The processor 1 transfers data from the shared memory 3 to the data storage memory 2 at intervals of T4 in response to this interrupt processing signal. In this way, by the timer operation of the control timer 5 at constant intervals T3, the data in the shared memory 3 is stored in the data storage memory 2 in time series at the control timing at constant intervals.

(発明が解決しようとする課題) しかしながら、上記したデータ処理装置には次の問題が
ある。
(Problems to be Solved by the Invention) However, the above data processing device has the following problems.

まず、割り込み信号発生時にプロセッサ1が他のプログ
ラムを実行している場合には割り込み禁止となり、第8
図の割り込み禁止時(図示破線部分)の動作に示す如く
、割り込み処理禁止解除後に割り込み処理を開始して割
り込み処理終了後に制御タイマ5が再起動する。そして
、一定の間隔T3後に再び割り込み信号を発生して制御
タイミングとなる。従って、図示するように時刻の数字
と対応しない割り込み処理時の数字から分かるように制
御タイミングが徐々にずれてくる。このため、入力デー
タをデータ保存メモリ2のデータエリアに格納する制御
タイミングが一致せず、データ保存メモリ2のデータエ
リアに保存された時刻とデータとが徐々にずれたものと
なる。つまり、収集時刻とデータとが対応しない不正確
な信頼性のないデータがデータ保存メモリ2に保存され
ることになる。
First, if processor 1 is running another program when an interrupt signal is generated, interrupts are disabled, and
As shown in the operation when interrupts are disabled (indicated by broken lines in the figure), interrupt processing is started after the interrupt processing is disabled, and the control timer 5 is restarted after the interrupt processing is completed. Then, after a certain interval T3, an interrupt signal is generated again to reach the control timing. Therefore, as shown in the figure, the control timing gradually shifts as can be seen from the interrupt processing numbers that do not correspond to the time numbers. For this reason, the control timings for storing input data in the data area of the data storage memory 2 do not match, and the time and data stored in the data area of the data storage memory 2 gradually deviate. In other words, inaccurate and unreliable data in which the collection time and data do not correspond are stored in the data storage memory 2.

例えば、プラントデータの解析では数m5Ec単位の精
度が要求されることが多く、上記したデータ取り込み制
御タイミングのずれ、つまり時刻とデータとの対応しな
い不正確なデータによる解析のためにプラントを誤って
制御することにもなる。
For example, plant data analysis often requires accuracy on the order of several m5Ec, and due to the above-mentioned deviation in data acquisition control timing, that is, analysis based on inaccurate data that does not correspond to time, the plant may be incorrectly analyzed. It can also be controlled.

これを解決するため、外部に高精度の時計を設け、常に
時刻を読み出し、時刻とデータが対応した精度の高いデ
ータを保存するようにすればよいが、そうすると高精度
の時計が必要となり高価につくという問題がある。
To solve this problem, it would be possible to install a high-precision clock externally, constantly read the time, and store highly accurate data that corresponds to the time, but this would require a high-precision clock and become expensive. There is a problem with getting it on.

そこで、本発明は上記したデータ処理のための制御タイ
ミングのずれを補正することにより、時刻とデータと対
応させた信頼性の高いデータ処理ができるデータ処理装
置を提供することを目的とする。
Therefore, it is an object of the present invention to provide a data processing device that can perform highly reliable data processing that corresponds to time and data by correcting the deviation in control timing for data processing.

[発明の構成] (課題を解決するための手段) 本発明は、制御タイマがクロック信号をカウントして最
大カウント時に割り込み処理信号を発生しタイマ動作を
する。一方、補正タイマは前記クロック信号をカウント
し、このカウントに基ついて割り込み処理禁止期間にお
ける割り込み処理発生回数が求められる。この割り込み
処理発生回数に基づいてエラーデータを保存エリアに格
納後入力データの収集をする。制御タイマは前記補正タ
イマのカウントに基づいて制御タイミングが一定間隔と
なるように現カウントを再設定し、また、補正タイマは
制御タイマの上記再設定に対応して所定のカウントに再
設定するようにした。
[Structure of the Invention] (Means for Solving the Problems) In the present invention, a control timer counts clock signals, generates an interrupt processing signal at the maximum count, and performs a timer operation. On the other hand, the correction timer counts the clock signal, and based on this count, the number of times interrupt processing occurs during the interrupt processing disabled period is determined. Based on the number of interrupt processing occurrences, error data is stored in a storage area and input data is collected. The control timer resets the current count so that the control timing is at regular intervals based on the count of the correction timer, and the correction timer resets the current count to a predetermined count in response to the resetting of the control timer. I made it.

(作用) 上記構成により、他のプログラム処理による割り込み処
理禁止に伴う制御タイマの制御タイミングのずれか補正
される。また、割り込み処理禁止に伴うエラーデータが
判定されて対応するデータエリアに経時的に順次格納さ
れる。従って、データの解析において正確なデータを基
礎として解明できるから誤ったプラントの制御を回避で
きる。
(Operation) With the above configuration, a shift in the control timing of the control timer due to inhibition of interrupt processing by other program processing is corrected. Further, error data associated with the inhibition of interrupt processing is determined and sequentially stored in the corresponding data area over time. Therefore, data can be analyzed based on accurate data, and erroneous plant control can be avoided.

(実施例) 以下、本発明の実施例について図面を参照して説明する
(Example) Hereinafter, an example of the present invention will be described with reference to the drawings.

第1図は本発明の第1実施例を示すデータ処理装置のブ
ロック構成図である。第7図と同一符号は同一部分また
は相当部分を示し、既に説明した部分は説明を省略する
FIG. 1 is a block diagram of a data processing apparatus showing a first embodiment of the present invention. The same reference numerals as in FIG. 7 indicate the same or corresponding parts, and the explanation of the parts already explained will be omitted.

第1図と第7図との構成で異なる点は、制御タイミング
補正用タイマ10(以下「補正タイマIO」という)を
備えている点である。
The difference between the configurations of FIG. 1 and FIG. 7 is that a control timing correction timer 10 (hereinafter referred to as "correction timer IO") is provided.

補正タイマ10は制御タイマ5と同じクロック信号F(
Hz)をカウントするもので、補正動作が無ければベー
スカウントBa(最初に設定されたカウントで以下「補
正側ベースカウント」といい、例えば4000カウント
とする)から最大カウントMa(以下「補正側最大カウ
ント」といい、例えば、20000カウントとする)ま
でカウントする動作を繰り返す。
The correction timer 10 receives the same clock signal F(
Hz), and if there is no correction operation, it will count from the base count Ba (the first set count, hereinafter referred to as "correction side base count", for example 4000 counts) to the maximum count Ma (hereinafter "correction side maximum The counting operation is repeated until it reaches 20,000 counts, for example.

また、この補正タイマ10は割り込み処理終了時まで連
続的にカウントを行って、割り込み処理終了時に現時点
の補正側現カウントCaをプロセッサlが読み呂し、後
述する処理プログラムにより補正タイマ10の補正側現
カウントCaを補正側再設定カウントSaに再設定する
ように構成されている。
In addition, this correction timer 10 continuously counts until the end of the interrupt processing, and at the end of the interrupt processing, the processor l reads the current correction side current count Ca, and the correction timer 10 is controlled by the processing program to be described later. The current count Ca is configured to be reset to the correction side reset count Sa.

一方、この実施例の制御タイマ5は第7図において説明
した従来例の構成と異なる。即ち、この実施例の制御タ
イマ5は、補正が無ければ、ベースカウントBc(以下
「制御側ベースカウント」といい例えば2000カウン
トとする)から最大カウントMc(以下「制御側最大カ
ウント」といい、例えば、4000カウントとする)ま
でカウントし、制御側最大カウントに達したとき割り込
み処理信号を発生する。
On the other hand, the control timer 5 of this embodiment differs in configuration from the conventional example explained in FIG. That is, the control timer 5 of this embodiment, without correction, changes from the base count Bc (hereinafter referred to as "control side base count", for example, 2000 counts) to the maximum count Mc (hereinafter referred to as "control side maximum count"), For example, it counts up to 4000 counts) and generates an interrupt processing signal when the maximum count on the control side is reached.

この制御タイマ5は、割り込み処理時にプロセッサlの
プログラム処理により補正タイマ10の補正側現カウン
トCaに基づいて後述するように制御タイマ5の現時点
の制御側現カウントCcを制御側再設定カウントScに
再設定するように構成されている。なお、上記した制御
側最大カウントMcと補正側最大カウントMaとの関係
はMe(Maとしている。
This control timer 5 changes the current control side current count Cc of the control timer 5 to the control side reset count Sc based on the correction side current count Ca of the correction timer 10 by the program processing of the processor 1 during interrupt processing. Configured to be reconfigured. Note that the relationship between the control-side maximum count Mc and the correction-side maximum count Ma described above is defined as Me(Ma).

以上の構成で、第2図に示す如く、プロセッサ1の処理
プログラムの手順により制御タイマ5および補正タイマ
lOが動作し、共有メモリ3のデータをデータ保存メモ
リ2に格納する。
With the above configuration, as shown in FIG. 2, the control timer 5 and the correction timer IO operate according to the procedure of the processing program of the processor 1, and the data in the shared memory 3 is stored in the data storage memory 2.

なお、この実施例の説明を容易にするため第3図(A)
〜(C)に示す事例を参照しながら説明する。
In addition, in order to facilitate the explanation of this embodiment, FIG. 3(A)
This will be explained with reference to the examples shown in (C).

ここで、同図(A)は正常時、(B)は割り込み処理禁
止によりデータが保存されない場合、(C)は割り込み
処理禁止によりデータが保存されず、更に禁止解除後の
割り込み処理が次の割り込み処理タイミングに影響を及
ぼす場合を示し、図の数字はカウント値を示す。
Here, (A) in the same figure is normal, (B) is when data is not saved due to interrupt processing disabled, and (C) is data is not saved due to interrupt processing disabled, and furthermore, the interrupt processing after the prohibition is canceled is The case where the interrupt processing timing is affected is shown, and the numbers in the figure indicate the count values.

まず、割り込み処理が開始すると、プロセッサ1が補正
側現カウントCaを読み出す(101)。次に、上記補
正側現カウントCaからエラーデータの発生回数を求め
るため、次の(1)式に示す補正演算の商を求めること
により割り込み回数Teを算出する(102)。
First, when the interrupt processing starts, the processor 1 reads the current count Ca on the correction side (101). Next, in order to obtain the number of occurrences of error data from the correction side current count Ca, the number of interruptions Te is calculated by obtaining the quotient of the correction calculation shown in the following equation (1) (102).

Te= (Ca−Ba)/ (T2 x F) −(1
)ここで、T2:割り込み周期 F:タイマ入力周波数 これにより、現時点の割り込み処理時に割り込み回数T
e<2のときは割り込み処理周期毎に共有メモリ3から
データ保存メモリ2にデータが間違いなく保存されてい
たことが判明する。一方、割り込み回数Te≧2のとき
は割り込み禁止により、データが正常に保存されないこ
とが判明する。
Te= (Ca-Ba)/(T2 x F) -(1
) Here, T2: Interrupt period F: Timer input frequency As a result, the number of interrupts T during the current interrupt processing
When e<2, it is found that data is definitely saved from the shared memory 3 to the data storage memory 2 every interrupt processing cycle. On the other hand, when the number of interrupts Te≧2, it is found that data cannot be saved normally due to interrupt prohibition.

例えば、第3図(A)に示す如く、制御側現カウントC
c・4000で割り込み信号を発生して割り込み処理を
開始するときは、補正側現カウントCa・6000、補
正側ベースカウントBa:4000、T2 X F=2
000であるから、割り込み回数Te= (Ca−Ba
) / (T2 x F)・(6000−4000)/
2000・1く2となり正常にデータが格納されたこと
が判明する。
For example, as shown in FIG. 3(A), the control side current count C
When generating an interrupt signal at c・4000 and starting interrupt processing, correction side current count Ca・6000, correction side base count Ba: 4000, T2 X F=2
000, the number of interrupts Te= (Ca-Ba
) / (T2 x F)・(6000-4000)/
2000・1×2, indicating that the data was stored normally.

これに対して、第3図(B)に示す如く、割り込み処理
禁止の場合は割り込み処理禁止解除後に割り込み処理を
開始して割り込み回数Te・(Ca−Ba)/ (T2
X F) = (10050−4000)/2000 
=3.025 > 2となり2回のデータが格納されな
かったことが判明し、また、第3図(C)に示す場合は
同様に、割り込み回数Te・(Ca−Ba)/(T2 
xF)=(9000−4000)/2000=2.5)
2となり1回のデータが格納されなかったことが判明す
る。
On the other hand, as shown in FIG. 3(B), when interrupt processing is disabled, interrupt processing is started after interrupt processing is disabled, and the number of interrupts Te・(Ca−Ba)/(T2
XF) = (10050-4000)/2000
= 3.025 > 2, which means that the data twice was not stored. Similarly, in the case shown in FIG. 3(C), the number of interrupts Te・(Ca−Ba)/(T2
xF)=(9000-4000)/2000=2.5)
2, which means that the data for one time was not stored.

このTe−1のエラーデータをデータ保存メモリ2のT
e−]に対応するデータエリアに順次エラーデータ有り
と格納する(103)。続いて、正常な入力データを共
有メモリ3から収集しデータ保存メモリ2の対応するデ
ータエリアに格納する(104) (105)。
This error data of Te-1 is stored in data storage memory 2 at T.
e-] is sequentially stored in the data area corresponding to the error data (103). Subsequently, normal input data is collected from the shared memory 3 and stored in the corresponding data area of the data storage memory 2 (104) (105).

データ格納後、再度、補正側現カウントCaを読5 み
込む(+06)。これにより、次の式(2)により補正
演算の余りRaを求める(107)。
After storing the data, read the current count Ca on the correction side again (+06). Thereby, the remainder Ra of the correction calculation is calculated using the following equation (2) (107).

Ra : (Ca−Ba) / (T2 x F)の余
り・(2)この補正演算の余りRaは後に制御タイマ5
および補正タイマIO各々を再設定するときの演算のデ
ータとして用いられる。
Ra: Remainder of (Ca-Ba) / (T2 x F) (2) The remainder Ra of this correction calculation is later stored in the control timer 5.
It is used as calculation data when resetting each of the correction timers IO and IO.

このステップの補正演算の余りRaは、例えば、第3図
(A)の如く、補正側現カウントCa=6100、補正
側ベースカウントBa・4000. T2XF・200
0とするとRa : (Ca−Ba) / (T2 X
 F) =(6100−4000) /2000がら1
00カウントとなり、また、第3図(B)の場合は同様
に算出してRa: (Ca−Ba) / (T2 X 
F) ・(+0150−4000)/2000がら15
0カウントとなり、さらに、第3図(C)の場合は同様
に算出してRa: (Ca−Ba)/ (T2 X F
)=(9100−4000)/2000から1100カ
ウントとなる。
The remainder Ra of the correction calculation in this step is, for example, as shown in FIG. 3(A): correction side current count Ca=6100, correction side base count Ba.4000. T2XF・200
When set to 0, Ra: (Ca-Ba) / (T2
F) = (6100-4000) /2000 1
00 count, and in the case of Figure 3 (B), calculate in the same way as Ra: (Ca-Ba) / (T2
F) ・(+0150-4000)/2000 15
The count becomes 0, and in the case of Fig. 3 (C), calculate in the same way as Ra: (Ca-Ba)/(T2 X F
) = (9100-4000)/2000 to 1100 counts.

次のステップでは、制御側再設定カウントScと補正側
再設定カウントSaとを次の(3)および(4)式によ
り演算する(+o8)。
In the next step, the control side reset count Sc and the correction side reset count Sa are calculated using the following equations (3) and (4) (+o8).

5c=Ra+Bc−(3)   5a=Ra+Ba−(
4)ここで、例えば第3図(A)の場合では、補正演算
の余りRa・100、制御側ベースカウントBc・20
00、補正側ベースカウントBa・4000であるから
上記の式より5c=Ra+Bc=100+2000=2
100および5a=Ra+Ba;100+4000・4
100となる。また、第3図(B)の場合では、同様に
算出して5c=Ra+Bc=150+2000=215
0および5a=Ra+Ba150+4000=4150
となる。さらに、第3図(C)の場合では、同様に算出
して5c=Ra+Bc=l]00+2000=3100
および5a=Ra+Ba1100+4000=5100
となる。
5c=Ra+Bc-(3) 5a=Ra+Ba-(
4) Here, for example, in the case of FIG. 3(A), the remainder of the correction calculation Ra・100, the control side base count Bc・20
00, correction side base count Ba・4000, so from the above formula, 5c=Ra+Bc=100+2000=2
100 and 5a=Ra+Ba; 100+4000・4
It becomes 100. In the case of FIG. 3(B), similarly calculated 5c=Ra+Bc=150+2000=215
0 and 5a=Ra+Ba150+4000=4150
becomes. Furthermore, in the case of FIG. 3(C), similarly calculated 5c=Ra+Bc=l]00+2000=3100
and 5a=Ra+Ba1100+4000=5100
becomes.

続いて、次の(5)式の条件が成立するか否かを判定す
る(109)。
Subsequently, it is determined whether the following condition of equation (5) is satisfied (109).

(Mc−3c)< (TI X F) −(5)ここで
、Tl:入出力制御間隔 この条件が成立するときは、制御側再設定カウントSc
の設定により次の制御タイミングとなるまでの時間が共
有メモリ3からデータをデータ保存メモリ2に保存する
のに必要な時間が入出力制御間隔T1、つまり、入力デ
ータを入力部4がら共有メモリ3へ1時保存するに必要
な時間より小さい場合である。
(Mc-3c) < (TI
The time required to save data from the shared memory 3 to the data storage memory 2 until the next control timing is set is the input/output control interval T1, that is, the input data is transferred from the input unit 4 to the shared memory 3. In this case, the time required to store the data for 1 hour is smaller than the time required for storing the data.

このような場合は、入力データに正常なデータを保存メ
モリ2に保存する時間がないから別の処理をする必要が
ある。
In such a case, there is no time to store normal input data in the storage memory 2, so it is necessary to perform other processing.

例えば、TI XF=lOOOカウントとすると第3図
(A)の場合には、Mc−5c−4000−2100<
 +000=T] X Fで上記条件は成立しない。ま
た、第3図(B)の場合も、Mc−5c:4000−2
150(1000=TI X Fで上記条件は成立しな
い。しかし、第3図(C)の場合には、Mc−3c=4
000−3100(+000で上記条件成立となる。
For example, if TI XF=lOOOO count, then in the case of FIG.
+000=T] The above condition does not hold for XF. Also, in the case of Fig. 3 (B), Mc-5c: 4000-2
150 (1000=TI
000-3100 (+000 satisfies the above condition.

上記の判定結果により条件成立、即ちYESのときはス
テップ108で求めた制御側再設定カウントSCを次の
(6)式に置き代える。
If the condition is met based on the above judgment result, that is, YES, the control side reset count SC obtained in step 108 is replaced by the following equation (6).

Sc:5c−T2 x F・−(6) これにより、制御側現カウントCcおよび補正側現カウ
ントCaを次の(7)および(8)式により再設定し、
プログラム処理を終了する(1.11)。
Sc:5c-T2 x F・-(6) As a result, the control side current count Cc and the correction side current count Ca are reset by the following equations (7) and (8),
Program processing ends (1.11).

Cc=Sc−(7)  Ca=Sa−−−(8)例えば
、第3図(C)の場合、ステップ109でYESの判定
がされたからT2XF・2000としてステップ108
で求めた5c=3100を5c−T2 X F=310
0−2000= ]、 +00に置き代える。この結果
、制御側最大カウントMc・4000で割り込み処理を
させることとして、1回のデータをデータ保存メモリ2
に保存しないようにする。
Cc=Sc-(7) Ca=Sa---(8) For example, in the case of FIG. 3(C), since YES was determined in step 109, step 108 is performed as T2XF・2000.
5c=3100 obtained by 5c-T2 X F=310
0-2000= ], replace with +00. As a result, the interrupt processing is performed at the control side maximum count Mc4000, and one data is stored in the data storage memory 2.
Do not save to .

なお、この場合、次の制御側最大カウントMC=400
0における割り込み処理時に割り込み回数Te= (C
a−Ba)/ (T2 X F)” (8000−40
00)/2000=2となり、1回のエラーデータ有り
をデータ保存メモリ2に格納することになる(103)
、。
In this case, the next control side maximum count MC = 400
When processing interrupts at 0, the number of interrupts Te= (C
a-Ba)/ (T2 X F)” (8000-40
00)/2000=2, and one error data will be stored in data storage memory 2 (103)
,.

一方、NOの場合は、ジャンプしてそのまま制御側現カ
ウントCcおよび補正側現カウントCaを次の(9)お
よび(10)式により再設定する(III)。
On the other hand, in the case of NO, the control side current count Cc and the correction side current count Ca are reset by the following equations (9) and (10) (III).

Cc=Sc−(9)  Ca=Sa−=(to)例えば
、第3図(A)の場合は、ステップ108よりCc=S
c=2100.Ca=Sa:4100とし、第3図(B
)の場合は、Cc=Sc=2150.Ca=Sa=41
50とする。
Cc=Sc-(9) Ca=Sa-=(to) For example, in the case of FIG. 3(A), Cc=S from step 108.
c=2100. Ca=Sa: 4100, Fig. 3 (B
), Cc=Sc=2150. Ca=Sa=41
50.

以上のようにして、割り込み処理禁止によりデータがデ
ータ保存メモリ2に格納されなかったときこれを判定し
、対応するデータエリアにエラーデータを格納する。ま
た、割り込み処理終了時に制御タイマ5では、制御側現
カウントCcを制御側再設定カウントScに再設定する
一方、補正タイマ10では補正側現カウントCaを補正
側再設定カウントSaに再設定する。この場合、上記再
設定時に(Mc−Sc)<TIXFの条件のときはデー
タをデータ保存メモリ2に保存する時間がな↓1から、
1回のデータの取り込みを行なわないように制御側現カ
ウントCcを再設定する。
As described above, when data is not stored in the data storage memory 2 due to interruption processing being disabled, this is determined and error data is stored in the corresponding data area. Further, at the end of the interrupt processing, the control timer 5 resets the control side current count Cc to the control side reset count Sc, while the correction timer 10 resets the correction side current count Ca to the correction side reset count Sa. In this case, when resetting the above, if (Mc-Sc) < TIXF, there is no time to save the data in the data storage memory 2 ↓ From 1,
The control side current count Cc is reset so that data is not taken in once.

これにより、入力データをデータ保存メモリ2のデータ
エリアにエラーデータを格納するための制御タイミング
のずれが解消し、時刻と格納されたデータが対応するこ
とができる。また、割り込み処理禁止によりデータがデ
ータ保存メモリ2に格納されなかったときはエラーデー
タ有りと格納できる。
This eliminates the lag in control timing for storing input data and error data in the data area of the data storage memory 2, and allows the time and stored data to correspond. Furthermore, when data is not stored in the data storage memory 2 due to interrupt processing being disabled, it can be stored as error data.

次に、第2実施例について第4図および第5図を参照し
て説明する。
Next, a second embodiment will be described with reference to FIGS. 4 and 5.

第2実施例は第4図に示すブロック構成図の如く、第1
図に示す第1実施例の補正タイマ10の代わりに制御タ
イミング補正用タイマ(1)11および制御タイミング
補正用タイマ(2)12を備えている点が異なる。
The second embodiment is as shown in the block diagram shown in FIG.
The difference is that a control timing correction timer (1) 11 and a control timing correction timer (2) 12 are provided instead of the correction timer 10 of the first embodiment shown in the figure.

ここで、制御タイミング補正用タイマ(1)(以下「補
正タイマ(1)Jという)11は図示せぬクロック発生
器からのクロック信号をベースカウントBa1(以下「
補正1側ベースカウント」という)・0として、最大カ
ウントMa!(以下[補正l側最大カウント」という)
・T2XFまでカウント後リセットして、再び0カウン
トから補正l側最太カウントMalまでタイマ動作を繰
り返す。
Here, the control timing correction timer (1) (hereinafter referred to as "correction timer (1) J") 11 uses a clock signal from a clock generator (not shown) as a base count Ba1 (hereinafter referred to as "correction timer (1) J").
"Correction 1 side base count")・0, maximum count Ma! (Hereinafter referred to as [corrected l side maximum count])
- After counting up to T2XF, reset and repeat the timer operation again from 0 count to the corrected l side thickest count Mal.

また、補正1側最大カウントMalまでカウントすると
制御タイミング補正用タイマ(2)(以下「補正タイマ
(2)」という)+2に対して1カウントのタイムアツ
プ信号を出力する構成としている。
Furthermore, when the maximum count Mal on the correction 1 side is counted, a time-up signal of 1 count is output to the control timing correction timer (2) (hereinafter referred to as "correction timer (2)") +2.

一方、補正タイマ(2)12は上記補正タイマ(1)I
tのタイムアツプ信号をカウントとする共に、べ一スカ
ウントBa2(以下[補正2側ベースカウント」という
)・Oおよび最大カウントMa2 (補正2側最犬カウ
ント)・父として、プロセッサlの処理プログラムに基
づいて割込み処理時に現時点の設定カウントCa2(以
下「補正2側現カウント」という)を設定変更して5a
2(以下[補正2側再設定カウント」という)に再設定
する。さらに、制御タイマ5は割込み処理時に制御側現
カウントCcを処理プログラムに基づいて制御側再設定
カウントScに再設定するなお、補正2側現カウントC
a2は第2図において説明したステップ+02の割り込
み回数Teに相当する。さらに、補正タイマ(1)11
の補正1側現カウントcalは第2図にて説明したステ
ップ107の補正演算の余りRaに相当する。
On the other hand, the correction timer (2) 12 is the correction timer (1) I
In addition to using the time-up signal of t as a count, the base count Ba2 (hereinafter referred to as [correction 2 side base count]), O, and the maximum count Ma2 (correction 2 side most dog count) are added to the processing program of processor l. Based on this, the current setting count Ca2 (hereinafter referred to as "correction 2 side current count") is changed during interrupt processing and 5a
2 (hereinafter referred to as "correction 2 side reset count"). Furthermore, the control timer 5 resets the control side current count Cc to the control side reset count Sc based on the processing program during interrupt processing.
a2 corresponds to the number of interrupts Te of step +02 explained in FIG. Furthermore, correction timer (1) 11
The correction 1 side current count cal corresponds to the remainder Ra of the correction calculation in step 107 explained with reference to FIG.

上記構成の第2実施例では、第5図に示す如く、補正2
側現カウントCa2を読み出す(201)。次に、デー
タ保存メモリ2のデータエリアに補正2側現カウントC
a2刊のエラーデータを順次対応するデータエリアに格
納しく202)、入力データを収集して(203)、こ
のデータをデータ保存メモリ2のデータエリアに格納す
る(204)。続いて、補正1側現カウントCalを読
み出しく205)、次の式(11)および(12)によ
り演算処理を行なう(206)。
In the second embodiment with the above configuration, as shown in FIG.
The side count Ca2 is read out (201). Next, the correction 2 side current count C is stored in the data area of data storage memory 2.
The error data of the a2 edition is sequentially stored in the corresponding data area (202), the input data is collected (203), and this data is stored in the data area of the data storage memory 2 (204). Next, the correction 1 side current count Cal is read out (205), and arithmetic processing is performed using the following equations (11) and (12) (206).

5c=Cal+Bc−111)   5a2=O=l1
2)さらに、次の式(13)により条件が成立するか判
定する(207)。
5c=Cal+Bc-111) 5a2=O=l1
2) Furthermore, it is determined whether the condition is satisfied using the following equation (13) (207).

(Mc−5c)<TI X F−(13)この判定で、
YESの場合には上記ステップ206で求めた制御側再
設定カウントScに基づいて次の式(14)により演算
処理を行なう(208)。
(Mc-5c)<TI X F-(13) With this determination,
If YES, calculation processing is performed using the following equation (14) based on the control side reset count Sc obtained in step 206 (208).

5c=Sc−72XF−−(14) また、次の式(15)により制御側現カウントCcを上
記演算結果により再設定する(209)。
5c=Sc-72XF--(14) Furthermore, the control side current count Cc is reset based on the above calculation result using the following equation (15) (209).

CcコSc−(15) 一方、ステップ207でNoの場合には、そのまま制御
側現カウントCcを次の式(16)によりステップ20
6の演算結果により再設定する(209)。
Cc Sc-(15) On the other hand, if No in step 207, the current count Cc on the control side is changed to step 20 using the following equation (16).
It is reset based on the calculation result of step 6 (209).

Cc;Sc−(16) また、ステップ207のいずれの判定の場合も補正2側
現カウントCa2を次の式(17)により再設定する(
209)。
Cc; Sc-(16) Also, in any case of determination in step 207, the correction 2-side current count Ca2 is reset by the following equation (17) (
209).

Ca2=Sa2 ・(17) このように第2実施例では、第2図の第1実施例で説明
したステップ102で処理した割り込み回数Teを補正
タイマ(2)の補正2側現カウントCa2で読み出すこ
とができる。また、第2図のステップ107の補正演算
の余りRaの処理をステップ205の補正1側現カウン
トCalの読み出しで行うことができるようにしている
。従って、第2実施例では、プログラム処理の省略によ
り処理時間の短縮が図られる。
Ca2=Sa2 (17) In this way, in the second embodiment, the number of interrupts Te processed in step 102 explained in the first embodiment of FIG. 2 is read out using the correction 2 side current count Ca2 of the correction timer (2). be able to. Further, processing of the remainder Ra of the correction calculation in step 107 in FIG. 2 can be performed by reading out the correction 1 side current count Cal in step 205. Therefore, in the second embodiment, processing time can be shortened by omitting program processing.

なお、以上の実施例の説明では、データ処理装置の制御
タイミングの補正について説明したが、上記実施例を適
用して第6図に示すソフト処理により時計として使用し
て高精度の時刻制御が実現できる。
In addition, in the explanation of the above embodiment, correction of the control timing of the data processing device was explained, but by applying the above embodiment and using the software processing shown in FIG. 6, highly accurate time control can be realized by using it as a clock. can.

この時計は第4図に示す第2実施例からデータ処理部を
除いた構成としている。
This watch has a configuration in which the data processing section is removed from the second embodiment shown in FIG.

このプログラム処理では、補正2側現カウントCa2を
読み込み(301)、Ca2−1だけ時計の時間を進め
(302)、補正l側現カウントCalを読み出す(3
03)。
In this program processing, the correction 2 side current count Ca2 is read (301), the clock time is advanced by Ca2-1 (302), and the correction l side current count Cal is read (301).
03).

二こで、次の式(18)および(19)により演算する
(304)。
At this point, calculations are performed using the following equations (18) and (19) (304).

5c=Cal+Bc−−・(+8)   5a2=O−
119)これにより、この制御側現カウントCcおよび
補正2側現カウントCa2を次の式(20)および(2
])により再設定する(305)。
5c=Cal+Bc--(+8) 5a2=O-
119) As a result, the control side current count Cc and the correction 2 side current count Ca2 can be calculated using the following equations (20) and (2
)) (305).

をCc=Sc−(20)   Ca2=Sa2−(21
)このように、プロセッサlのプログラム処理に基づい
て制御タイマ5を設定し、割り込み処理発生に伴う時刻
のずれをハードで構成する補正タイマ(1)IIおよび
補正タイマ(2)12カウントで補正するようにしてい
る。
Cc=Sc-(20) Ca2=Sa2-(21
) In this way, the control timer 5 is set based on the program processing of the processor I, and the time difference due to the occurrence of interrupt processing is corrected by the correction timer (1) II and the correction timer (2) 12 counts, which are configured by hardware. That's what I do.

この実施例の時計の精度を考えると、次のようになる。Considering the accuracy of the clock of this embodiment, it is as follows.

即ち、ソフトウェアで設定するのは、制御タイマ5であ
り、補正用は単純にハード任せてカウントしており、カ
ウンタの誤差は発生しない。
That is, the control timer 5 is set by software, and counting is simply left to the hardware for correction, so that no counter error occurs.

従って、タイマの精度は入力周波数の精度そのものとな
る。タイマの入力周波数の誤差は、50ppmとしたと
き、1日での誤差は、60(SEC) x60(MIN
)X24(H)X50XIO″″”=4.32(SEC
)となり、およそ−般の時計のlO倍程度である。従っ
て、1日に数回程度の時刻修正で済むようになり、ラジ
オの受信機による時報によって直接時刻修正が可能とな
る。
Therefore, the accuracy of the timer is exactly the accuracy of the input frequency. When the error in the input frequency of the timer is 50 ppm, the error in one day is 60 (SEC) x 60 (MIN
)X24(H)X50XIO″″”=4.32(SEC
), which is about -10 times that of a typical clock. Therefore, the time only needs to be adjusted several times a day, and the time can be adjusted directly using the time signal from the radio receiver.

広範囲に分散するシステムの時計を同時に修正すること
が可能となり、高価な時計を実装することができない場
合も、正確な時刻が得られるようになる。
This makes it possible to simultaneously correct the clocks of widely distributed systems, making it possible to obtain accurate time even when it is not possible to implement expensive clocks.

このように、従来、ソフトウェアでの時計は、割り込み
禁止かいつどの程度の時間が発生するかの見極めが難し
く、また、精度が悪いため高精度の場合にはハードウェ
アによる別装置としての時計が使用されていたが、この
実施例によればソフトウェアによる汎用時刻制御が精度
よく実現できる。
In this way, with conventional software clocks, it is difficult to determine whether interrupts are disabled or when and how much time will occur, and the accuracy is low, so in the case of high precision, a separate hardware clock is required. However, according to this embodiment, general-purpose time control using software can be realized with high accuracy.

[発明の効果] 以上のように本発明によれば、制御タイミングのずれを
補正し制御タイミングを一定の周期とできるから時刻に
対応した信頼性の高いデータ処理ができる。また、制御
タイミングのずれによるエラーデータをデータエリアに
順次格納できるから、正確なデータの解析ができる。従
って、高価な高精度の時計を外部に備える必要もなくな
る。
[Effects of the Invention] As described above, according to the present invention, the deviation in control timing can be corrected and the control timing can be kept at a constant cycle, so that highly reliable data processing corresponding to time can be performed. Furthermore, since error data due to deviations in control timing can be sequentially stored in the data area, accurate data analysis can be performed. Therefore, there is no need to provide an expensive high-precision clock externally.

【図面の簡単な説明】[Brief explanation of the drawing]

第1図は本発明の第1実施例を示すデータ処理装置のブ
ロック構成図、第2図は同装置のプログラム処理手順を
示すフローチャート、第3図は同装置の制御タイマおよ
び補正タイマの動作を説明するため説明図、第4図は本
発明の第2実施例を示すデータ処理装置のブロック構成
図、第5図は同装置の処理手順を示すフローチャート、
第6図は時計として実施した場合の処理手順を示すフロ
ーチャート、第7図は従来例を示すデータ処理装置のブ
ロック構成図、第8図は従来例を示す同装置の動作を説
明するための説明図である。 l・・・プロセッサ、2・・・データ保存メモリ、3・
・・共有メモリ、4・・・入力部、5・・・制御タイミ
ング発生用タイマ、IO・・・制御タイミング補正用タ
イマ、11・・・制御タイミング補正用タイマ(1)、
12・・・制御タイミノ補正用タイマ(2)。
FIG. 1 is a block configuration diagram of a data processing device showing a first embodiment of the present invention, FIG. 2 is a flow chart showing the program processing procedure of the same device, and FIG. 3 is a diagram showing the operation of the control timer and correction timer of the same device. An explanatory diagram for explanation, FIG. 4 is a block configuration diagram of a data processing device showing a second embodiment of the present invention, and FIG. 5 is a flowchart showing the processing procedure of the same device.
FIG. 6 is a flowchart showing the processing procedure when implemented as a clock, FIG. 7 is a block configuration diagram of a data processing device showing a conventional example, and FIG. 8 is an explanation for explaining the operation of the device showing a conventional example. It is a diagram. l...processor, 2...data storage memory, 3.
... shared memory, 4... input section, 5... timer for control timing generation, IO... timer for control timing correction, 11... timer for control timing correction (1),
12... Control timer correction timer (2).

Claims (2)

【特許請求の範囲】[Claims] (1)クロック信号をカウントして最大カウントに達し
たとき割り込み処理信号を発生し、かつ、割り込み処理
後に再び最大カウントまで繰り返しタイマ動作をするこ
とにより一定周期で前記割り込み処理信号を発生する制
御タイマと、前記クロック信号をカウントして前記割り
込み処理時のカウントを出力する補正タイマと、この補
正タイマから出力されるカウントとこの補正タイマのベ
ースカウントと前記一定周期とに基づいて割り込み処理
禁止期間における割り込み処理信号発生回数をカウント
する手段と、 この手段のカウントに基づいてエラーデータを保存エリ
アに格納後入力データを収集する手段と、前記入力デー
タを収集後の前記補正タイマのカウントと前記補正タイ
マのベースカウントと前記一定周期とに基づいて前記制
御タイマにおける前記割り込み処理信号発生時のベース
カウントから前記入力データを収集後のカウントまでの
補正カウントを求める手段と、 前記補正カウントと前記制御タイマのベースカウントに
基づいて前記制御タイマの現カウントを再設定する手段
と、 前記補正カウントと前記補正タイマのベースカウントに
基づいて前記補正タイマの現カウントを再設定する手段
とを備えたことを特徴とするデータ処理装置。
(1) A control timer that counts clock signals and generates an interrupt processing signal when the maximum count is reached, and that generates the interrupt processing signal at a constant cycle by repeatedly operating the timer until the maximum count is reached after processing the interrupt. a correction timer that counts the clock signal and outputs the count during the interrupt processing; and a correction timer that counts the clock signal and outputs the count at the time of the interrupt processing; and a correction timer that counts the clock signal and outputs the count during the interrupt processing; means for counting the number of times an interrupt processing signal is generated; means for collecting input data after storing error data in a storage area based on the count of the means; counting the correction timer after collecting the input data; and counting the correction timer after collecting the input data. means for calculating a correction count from a base count when the interrupt processing signal is generated in the control timer to a count after collecting the input data based on the base count of the control timer and the constant period; It is characterized by comprising means for resetting the current count of the control timer based on the base count, and means for resetting the current count of the correction timer based on the correction count and the base count of the correction timer. data processing equipment.
(2)クロック信号をカウントして最大カウントに達し
たとき割り込み処理信号を発生し、かつ、割り込み処理
後に再び最大カウントまで繰り返しタイマ動作をするこ
とにより一定周期で前記割り込み処理信号を発生する制
御タイマと、前記クロック信号をカウントして最大カウ
ントに達したときカウント信号を発生し再び最大カウン
トまで繰り返しタイマ動作をする第1補正タイマと、 この第1補正タイマが発生する前記カウント信号をカウ
ントする第2補正タイマと、 この第2補正タイマのカウントに基づいて割り込み処理
禁止期間における割り込み処理信号発生回数を求める手
段と、 前記割り込み処理信号発生回数よりエラーデータを保存
エリアに格納後入力データを収集する手段と、 前記入力データを収集後の前記第1補正タイマのカウン
トと前記制御タイマのベースカウントに基づいて前記制
御タイマの現カウントを再設定する手段と、 前記第2補正タイマの現カウントを所定のベースカウン
トに再設定する手段とを備えたことを特徴とするデータ
処理装置。
(2) A control timer that counts clock signals and generates an interrupt processing signal when the maximum count is reached, and that generates the interrupt processing signal at a constant cycle by repeatedly operating the timer until the maximum count is reached after processing the interrupt. a first correction timer that counts the clock signal, generates a count signal when the maximum count is reached, and repeats the timer operation until the maximum count is reached; and a first correction timer that counts the count signal generated by the first correction timer. a second correction timer; means for determining the number of times an interrupt processing signal has been generated during the interrupt processing disabled period based on the count of the second correction timer; and collecting input data after storing error data in a storage area based on the number of times the interrupt processing signal has been generated. means for resetting the current count of the control timer based on the count of the first correction timer after collecting the input data and the base count of the control timer; and means for setting the current count of the second correction timer to a predetermined value. A data processing device comprising means for resetting the base count to the base count.
JP2329807A 1990-11-30 1990-11-30 Data processor Pending JPH04205230A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2329807A JPH04205230A (en) 1990-11-30 1990-11-30 Data processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2329807A JPH04205230A (en) 1990-11-30 1990-11-30 Data processor

Publications (1)

Publication Number Publication Date
JPH04205230A true JPH04205230A (en) 1992-07-27

Family

ID=18225469

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2329807A Pending JPH04205230A (en) 1990-11-30 1990-11-30 Data processor

Country Status (1)

Country Link
JP (1) JPH04205230A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH11110232A (en) * 1997-10-08 1999-04-23 Fujitsu Ltd Time management change device and external interrupt protection device
JP2007206008A (en) * 2006-02-06 2007-08-16 Yokogawa Electric Corp Apparatus and method for controlling cycle

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH11110232A (en) * 1997-10-08 1999-04-23 Fujitsu Ltd Time management change device and external interrupt protection device
JP2007206008A (en) * 2006-02-06 2007-08-16 Yokogawa Electric Corp Apparatus and method for controlling cycle

Similar Documents

Publication Publication Date Title
KR100687230B1 (en) Real time clock apparatus and the real time compensating method thereof
EP2369438B1 (en) Calibration method of a real time clock signal
US20180027515A1 (en) Server, method, recording medium, and system for maintaining accuracy of time
JP2007078405A (en) Timing program of software timepiece
EP0647017A1 (en) Synchronization circuit using a high speed digital slip counter
JPH03218494A (en) Clock with automatic correction of time accuracy
JP5936716B2 (en) Signal processing device
JP5556579B2 (en) Electronic device and clock correction method
JPH04205230A (en) Data processor
JP5372315B2 (en) Telemeter system slave station equipment
WO1991016670A1 (en) Method and apparatus for accurate time maintenance and display
JPS6322276B2 (en)
JP2003270369A (en) Time correction method and time correction device for real time clock
CN111897202A (en) RTC (real time clock) calibration circuit and method of smoke detector MCU (microprogrammed control Unit)
JP2017020852A (en) Embedded device
JP2924154B2 (en) Time measurement method
JP2004272403A (en) Process input/output device and monitor control system using the same
JPH1114775A (en) Method for automatically correcting display time of electronic clock
JP6814660B2 (en) A system timer and a surveying instrument equipped with the same system timer
CN110687773B (en) Method, device and system for measuring time service precision of time unification system
JP2004053428A (en) Method of acquiring flow rate data, and system for automatic meter reading
JPH09114541A (en) Interruption generation time confirming circuit and processor
JP3990331B2 (en) Time correction control circuit, time correction control method, and time correction control program
JPH04335185A (en) Timepiece
JPS599732A (en) Automatic correcting system of timer