JPH11327920A - Soft timer processing method and device therefor - Google Patents

Soft timer processing method and device therefor

Info

Publication number
JPH11327920A
JPH11327920A JP10128660A JP12866098A JPH11327920A JP H11327920 A JPH11327920 A JP H11327920A JP 10128660 A JP10128660 A JP 10128660A JP 12866098 A JP12866098 A JP 12866098A JP H11327920 A JPH11327920 A JP H11327920A
Authority
JP
Japan
Prior art keywords
count value
value
timer
initial
standby
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
JP10128660A
Other languages
Japanese (ja)
Inventor
Hiroyuki Tsuchiya
弘行 土屋
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.)
Oki Electric Industry Co Ltd
Original Assignee
Oki Electric Industry 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 Oki Electric Industry Co Ltd filed Critical Oki Electric Industry Co Ltd
Priority to JP10128660A priority Critical patent/JPH11327920A/en
Publication of JPH11327920A publication Critical patent/JPH11327920A/en
Pending legal-status Critical Current

Links

Landscapes

  • Executing Machine-Instructions (AREA)

Abstract

PROBLEM TO BE SOLVED: To provide a soft timer processing method and device for generating a fixed waiting time independent of a clock frequency in an information processor. SOLUTION: A programmable interval timer is initialized (S11) and an initial count value T1 at the point of time is fetched (S12). Then, a standby step (S13) for executing the processing of an NOP loop is performed. After a loop processing, a count value T2 after the standby of the programmable interval timer is fetched again (S14). Then, from the difference T1 -T2 of the initial count value T1 and the count value T2 after the standby, a relative count value T is obtained (S15). Then, a set value is computed as the initial value of a loop counter B.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、待ち時間を生成す
るソフトタイマ、いわゆるソフトタイマ処理方法に関す
る。
The present invention relates to a soft timer for generating a waiting time, that is, a so-called soft timer processing method.

【0002】[0002]

【従来の技術】図1に示すように、オペレーティングシ
ステムまたはオペレーティングシステム上で動作するソ
フトウェアを搭載したマイクロコンピュータ1及び規則
的な間隔でパルス信号を発するプログラマブルインター
バルタイマやリアルタイムクロックなどのハードタイマ
2を含む情報処理装置3は、入力装置3aや表示装置4
に接続され、さらに、外部装置に接続される入出力ライ
ン5及び6を有している。かかる情報処理装置3におい
て、通常、汎用または自作のオペレーティングシステム
のタイマ処理は、プログラマブルインターバルなどのハ
ードタイマ2によるタイマ割り込み回数を計測した結果
を使用している。しかし、割り込みマスク中はこのタイ
マ処理を使用できないので、ソフトタイマ処理が用いら
れる。
2. Description of the Related Art As shown in FIG. 1, a microcomputer 1 equipped with an operating system or software operating on the operating system and a hard timer 2 such as a programmable interval timer or a real-time clock for generating pulse signals at regular intervals are provided. The information processing device 3 includes an input device 3a and a display device 4
And input / output lines 5 and 6 connected to an external device. In such an information processing apparatus 3, the timer processing of a general-purpose or self-made operating system usually uses the result of counting the number of timer interrupts by the hard timer 2 such as a programmable interval. However, since this timer processing cannot be used during interrupt masking, soft timer processing is used.

【0003】ソフトタイマ処理は、命令を所定回数だけ
繰り返してCPU(central processing unit)に処理
いわゆるループ処理させ、待ち時間を生成する方法であ
る。ソフトタイマ処理では、例えばオペレーティングシ
ステムにおいて、CPUのクロック周波数及びループ処
理に係わる命令の全クロックサイクル数から予め固定値
を持つように、ループカウンタを設定し、そのループ処
理をCPUに処理させ、1回のループ処理にかかる命令
のクロックサイクル数及びクロック周期の積を単位待ち
時間として、そのループ処理の繰り返すことにより、待
ち時間を得ている。このように、ソフトタイマ処理は、
特定のCPUのクロック周波数に合わせて予めカウンタ
の値を固定して設定されている。
The soft timer process is a method of generating a waiting time by repeating a command a predetermined number of times and causing a CPU (central processing unit) to perform a so-called loop process. In the soft timer process, for example, in the operating system, a loop counter is set so as to have a fixed value in advance from the clock frequency of the CPU and the total number of clock cycles of the instruction related to the loop process, and the loop process is processed by the CPU. The waiting time is obtained by repeating the loop processing with the product of the number of clock cycles and the clock cycle of the instruction pertaining to the loop processing as a unit waiting time. Thus, the soft timer process is
The value of the counter is fixed and set in advance in accordance with the clock frequency of a specific CPU.

【0004】[0004]

【発明が解決しようとする課題】例えば、あるクロック
周波数のCPUに適するように2つのI/O命令の間に
例えば10ミリ秒の待ち時間を保証するソフトタイマ処
理を含むユーザソフトウェアを、CPUのクロック周波
数が2倍の他の情報処理装置で動作させた場合、割り込
みマスク中のI/O命令とI/O命令の間にソフトタイ
マ処理を行うと、その結果は、5ミリ秒となり、正確な
I/O制御ができなくなり、動作が保証できなくなる。
このように、従来のソフトタイマ処理方法では、ソフト
ウェアを搭載する装置のCPUのクロック周波数によっ
て待ち時間が変動することになる。
For example, user software including a soft timer process for guaranteeing a wait time of, for example, 10 milliseconds between two I / O instructions so as to be suitable for a CPU having a certain clock frequency is provided by the CPU. When the clock frequency is operated by another information processing device having twice the clock frequency, if the soft timer processing is performed between the I / O instructions in the interrupt mask, the result is 5 milliseconds, which is accurate. I / O control cannot be performed, and operation cannot be guaranteed.
As described above, in the conventional soft timer processing method, the waiting time varies depending on the clock frequency of the CPU of the device in which the software is installed.

【0005】そこで、オペレーティングシステムまたは
オペレーティングシステム上で動作するソフトウェアを
搭載したマイクロコンピュータ及びハードタイマを含む
情報処理装置において、CPUのクロック周波数にかか
わらず、生成される待ち時間が一定のソフトタイマ処理
方法が望まれている。
Therefore, in an information processing apparatus including a microcomputer equipped with an operating system or software operating on the operating system and a hard timer, a soft timer processing method in which a generated waiting time is constant regardless of a CPU clock frequency. Is desired.

【0006】[0006]

【課題を解決するための手段】本発明のソフトタイマ処
理方法は、固定クロックにて動作するハードタイマを初
期化してそのときのハードタイマの初期のカウント値を
取り込む初期化ステップと、ソフトタイマの待機動作を
実行する待機ステップと、待機ステップの直後における
ハードタイマの待機後のカウント値を取り込む取込ステ
ップと、初期のカウント値と待機後のカウント値との差
に基づいて設定値を演算する演算ステップと、設定値を
初期値としてソフトタイマのカウンタを初期化するステ
ップと、からなる初期タイマ設定処理を有している。ま
た、本発明のソフトタイマ処理方法は、ソフトタイマの
カウンタを固定クロックとは独立のクロックパルス毎に
所定数だけカウントアップもしくはカウントダウンし
て、ソフトタイマのカウント値が所定値に達した時タイ
ムアップと判別する判別ステップと、からなるソフトタ
イマ処理を有している。
A soft timer processing method according to the present invention comprises: an initialization step of initializing a hard timer operating at a fixed clock and taking in an initial count value of the hard timer at that time; A standby step for performing a standby operation, an acquisition step for capturing a count value of the hard timer immediately after the standby step after the standby, and a setting value is calculated based on a difference between the initial count value and the count value after the standby. It has an initial timer setting process including a calculation step and a step of initializing a counter of the soft timer using the set value as an initial value. Also, the soft timer processing method of the present invention counts up or counts down a counter of the soft timer by a predetermined number for each clock pulse independent of the fixed clock, and counts up when the count value of the soft timer reaches the predetermined value. And a determining step of determining the soft timer.

【0007】さらに本発明の情報処理装置は、ソフトタ
イマを搭載した情報処理装置であって、固定クロックに
て動作するハードタイマを初期化してそのときのハード
タイマの初期のカウント値を取り込む初期化手段と、待
機動作を実行する待機手段と、待機手段の直後における
ハードタイマの待機後のカウント値を取り込む取込手段
と、初期のカウント値と待機後のカウント値との差に基
づいて設定値を演算する演算手段と、設定値を初期値と
してソフトタイマのカウンタを初期化する手段と、ソフ
トタイマのカウンタを固定クロックとは独立のクロック
パルス毎に所定数だけカウントアップもしくはカウント
ダウンして、ソフトタイマのカウント値が所定値に達し
た時タイムアップと判別する判別手段と、を有する。
Further, the information processing apparatus of the present invention is an information processing apparatus equipped with a soft timer, which initializes a hard timer that operates with a fixed clock and takes in an initial count value of the hard timer at that time. A standby means for performing a standby operation; a capture means for capturing a count value of the hard timer immediately after the standby means after the standby; and a setting value based on a difference between the initial count value and the count value after the standby. A means for initializing the soft timer counter using the set value as an initial value, and a counter for counting up or down a predetermined number of the soft timer counter by a predetermined number of clock pulses independent of the fixed clock. Determining means for determining that the time is up when the count value of the timer reaches a predetermined value.

【0008】[0008]

【作用】本発明によれば、ソフトタイマ処理の処理時間
をハードタイマにより予め計測した結果に基づき、ソフ
トタイマカウンタに初期値を与えるので、同一のソフト
タイマ処理ルーチンによって、CPUのクロック周波数
の違う装置に対しても所望の待ち時間を提供できる。
According to the present invention, the initial value is given to the soft timer counter based on the result of previously measuring the processing time of the soft timer processing by the hard timer, so that the clock frequency of the CPU differs depending on the same soft timer processing routine. A desired waiting time can also be provided for the device.

【0009】[0009]

【発明の実施の形態】以下、本発明の実施例を図面を参
照しつつ説明する。図2は第1の実施例のソフトタイマ
処理方法を示し、初期タイマ設定処理(S1)及びソフ
トタイマ処理(S2)からなる。まず、例えばオペレー
ティングシステムが立ち上がり時に、初期タイマ設定処
理(S1)を行う。初期タイマ設定処理(S1)により
得られた設定値を初期値としてソフトタイマを設定して
ソフトタイマ処理(S2)を実行する ソフトタイマ処理(S2)のルーチンは、例えば、図3
に示すように、CPUが何も動作しない命令NOP(非
動作のニーモニックコード:no-operation)を繰り返す
ループ処理(以下、NOPループともいう)である。ル
ープカウンタの働きをさせる汎用レジスタ(以下、カウ
ンタBともいう)に、予めある初期値を入れておき、N
OPループでは、このカウンタBの値Bが0になるまで
デクリメントを繰り返すことによって、待ち時間を得
る。
Embodiments of the present invention will be described below with reference to the drawings. FIG. 2 shows a soft timer processing method according to the first embodiment, which comprises an initial timer setting process (S1) and a soft timer process (S2). First, for example, when the operating system starts up, an initial timer setting process (S1) is performed. The soft timer process (S2) is performed by setting a soft timer with the setting value obtained by the initial timer setting process (S1) as an initial value and executing the soft timer process (S2).
As shown in (1), a loop process (hereinafter also referred to as a NOP loop) that repeats an instruction NOP (no-operation mnemonic code: no-operation) in which the CPU does nothing. A certain initial value is previously stored in a general-purpose register (hereinafter, also referred to as a counter B) that functions as a loop counter.
In the OP loop, a waiting time is obtained by repeating the decrement until the value B of the counter B becomes zero.

【0010】図3に示すように、CPUのクロック周波
数及びNOPのクロックサイクル数から求めた固定値、
例えば10に、カウンタBを設定し(S21)、NOP
をCPUに処理させ(S22)、カウンタBの値Bを1
だけ減じ(S23)、カウンタBの値Bが0に達するか
否かを判断し(S24)、Bが0になるまでループ処理
を行ってNOP10個の処理時間を待ち時間として得て
いる。なお、カウンタBの値Bが0になるまでデクリメ
ントを繰り返すことの他に、ループを形成するために、
値Bが設定値になるまでインリメントを繰り返す処理で
もよい。
As shown in FIG. 3, a fixed value obtained from the clock frequency of the CPU and the number of clock cycles of the NOP,
For example, the counter B is set to 10 (S21), and the NOP
Is processed by the CPU (S22), and the value B of the counter B is set to 1
(S23), it is determined whether the value B of the counter B reaches 0 (S24), and the loop processing is performed until B becomes 0 to obtain 10 NOP processing times as the waiting time. In addition, in addition to repeating decrement until the value B of the counter B becomes 0, in order to form a loop,
The processing may be repeated until the value B reaches the set value.

【0011】そこで、所定の待ち時間を得るために、カ
ウンタBに入れる初期値をどのように設定すべきかを説
明する。すなわち、NOPループについて、所望の待ち
時間すなわち命令の実行時間Wに対応する初期値xを求
めるのである。図3において、ステップ21の命令の実
行に要する時間をt'秒及びその他のステップに要する
全時間をt秒とすると、ソフトタイマ処理に要する命令
の実行時間W秒はW=t'+t×xとなる。
Therefore, how to set an initial value to be entered in the counter B in order to obtain a predetermined waiting time will be described. That is, for the NOP loop, an initial value x corresponding to a desired waiting time, that is, an instruction execution time W is obtained. In FIG. 3, assuming that the time required for executing the instruction in step 21 is t ′ seconds and the total time required for the other steps is t seconds, the execution time W seconds for the instruction required for the soft timer process is W = t ′ + t × x Becomes

【0012】ただし、t'≪t×xなので、t'は無視で
きる。よって、W=t×xを満足するようなxを求めれ
ば良い。xを求めるには先ずtの値を求める。このt
は、NOPの処理時間(S22)、カウンタBをデクリ
メントするのに要する時間(S23)、カウンタの値が
0かどうかを判断するのに要する時間及びループの先頭
へジャンプするのに要する時間(S24)を合計したも
のになる。
However, since t′≪t × x, t ′ can be ignored. Therefore, x that satisfies W = t × x may be obtained. To determine x, first, the value of t is determined. This t
Are the NOP processing time (S22), the time required to decrement the counter B (S23), the time required to determine whether the counter value is 0, and the time required to jump to the beginning of the loop (S24). ).

【0013】各命令に要する時間は、CPUは外部から
与えられるクロックに同期して動作するから、各命令ご
とに、いくつのクロック入力で実行し終えるのかが決ま
っている。よって、1回のループに要する時間tは、C
PUのクロック周波数fと全命令の実行に要するクロッ
クサイクル数とから求めることができる。すなわち、C
PUに与えるクロック周波数をfとし、処理に必要な全
クロックサイクル数をCCLとすると、1回のループ処理
に要する時間tは、(クロック周期τ=1/f)×(C
CL)によって得られる。
The time required for each instruction is such that the CPU operates in synchronization with an externally supplied clock, and therefore, for each instruction, it is determined how many clock inputs will end the execution. Therefore, the time t required for one loop is C
It can be obtained from the clock frequency f of the PU and the number of clock cycles required to execute all instructions. That is, C
Assuming that the clock frequency given to the PU is f and the total number of clock cycles required for processing is C CL , the time t required for one loop processing is (clock cycle τ = 1 / f) × (C
CL ).

【0014】従って、設定すべき初期値xは、Therefore, the initial value x to be set is:

【0015】[0015]

【数3】x=W/t=W/τ×CCL=f×W/CCL から、得られる。このようにして、特定のCPUのため
にカウンタBに入れる固定の初期値xが設定される。こ
こでは固定初期値に10を設定してある。なお、ソフト
タイマ処理において、NOPに代えてレジスタリードな
どの命令を実行させるループ処理としてもよい。また、
ソフトタイマ処理は待ち時間を得る待機動作を実行する
ものであれば、NOPを用いないループ処理でもよい。
X = W / t = W / τ × C CL = f × W / C CL In this way, a fixed initial value x to be put into the counter B for a specific CPU is set. Here, 10 is set as the fixed initial value. In the soft timer process, a loop process for executing an instruction such as a register read instead of the NOP may be performed. Also,
The soft timer process may be a loop process that does not use the NOP as long as it performs a standby operation for obtaining a wait time.

【0016】図4は図2の初期タイマ設定処理(S1)
のルーチンを示す。図4に示すように、初期タイマ設定
処理は、プログラマブルインターバルタイマの初期化を
行い(S11)、その時点のプログラマブルインターバ
ルタイマの初期のカウント値T1を取り込む(S1
2)。次に、上記NOPループの処理を実行する待機ス
テップ(S13)を行う。ループ処理後、再度、プログ
ラマブルインターバルタイマの待機後のカウント値T2
を取り込む(S14)。次に、初期のカウント値T1
待機後のカウント値T2との差分、T1−T2から相対カ
ウント値Tを得る(S15)。つまり、プログラマブル
インターバルタイマのクロックサイクル数より、NOP
の10個の実測値を得ている。
FIG. 4 shows the initial timer setting process (S1) of FIG.
The following shows the routine. As shown in FIG. 4, the initial timer setting process initializes the programmable interval timer (S11), captures the initial count value T 1 of the programmable interval timer at that time (S1
2). Next, a standby step (S13) for executing the processing of the NOP loop is performed. After the loop processing, the count value T 2 after the standby of the programmable interval timer is returned again.
Is taken in (S14). Then, the initial count value T 1 and the difference between the count value T 2 of the post waiting from T 1 -T 2 obtain relative count value T (S15). That is, NOP is calculated from the number of clock cycles of the programmable interval timer.
Are obtained.

【0017】次に、ループカウンタBの初期値として設
定値xTGを演算する。すなわち、相対カウント値をT、
所望の待ち時間をW、プログラマブルインターバルタイ
マのクロック周波数をfTMとすると、設定値xTGは、
Next, a set value xTG is calculated as an initial value of the loop counter B. That is, the relative count value is T,
The desired latency W, when the clock frequency of the programmable interval timer and f TM, set value x TG is

【0018】[0018]

【数4】xTG=fTM×W/T から得られる。その設定値xTGをループカウンタBに転
送して更新する(S16)。例えば、プログラマブルイ
ンターバルタイマが2MHzのクロック周波数で動作す
るとすると、クロック周期(τ=1/fTM )は0.5
×10-6秒であるから、プログラマブルインターバルタ
イマの相対カウント値Tが100カウントであったとす
ると、NOPループの実測値は、0.5×10-6秒×1
00=50×10-6秒、すなわち、50マイクロ秒とな
る。
X TG = f TM × W / T The set value x TG is transferred to the loop counter B and updated (S16). For example, if the programmable interval timer operates at a clock frequency of 2 MHz, the clock cycle (τ = 1 / f ) is 0.5
Since a × 10 -6 seconds, the relative count value T of the programmable interval timer is assumed to be 100 counts, measured values of NOP loops, 0.5 × 10 -6 seconds × 1
00 = 50 × 10 −6 seconds, that is, 50 microseconds.

【0019】この相対カウント値Tを使用して、ループ
カウンタBを設定する。実測値が50マイクロ秒である
ことより、所望の待ち時間W=1ミリ秒(=1×10-3
秒)単位のソフトタイマ処理を作成したいとすると、
1:50×10-6=xTG:1×10-3から、ループカウ
ンタBはの初期値としての設定値xTGが20となる。な
お、上記実施例ではプログラマブルインターバルタイマ
を用いて初期タイマ設定処理を実行した場合を説明した
が、CPUのクロックとは独立な固定クロックにて動作
するリアルタイムクロックをも利用できる。
Using the relative count value T, a loop counter B is set. Since the measured value is 50 microseconds, the desired waiting time W = 1 millisecond (= 1 × 10 −3)
If you want to create a soft timer process in seconds)
1: 50 × 10 −6 = x TG : 1 × 10 −3 , the set value x TG of the loop counter B as an initial value becomes 20. In the above embodiment, the case where the initial timer setting process is performed using the programmable interval timer has been described, but a real-time clock operating with a fixed clock independent of the CPU clock can also be used.

【0020】図5に示すように、オペレーティングシス
テムのソフトタイマ(S2)を呼び出す場合、関数コー
ルを用いてユーザソフトウエアからタイマサブルーチン
として利用する。このソフトタイマ処理を実際のソフト
ウェアより関数コールするが、このときの引数をループ
カウンタAに設定し使用する(S31)。図5に示すよ
うに、このタイマサブルーチンは、NOPループとルー
プbの二重ループ構造になっている。
As shown in FIG. 5, when the soft timer (S2) of the operating system is called, it is used as a timer subroutine from the user software using a function call. The function of this soft timer process is called from actual software, and the argument at this time is set and used in the loop counter A (S31). As shown in FIG. 5, this timer subroutine has a double loop structure of a NOP loop and a loop b.

【0021】また、ループbは、メインプログラムで与
えられるループカウンタAの値の回数だけ、所望の待ち
時間W=11ミリ秒を繰り返すために用いる。たとえ
ば、メインルーチンでA=30に設定しておいて、この
サブルーチンをコールすると、1ミリ秒×30=30ミ
リ秒となり、30ミリ秒間の待ち時間が得られる。ただ
し、ステップS31、S32及びS33の命令の実行に
要する合計時間が、ステップS13に比して無視できる
短い時間とする。
The loop b is used to repeat the desired waiting time W = 11 milliseconds by the number of times of the value of the loop counter A given by the main program. For example, if A = 30 is set in the main routine and this subroutine is called, 1 ms × 30 = 30 ms, and a waiting time of 30 ms is obtained. However, the total time required to execute the instructions in steps S31, S32, and S33 is a short time that can be ignored compared to step S13.

【0022】この実施例によれば、ループカウンタすな
わちソフトタイマカウンタの初期値をCPUのクロック
周波数に応じて調整するので、CPUのクロック周波数
の違う装置においても一定の待ち時間を得ることができ
る。なお、初期タイマ設定処理とソフトタイマ処理のル
ーチンは、一挙に実行される一連のプログラムに含まれ
ている必要はないことは明らかである。
According to this embodiment, since the initial value of the loop counter, that is, the soft timer counter is adjusted according to the clock frequency of the CPU, a constant waiting time can be obtained even in a device having a different clock frequency of the CPU. It is obvious that the routines of the initial timer setting process and the soft timer process do not need to be included in a series of programs executed at once.

【0023】[0023]

【発明の効果】以上のように、本発明によれば、従来の
如きソフトタイマ処理のカウンタの値を手作業で変更せ
ずに、CPU速度の違う装置においても、同一のソフト
タイマ処理ルーチンによって一定の待ち時間を生成する
ことを保証できる。
As described above, according to the present invention, the same soft timer processing routine can be used in a device having a different CPU speed without manually changing the counter value of the conventional soft timer processing. It can guarantee that a certain waiting time is generated.

【図面の簡単な説明】[Brief description of the drawings]

【図1】情報処理装置を示す構成図。FIG. 1 is a configuration diagram illustrating an information processing apparatus.

【図2】本発明の第1実施例のソフトウェア処理方法を
示すフロー図。
FIG. 2 is a flowchart showing a software processing method according to the first embodiment of the present invention.

【図3】本発明のソフトタイマ処理を示すフロー図。FIG. 3 is a flowchart showing a soft timer process of the present invention.

【図4】本発明の初期タイマ設定処理を示すフロー図。FIG. 4 is a flowchart showing an initial timer setting process of the present invention.

【図5】本発明の他の実施例を示すフロー図。FIG. 5 is a flowchart showing another embodiment of the present invention.

【符号の説明】[Explanation of symbols]

1 マイクロコンピュータ 2 ハードタイマ 3 情報処理装置 3a 入力装置 4 表示装置 5 入力ライン 6 出力ライン S1 初期タイマ設定処理ステップ S2 ソフトタイマ処理ステップ S11 ハードタイマの初期化ステップ S12 初期カウント値取込ステップ S13 待機ステップ S14 待機後カウント値取込ステップ S15 相対カウント値演算ステップ S16 設定値演算及び初期値更新ステップ S21 カウンタ設定ステップ S22 NOP処理ステップ S23 カウンタBデクリメントステップ S24 カウンタB判断ステップ Reference Signs List 1 microcomputer 2 hard timer 3 information processing device 3a input device 4 display device 5 input line 6 output line S1 initial timer setting processing step S2 soft timer processing step S11 hard timer initialization step S12 initial count value acquisition step S13 standby step S14 Step of acquiring count value after standby S15 Step of calculating relative count value S16 Step of calculating set value and updating initial value S21 Counter setting step S22 NOP processing step S23 Counter B decrement step S24 Counter B judgment step

Claims (4)

【特許請求の範囲】[Claims] 【請求項1】 ソフトタイマ処理方法であって、 固定クロックにて動作するハードタイマカウンタを初期
化してそのときの前記ハードタイマカウンタの初期カウ
ント値を取り込む初期化ステップと、 待機動作を実行する待機ステップと、 前記待機ステップの直後における前記ハードタイマカウ
ンタの待機後のカウント値を取り込む取込ステップと、 前記初期のカウント値と前記待機後のカウント値との差
に基づいて設定値を演算する演算ステップと、 前記設定値を初期値としてソフトタイマカウンタを初期
化するステップと、 前記ソフトタイマカウンタを前記固定クロックとは独立
のクロックパルス毎に所定数だけカウントアップもしく
はカウントダウンして、前記ソフトタイマカウンタのカ
ウント値が所定値に達した時タイムアップと判別して所
定待ち時間を得る判別ステップと、からなることを特徴
とするソフトタイマ処理方法。
1. A soft timer processing method, comprising: an initialization step of initializing a hard timer counter operating at a fixed clock and taking in an initial count value of the hard timer counter at the time; and a standby for executing a standby operation. And a capturing step of capturing a count value of the hard timer counter immediately after the standby step immediately after the standby step; and an operation of calculating a set value based on a difference between the initial count value and the count value after the standby. Initializing the soft timer counter with the set value as an initial value; counting up or down a predetermined number of the soft timer counter for each clock pulse independent of the fixed clock; When the count value of the And a determining step of obtaining a predetermined waiting time separately.
【請求項2】 前記演算ステップにおいては、前記初期
カウント値と前記待機後のカウント値との差を相対カウ
ント値Tとしかつ前記設定値をxTGとすると、前記演算
ステップは、次式、 【数1】xTG=fTM×W/T (上記式中、Wが前記所定待ち時間を示し、fTMが前記
ハードタイマのクロック周波数を示す)により演算する
ことを特徴とする請求項1記載のソフトタイマ処理方
法。
In wherein said computing step, when the relative count value T Toshikatsu the set value the difference between the count value after the waiting and the initial count value and x TG, the calculating step, the following equation, [ 2. The calculation according to claim 1, wherein x TG = f TM × W / T (where W represents the predetermined waiting time and f TM represents the clock frequency of the hard timer). Soft timer processing method.
【請求項3】 ソフトタイマ処理装置であって、 固定クロックにて動作するハードタイマと、 前記ハードタイマを初期化してそのときの前記ハードタ
イマの初期のカウント値を取り込む初期化手段と、 待機動作を実行する待機手段と、 前記待機手段の直後における前記ハードタイマカウンタ
の待機後のカウント値を取り込む取込手段と、 前記初期のカウント値と前記待機後のカウント値との差
に基づいて設定値を演算する演算手段と、 前記設定値を初期値としてソフトタイマカウンタを初期
化する手段と、 前記ソフトタイマカウンタを前記固定クロックとは独立
のクロックパルス毎に所定数だけカウントアップもしく
はカウントダウンして、前記ソフトタイマのカウント値
が所定値に達した時タイムアップと判別して所定待ち時
間を得る判別手段と、を有することを特徴とする情報処
理装置。
3. A soft timer processing device, comprising: a hard timer that operates on a fixed clock; initialization means for initializing the hard timer and capturing an initial count value of the hard timer at that time; A capturing unit that captures a post-wait count value of the hard timer counter immediately after the standby unit; and a set value based on a difference between the initial count value and the post-wait count value. And a means for initializing a soft timer counter with the set value as an initial value, and counting up or down a predetermined number of the soft timer counter for each clock pulse independent of the fixed clock, When the count value of the soft timer reaches a predetermined value, it is determined that the time is up and a predetermined waiting time is obtained. The information processing apparatus characterized by having a separate unit.
【請求項4】 前記演算手段は、前記初期のカウント値
と前記待機後のカウント値との差を相対カウント値Tと
しかつ前記設定値をxTGとすると、前記演算手段は、次
式、 【数2】xTG=fTM×W/T (上記式中、Wが前記所定待ち時間を示し、fTMが前記
ハードタイマのクロック周波数を示す)により演算する
ことを特徴とする請求項3記載の情報処理装置。
Wherein said calculating means, when the relative count value T Toshikatsu the set value the difference between the count value after the waiting count value of the initial and x TG, said computing means, the following equation, [ 4. The calculation according to claim 3, wherein x TG = f TM × W / T (where W indicates the predetermined waiting time and f TM indicates the clock frequency of the hard timer). Information processing device.
JP10128660A 1998-05-12 1998-05-12 Soft timer processing method and device therefor Pending JPH11327920A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP10128660A JPH11327920A (en) 1998-05-12 1998-05-12 Soft timer processing method and device therefor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP10128660A JPH11327920A (en) 1998-05-12 1998-05-12 Soft timer processing method and device therefor

Publications (1)

Publication Number Publication Date
JPH11327920A true JPH11327920A (en) 1999-11-30

Family

ID=14990307

Family Applications (1)

Application Number Title Priority Date Filing Date
JP10128660A Pending JPH11327920A (en) 1998-05-12 1998-05-12 Soft timer processing method and device therefor

Country Status (1)

Country Link
JP (1) JPH11327920A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2016143402A (en) * 2015-02-05 2016-08-08 富士通株式会社 Timer control device, radio communication device and timer control method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2016143402A (en) * 2015-02-05 2016-08-08 富士通株式会社 Timer control device, radio communication device and timer control method

Similar Documents

Publication Publication Date Title
JPS63163912A (en) Microcomputer system
JPS6019028B2 (en) information processing equipment
JPH11327920A (en) Soft timer processing method and device therefor
JPH1011333A (en) Measuring instrument for cpu use rate by task
WO2009026361A2 (en) Method, system and apparatus for measuring an idle value of a central processing unit
JPH05233277A (en) Microprocessor
KR950013602B1 (en) Frequency measuring device
JPH04245332A (en) Data processor
JPS63217425A (en) Automatic loop adjusting system
JPH04287226A (en) Clock-operated data processor
JPH0573296A (en) Microcomputer
JPS6128144A (en) Executing device of tracing
JPH05134868A (en) Soft timer control method
JPS6027960A (en) Measuring method of use rate of processor
JP3638505B2 (en) Simulation apparatus and software simulation method for microprocessor
JPS63269239A (en) Processor load measuring system
JPH09114541A (en) Interruption generation time confirming circuit and processor
JP2675226B2 (en) Timing adjustment method
JPH0683652A (en) Microcomputer system
JPH06168115A (en) No operation continuing step intructing system for arithmetic processor
JPH07210388A (en) Fuzzy computer
JPH0782370B2 (en) Sequencer timer processor
JPH04320547A (en) Overhead time measuring system for time setting procedure
JPH1185684A (en) I/o access control circuit
JPH04320548A (en) Execution unit load analyzing system