JP5331451B2 - Microcontroller - Google Patents
Microcontroller Download PDFInfo
- Publication number
- JP5331451B2 JP5331451B2 JP2008288805A JP2008288805A JP5331451B2 JP 5331451 B2 JP5331451 B2 JP 5331451B2 JP 2008288805 A JP2008288805 A JP 2008288805A JP 2008288805 A JP2008288805 A JP 2008288805A JP 5331451 B2 JP5331451 B2 JP 5331451B2
- Authority
- JP
- Japan
- Prior art keywords
- interrupt
- cpu
- priority
- request
- signal
- 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.)
- Expired - Fee Related
Links
Images
Description
本発明は、CPUを備えたマイクロコントローラに関する。 The present invention relates to a microcontroller including a CPU.
従来より、CPUを備え、要求された割り込み処理を行うとともに、この割り込み処理の実行時間を監視するマイクロコントローラが知られている。 2. Description of the Related Art Conventionally, a microcontroller that includes a CPU and performs requested interrupt processing and monitors the execution time of the interrupt processing is known.
例えば、特許文献1には、割り込み許可信号が‘0’(割り込みディセーブル状態)になったときからタイマ動作を開始し、タイマによる経過時間が監視時間値を超えたときに、監視時間超過信号を発生する技術が提案されている。この技術によれば、割り込み禁止状態が続いていることを感知して、使用者やプログラムに注意を喚起することができる。 For example, in Patent Document 1, a timer operation is started when an interrupt permission signal becomes “0” (interrupt disabled state), and when the elapsed time by the timer exceeds the monitoring time value, the monitoring time excess signal A technique for generating the above has been proposed. According to this technology, it is possible to alert the user and the program by detecting that the interrupt disabled state continues.
また、特許文献2には、実行優先順位とともに実行時間が設定された各アプリケーションタスクの実行時間を実行時間監視部が監視し、実行時間が超過したことを検出したならば、優先順位変更部を起動して現在実行中のアプリケーションタスクの実行優先順位を下げる技術が提案されている。この技術によれば、障害が発生したタスクは優先順位が下げられるため、他の正常なタスクの実行周期に影響を与えずにシステムを正常に稼働することができる。
一般に、CPUを備えたマイクロコントローラにおいて、割り込みイネーブル状態で割り込み要求信号が受け付けられると、割り込みルーチンが起動されて割り込み処理が行なわれる。この割り込みルーチン実行時に、割り込みイネーブル状態であれば、さらに他の割り込みが受け付け可能であり(これを多重割り込みと称する)、一方割り込みディセーブル状態であれば、さらなる他の割り込みは受け付け不可となる。 In general, in a microcontroller provided with a CPU, when an interrupt request signal is accepted in an interrupt enabled state, an interrupt routine is started and interrupt processing is performed. When this interrupt routine is executed, if another interrupt is enabled, another interrupt can be accepted (this is referred to as a multiple interrupt). On the other hand, if another interrupt is disabled, no other interrupt can be accepted.
一般的なマイクロコントローラでは、割り込みイネーブル状態で割り込みを受け付けた場合、自動的に割り込みディセーブルの状態となるため、多重割り込みを許可するためには、明示的にソフトウェアにより割り込みルーチン内で割り込みイネーブル操作を行なう必要がある。 In general microcontrollers, when an interrupt is accepted in the interrupt enable state, the interrupt is automatically disabled. Therefore, to enable multiple interrupts, the interrupt enable operation must be performed explicitly in the interrupt routine by software. It is necessary to do.
ここで、多重割り込みを許可しない場合であって、予定以上に長時間にわたり処理が実行されている場合(割り込みルーチンから処理が抜け出せない状態に陥った場合等)、他の割り込み処理を行なうことはできず、その結果システム全体のパフォーマンスに支障が生じるという問題が発生する。換言すれば、ある処理に許される応答時間が規定されている場合、ある割り込みが発生した後に、その規定されている応答時間以内でその処理が開始されないと、システム全体が破綻してしまうという問題が発生する。 Here, when multiple interrupts are not permitted and processing has been executed for a longer time than planned (for example, when processing cannot escape from the interrupt routine), other interrupt processing is performed. This results in a problem that the performance of the entire system is hindered. In other words, if a response time allowed for a certain process is specified, the entire system will fail if the process is not started within the specified response time after an interrupt occurs. Will occur.
そこで、前記特許文献1では、タイマによる経過時間が監視時間値を超えたときに注意を喚起することが提案されている。しかし、特許文献1では、使用者やプログラムによる対処を求めるために注意を喚起するのみであり、マイクロコントローラが割り込みディセーブル状態を解除することは無い。 Therefore, in Patent Document 1, it is proposed to call attention when the elapsed time by the timer exceeds the monitoring time value. However, in Patent Document 1, attention is only given to request a countermeasure by the user or a program, and the microcontroller does not release the interrupt disabled state.
また、マイクロコントローラの中には、要因ごとに優先順位が設定された割り込み処理の要求を受信し、そのマイクロコントローラに備えられたCPUで実行中の割り込み処理よりも高い優先順位を有する割り込み処理の要求を受信したときに、その要求を受け付け、CPUに対してその受け付けた割り込み処理の起動を要求する割り込みコントローラを備えたものがある。この割り込みコントローラでは、優先順位の高い割り込み要因による割り込みサービスを実行している場合、この割り込み要因よりも低い優先順位の割り込みを受け付けることはない。このため、優先順位の低い割り込み要因は、優先順位の高い割り込み処理が完了するまで、待たなければならない。 Also, some microcontrollers receive interrupt processing requests with priorities set for each factor, and interrupt processing having higher priority than interrupt processing being executed by the CPU provided in the microcontroller. Some have an interrupt controller that receives the request and requests the CPU to start the accepted interrupt process when the request is received. In this interrupt controller, when an interrupt service is executed by an interrupt factor having a higher priority, an interrupt having a lower priority than the interrupt factor is not accepted. For this reason, an interrupt factor with a low priority must wait until the interrupt process with a high priority is completed.
従って、例えば、優先順位の高い割り込みルーチン内で何らかの問題が発生し、想定以上の長時問、CPUで実行されている処理がこのルーチンから抜け出せない状態に陥った場合、優先順位の低い割り込み処理を行なうことができず、その結果システム全体のパフォーマンスに支障が生じるという問題がある。 Therefore, for example, if a problem occurs in an interrupt routine with a high priority, and if the problem is longer than expected, or if the processing being executed by the CPU is not able to escape from this routine, the interrupt process with a low priority is performed. As a result, there is a problem that the performance of the entire system is hindered.
前記特許文献2では、実行時間が超過したときに、現在実行中のアプリケーションタスクの実行優先順位を下げる技術が提案されている。しかしながら、現在実行中に割り込みルーチンの優先順位を下げたとしても、割り込みディセーブル状態が継続している限りは、他の割込処理を行うことはできない。 Patent Document 2 proposes a technique for lowering the execution priority of an application task that is currently being executed when the execution time has exceeded. However, even if the priority of the interrupt routine is lowered during the current execution, other interrupt processing cannot be performed as long as the interrupt disabled state continues.
本発明は、上記事情に鑑み、システム全体のパフォーマンスを高めることができるマイクロコントローラを提供することを目的とする。 In view of the above circumstances, an object of the present invention is to provide a microcontroller that can improve the performance of the entire system.
上記目的を達成する本発明のマイクロコントローラは、
CPUを備えたマイクロコントローラであって、
要求された割り込み処理の起動が禁止された割り込みディセーブル状態と、要求された割り込み処理の起動が許可された割り込みイネーブル状態とを有し、
上記CPUにおいて実行中の割り込み処理の継続時間を計測するタイマと、そのタイマが計測した継続時間が所定値を超えたときに、上記CPUを割り込みディセーブル状態から割り込みイネーブル状態に変化させる割り込みイネーブル変更信号を生成する割り込み制御部を備えたことを特徴とする。
The microcontroller of the present invention that achieves the above object provides:
A microcontroller with a CPU,
An interrupt disabled state in which activation of the requested interrupt processing is prohibited, and an interrupt enable state in which activation of the requested interrupt processing is permitted,
A timer that measures the duration of interrupt processing being executed in the CPU, and an interrupt enable change that changes the CPU from an interrupt disabled state to an interrupt enabled state when the duration measured by the timer exceeds a predetermined value An interrupt control unit for generating a signal is provided.
本発明のマイクロコントローラは、CPUにおいて実行中の割り込み処理の継続時間が所定値を超えたときに、上記CPUを割り込みディセーブル状態から割り込みイネーブル状態に変化させる構成である。この構成によれば、CPUが割り込みディセーブル状態であるか割り込みイネーブル状態であるかに拘わらず、CPUを割り込みイネーブル状態に変化させることができる。従って、例えば、多重割り込みを許可しない割り込みルーチン内で何らかの問題が発生し、長時間にわたりCPUがこの割り込みルーチンから抜け出せない状態に陥った場合に、他の割り込みを強制的に許可することができる。従って、システム全体のパフォーマンスを高めることができる。 The microcontroller of the present invention is configured to change the CPU from the interrupt disabled state to the interrupt enabled state when the duration of interrupt processing being executed in the CPU exceeds a predetermined value. According to this configuration, the CPU can be changed to the interrupt enable state regardless of whether the CPU is in the interrupt disable state or the interrupt enable state. Therefore, for example, when a problem occurs in an interrupt routine that does not permit multiple interrupts, and the CPU enters a state in which it cannot escape from this interrupt routine for a long time, other interrupts can be forcibly permitted. Therefore, the performance of the entire system can be improved.
ここで、上記CPUで実行するソフトウエアが参照可能な履歴フラグ記録部をさらに備え、上記割り込みイネーブル変更信号が生成されたときにその履歴フラグ記録部にフラグを設定することが好ましい。 Here, it is preferable that a history flag recording unit that can be referred to by software executed by the CPU is further provided, and a flag is set in the history flag recording unit when the interrupt enable change signal is generated.
このようにすると、割り込みディセーブル状態から割り込みイネーブル状態に変化した場合、その変化をソフトウェアで確認することができる。従って、長時間にわたり割り込み処理が行なわれていた場合、その処理が有効か否か(その処理において何らかの問題が発生しているか否か)を判断することができる。 In this way, when the interrupt disable state changes to the interrupt enable state, the change can be confirmed by software. Therefore, if interrupt processing has been performed for a long time, it can be determined whether the processing is valid (whether any problem has occurred in the processing).
また、要因ごとに優先順位が設定された割り込み処理の要求を受信し、上記CPUにおいて実行中の割り込み処理よりも高い優先順位を有する割り込み処理の要求を受信したときに、その要求を受け付け、上記CPUに対してその受け付けた割り込み処理の起動を要求する割り込みコントローラであって、
上記タイマが計測した継続時間が上記所定値を超えたときに、その起動された割り込み処理の優先順位が低くなるように上記優先順位を設定する優先順位設定部を備える割り込みコントローラをさらに備えたことが好ましい。
Also, when receiving a request for interrupt processing having a priority set for each factor and receiving a request for interrupt processing having a higher priority than the interrupt processing being executed in the CPU, the request is accepted, An interrupt controller that requests the CPU to start the accepted interrupt process,
And further comprising an interrupt controller including a priority setting unit that sets the priority so that the priority of the activated interrupt processing is lowered when the duration measured by the timer exceeds the predetermined value. Is preferred.
このような割り込みコントローラを備えると、優先順位の高い割り込みルーチン内で何らかの問題が発生し、想定以上の長時問、CPUで実行されている処理がこのルーチンから抜け出せない状態に陥った場合であっても、優先順位の低い割り込み処理を行なうことができる。 When such an interrupt controller is provided, there is a problem in an interrupt routine with a high priority, a problem that is longer than expected, and a process that is being executed by the CPU cannot be escaped from this routine. However, interrupt processing with a low priority can be performed.
本発明によれば、システム全体のパフォーマンスを高めることができるマイクロコントローラが提供される。 According to the present invention, a microcontroller that can improve the performance of the entire system is provided.
以下、図面を参照して本発明の実施の形態を説明する。 Embodiments of the present invention will be described below with reference to the drawings.
図1は、本発明の一実施形態のマイクロコントローラの構成を示す図である。 FIG. 1 is a diagram showing a configuration of a microcontroller according to an embodiment of the present invention.
図1に示すマイクロコントローラ1には、割り込みコントローラ10と、CPU20が備えられている。
The microcontroller 1 shown in FIG. 1 includes an
割り込みコントローラ10には、要因ごとに優先順位が設定された割り込み処理の要求を示す割り込み要因信号IR0,IR1,IR2,IR3が入力される。ここでは、割り込み要因信号IR0,IR1,IR2,IR3の順に優先順位が高くなっているものとする。割り込みコントローラ10の構成については後述するが、この割り込みコントローラ10は、CPU20で実行中の割り込み処理よりも高い優先順位を有する割り込み処理の要求を示す割り込み要因信号を入力したときに、その要求を受け付け、CPU20に対して受け付けた割り込み処理の起動を要求する割り込み要求信号INT_を出力する。また、割り込みコントローラ10は、データバスを経由して外部にデータDOを出力する。
The
CPU20は、アドレス信号ADR,リード信号RD,ライト信号WDを外部に出力する。また、CPU20は、データバスを経由して外部からのデータDIを入力するとともに、データバスを経由して外部にデータDOを出力する。さらに、CPU20の詳細について図2を参照して説明する。
The
図2は、図1に示すCPUの内部構成を示す図である。 FIG. 2 is a diagram showing an internal configuration of the CPU shown in FIG.
図2に示すCPU20には、割り込み処理部21と、制御回路部22と、レジスタ部23と、演算部24とが備えられている。割り込み処理部21,制御回路部22,レジスタ部23,演算部24には、リード信号RD,ライト信号WD等の制御信号CNTが入力される。
The
割り込み処理部21は、図1に示す割り込みコントローラ10からの割り込み要求信号INT_の入力を受け、CPU20全体の制御を司る制御回路部22へ割り込み要求を伝達する。
The
制御回路部22は、CPU20が動作する期間のうちの割り込み処理を受け付けることが可能な期間になった時点で、割り込み処理部21へ割り込み許可を与える。割り込み処理部21は、この割り込み許可を受けて、割り込み許可信号INTA_を割り込みコントローラ10に出力する。
The
レジスタ部23は、データを保持する記憶用のラッチ回路から構成されており、このレジスタ部23からは、あらかじめ読み込まれたプログラムコードによるデータが演算部24へ出力される。
The
演算部24は、レジスタ部23からのデータを用いて論理演算や算術演算を行ない、その結果をレジスタ部23へ書き戻す。
The
尚、CPU20が外部のメモリや1/0に対して、データの読み出しやデータの書き込みを行なう際に必要なアドレス信号ADRSとデータDATAは、レジスタ部23から出力されるようになっている。さらに、CPU20の内部構成について、図3を参照して詳細に説明する。
Note that the address signal ADRS and data DATA required when the
図3は、図2に示す割り込み処理部およびレジスタ部の構成を示す図である。 FIG. 3 is a diagram showing the configuration of the interrupt processing unit and the register unit shown in FIG.
図3に示す割り込み処理部21には、フリップフロップ21_1と、アンドゲート21_2と、計測タイマ21_3(本発明にいうタイマの一例に相当)と、比較器21_4と、アンドゲート21_5,21_6と、オアゲート21_7とが備えられている。
The interrupt
一方、レジスタ部23には、フリップフロップ23_1と、割り込みイネーブルレジスタ23_2と、設定値レジスタ23_3とが備えられている。
On the other hand, the
ここで、図3に示す割り込み許可信号INTA_は、割り込み処理部21の図示しない部分で生成され、この割り込み処理部21を構成するフリップフロップ21_1に、割り込み許可信号INTA_とクロック信号CLKが入力される。このフリップフロップ21_1と、次段のアンドゲート21_2とから、割り込み許可信号INTA_の立ち下がりエッジを検出する回路が構成される。この回路からの、割り込み許可信号INTA_の立ち下がりエッジが、計測タイマ21_3ヘのカウント開始信号COUNTとなり、この計測タイマ21_3でクロック信号CLKのクロックをカウントすることにより割り込みサービスの継続時間が測定される。
Here, the interrupt permission signal INTA_ shown in FIG. 3 is generated at a portion (not shown) of the interrupt processing
一方、レジスタ部23を構成する設定値レジスタ23_3には、CPU20が実行する命令により、任意の値がセットされる。また、割り込み処理部21を構成する比較器21_4は、この設定値レジスタ23_3の値と計測タイマ21_3の値を比較する回路である。両者が一致した時点で比較器21_4から割り込みイネーブル変更信号IECとして論理‘1’(‘H’レベル)が出力される。
On the other hand, an arbitrary value is set in the set value register 23_3 constituting the
レジスタ部23を構成する割り込みイネーブルレジスタ23_2は、その値が、図2に示す制御回路部22において、割り込み要求信号INT_を受け付けるか否かの判断に使用される。詳細には、この図3に示す割り込みイネーブルレジスタ23_2は、割り込み許可信号INTA_の立ち下がりエッジに基づいて生成されるカウント開始信号COUNTによってディセーブル状態になり、割り込みイネーブル信号IEとして‘L’レベルを出力する。また、割り込みイネーブル変更信号IECによってイネーブル状態になり、割り込みイネーブル信号IEとして‘H’レベルを出力する。即ち、CPU20は、‘H’レベルの割り込みイネーブル信号IEが出力されているときには、割り込みイネーブルの状態になっている。
The interrupt enable register 23_2 constituting the
一方、割り込みイネーブル変更信号IECは、割り込みコントローラ10(図1参照)ヘ‘優先順位変更要求信号PCR’として出力される。また、この割り込みイネーブル変更信号IECは、アンドゲート21_5,21_6,オアゲート21_7からなる回路に入力される。この回路からの出力はフリップフロップ23_1に入力され、このフリップフロップ23_1から履歴フラグF(割り込みイネーブル変更履歴フラグ)が出力される。尚、このフリップフロップ23_1が、本発明にいう履歴フラグ記録部の一例に相当する。この履歴フラグFは、割り込み許可信号INTA_がアクティブ(‘L’レベル)になった時点でクリア(‘0’)され、計測タイマ21_3の値が設定値レジスタ23_3の値と同じになった時点でセット(‘1’)される。ソフトウェアでは、この履歴フラグFを参照することで、そのルーチンでの処理が途中で問題が生じたものか否かを判定することが可能となる。 On the other hand, the interrupt enable change signal IEC is output as a “priority change request signal PCR” to the interrupt controller 10 (see FIG. 1). The interrupt enable change signal IEC is input to a circuit composed of AND gates 21_5, 21_6 and OR gate 21_7. An output from this circuit is input to the flip-flop 23_1, and a history flag F (interrupt enable change history flag) is output from the flip-flop 23_1. The flip-flop 23_1 corresponds to an example of a history flag recording unit referred to in the present invention. This history flag F is cleared ('0') when the interrupt permission signal INTA_ becomes active ('L' level), and when the value of the measurement timer 21_3 becomes the same as the value of the set value register 23_3. Set ('1'). By referring to the history flag F, the software can determine whether or not a problem has occurred during the processing in the routine.
図4は、図1に示す割り込みコントローラの構成を示す図である。 FIG. 4 is a diagram showing a configuration of the interrupt controller shown in FIG.
図4に示す割り込みコントローラ10には、割り込み要求レジスタ(IRR)11と、制御回路12と、優先順位割当回路13と、割り込みサービスレジスタ(ISR)14とが備えられている。
The interrupt
割り込み要求レジスタ11には、割り込み処理の要求を示す割り込み要因信号IR0,IR1,IR2,IR3が入力される。尚、これら割り込み要因信号IR0,IR1,IR2,IR3の優先順位は、前述したように、割り込み要因信号IR0,IR1,IR2,IR3の順に高くなっている。この割り込み要求レジスタ11では、割り込み要因信号IR0,IR1,IR2,IR3のいずれかの割り込み要因信号による割り込み要求が発生すると、その割り込み要因信号に該当するビットが‘1’にセットされる。その後、制御回路12が、CPU20から割り込み許可信号INTA_を受信すると、その該当ビットは‘0’にリセットされる。
The interrupt
割り込みサービスレジスタ14では、割り込みコントローラ10が割り込みサービスを行なっていると、その割り込みサービスの該当ビットが‘1’にセットされる。また、そのサービスが終了すると該当ビットが‘0’にリセットされる。
In the interrupt
優先順位割当回路13は、本発明にいう優先順位設定部の一例に相当し、割り込み要因の優先順位の設定および割り当てを行なう。
The
制御回路12は、割り込みの受け付け、割り込み要求のマスク、および割り込みサービスの割り当てを行なう。また、CPU20からの優先順位変更要求信号PCRを受けて、優先順位割当回路13の優先順位の設定を、現在サービス中の割り込み要因に対応する優先順位が相対的に低下させるように変更する機能を有する。
The
さらに、制御回路12は、いわゆる割り込みベクタ方式に要求される割り込みルーチンの開始アドレス(割り込みベクタ)を、データバス上に出力する機能を有する。
Further, the
この制御回路12は、割り込み要求レジスタ11からの割り込み要求を受けると、割り込みサービスレジスタ14を参照してCPU20において実行中の割り込み処理(サービス)を把握するとともに、優先順位割当回路13を利用して、割り込み要求レジスタ11から受けた要求の割り込み要因の優先順位が、実行中の割り込み処理を要求する割り込み要因の優先順位に比較して高いか否かを(言い換えると、割り込み要求レジスタ11から受けた要求の割り込み要因による割り込みサービスの優先順位が、実行中の割り込みサービスの優先順位に比較して高いか否かを)判断する。そして、実行中の割り込みサービスよりも高い優先順位を有する割り込みサービスの要求を受けたと判断したときには、その要求を受け付け、サービスの割り当てを実施し、CPU20に向けて割り込み要求信号INT_を出力する。これにより、CPU20に対して割り込みの要求を行なう。CPU20は、この割り込み要求信号INT_を受けて、割り込みが受け付け可能となった時点で割り込み許可信号INTA_を、この制卸回路12に出力する。これを受けて、制御回路12は、データバス上に割り込み要因に対応する割り込みベクタを出力し、さらにサービスを割り当てた要因に対応するビットについて、割り込みサービスレジスタ14の該当ビットを‘1’に設定する。このようにして、割り込みサービスレジスタ14の値を更新する。すなわち、割り込みサービスレジスタ14の値が更新された時点で割り込みサービスが開始される。
When receiving an interrupt request from the interrupt
図5は、図4に示す割り込みコントローラの、割り込み要求を受けてから割り込みサービスが開始されるまでのタイミングを示す図である。 FIG. 5 is a diagram showing the timing from when the interrupt controller shown in FIG. 4 receives an interrupt request until the interrupt service is started.
最初の時点では、制御回路12から出力される割り込み要求信号INT_、およびCPU20から出力される割り込み許可信号INTA_は、ともに‘H’レベルにある。
At the first time point, the interrupt request signal INT_ output from the
ここで、制御回路12が割り込み要求レジスタ11からの割り込み要求を受けると、この制御回路12は、クロック信号CLKの最初のクロックの立ち上がりエッジで、割り込み要求信号INT_を‘H’レベルから‘L’レベルに変化させる。この‘L’レベルの割り込み要求信号INT_はCPU20に入力される。
When the
すると、CPU20は、次のクロックの立ち上がりエッジで、この‘L’レベルの割り込み要求信号INT_を取り込む。さらに、CPU20は、その時点で割り込みが受け付け可能であった場合には、次のクロックの立ち上がりエッジで、割り込み許可信号INTA_を‘H’レベルから‘L’レベルに変化させる。
Then, the
制卸回路12では、これを受けて、さらに2つ目のクロックの立ち上がりエッジで、データバス上に割り込みベクタを出力する。
In response to this, the
さらに次のクロックの立ち上がりエッジで、割り込みサービスレジスタ14は、生成した割り込みベクタに対応する割込要因に基づいて該当ビットを「1」に設定する。これにより、割り込みサービスレジスタ14の値を更新する。また、CPU20は、所定の時間の後に、割り込み許可信号INTA_を‘L’レベルから‘H’レベルに変化させる。
Further, at the next rising edge of the clock, the interrupt
さらに、次のクロックの立ち上がりエッジで、割り込みサービスが開始される。また、制御回路12は、割り込み許可信号INTA_が‘H’レベルになったことを受けて、さらに次のクロックの立ち上がりエッジで、割り込み要求信号INT_を‘L’レベルから‘H’レベルに変化させる。
Furthermore, the interrupt service is started at the next rising edge of the clock. Further, the
図6は、図1に示すマイクロコントローラの割り込みシーケンスの一例を示す図である。 FIG. 6 is a diagram showing an example of an interrupt sequence of the microcontroller shown in FIG.
ここでは、前述したように、割り込み要因信号IR0,IR1,IR2,IR3の順に優先順位が高くなっている。先ず、割り込み要因信号IR1が発生し、この割り込み要因信号IR1による割り込み処理が行なわれる。即ち、この割り込み要因信号IR1によるサービス状態になる。この割り込み処理中に、割り込み要因信号IR0が発生するが、この割り込み要因信号IR0の優先順位は、割り込み要因信号IR1よりも低いため、割り込み要因信号IR0による割り込み要求は受け付けられず、サービスは行なわれない。尚、この例では、割り込み要因信号IR2,IR3は発生しないものとする。また、割り込み要因信号IR1は長期化するものとする。 Here, as described above, the priority order is higher in the order of the interrupt factor signals IR0, IR1, IR2, and IR3. First, an interrupt factor signal IR1 is generated, and an interrupt process by the interrupt factor signal IR1 is performed. That is, the service state is established by the interrupt factor signal IR1. During this interrupt processing, the interrupt factor signal IR0 is generated. Since the priority of the interrupt factor signal IR0 is lower than that of the interrupt factor signal IR1, the interrupt request by the interrupt factor signal IR0 is not accepted and the service is performed. Absent. In this example, interrupt factor signals IR2 and IR3 are not generated. The interrupt factor signal IR1 is assumed to be long.
ここで、計測タイマ21_3(図3参照)の値が設定値レジスタ23_3の値と一致する。この時、優先順位変更要求信号PCRが有効となり、割り込み要因信号IR1,IR2,IR3,IR0の順に優先順位が高くなるように変更される。これに伴い、割り込み要因信号IR1によるサービスが中断され、割り込み要因信号IR0による割り込み処理が開始される。 Here, the value of the measurement timer 21_3 (see FIG. 3) matches the value of the set value register 23_3. At this time, the priority change request signal PCR becomes valid, and the priority is changed in the order of the interrupt factor signals IR1, IR2, IR3, IR0. Along with this, service by the interrupt factor signal IR1 is interrupted, and interrupt processing by the interrupt factor signal IR0 is started.
尚、割り込みイネーブルレジスタ23_2は、割り込み要因信号IR1,IR0によるサービス開始直前まではイネーブル状態にある。このため、CPU20では、割り込み要求信号INT_が受け付けられる。割り込み要求信号INT_が受け付けられて、割り込み要因信号IR1,IR0によるサービスが開始されると、割り込みイネーブルレジスタ23_2はディセーブル状態になる。さらに、割り込みイネーブルレジスタ23_2は、計測タイマ21_3の値と設定値レジスタ23_3の値とが一致した時点でイネーブル状態となる。その後、割り込み要因信号IR0による割り込み処理が開始された時点でディセーブル状態となる。
The interrupt enable register 23_2 is in an enabled state until immediately before the service is started by the interrupt factor signals IR1 and IR0. Therefore, the
以上説明したように、本実施形態のマイクロコントローラ1では、例えば多重割り込みを許可しない割り込みルーチン内で何らかの問題が発生し、長時間にわたりCPU20が割り込みルーチンから抜け出せない状態に陥った場合に、低い優先順位の割り込みを許可することができる。従って、システム全体のパフォーマンスを高めることができる。
As described above, in the microcontroller 1 of this embodiment, for example, when a problem occurs in an interrupt routine that does not permit multiple interrupts, and the
尚、本実施形態では、CPU内に計測タイマを備えた例で説明したが、これに限られるものではなく、割り込みコントローラ内に計測タイマを備えてもよく、本発明は、CPUにおいて実行中の割り込み処理の継続時間を計測するタイマを、CPU内と割り込みコントローラ内とのいずれに備えてもよい。 In the present embodiment, the example in which the measurement timer is provided in the CPU has been described. However, the present invention is not limited to this, and the measurement timer may be provided in the interrupt controller. A timer for measuring the duration of interrupt processing may be provided in either the CPU or the interrupt controller.
1 マイクロコントローラ
10 割り込みコントローラ
11 割り込み要求レジスタ
12 制御回路
13 優先順位割当回路
14 割り込みサービスレジスタ
20 CPU
21 割り込み処理部
21_1,23_1 フリップフロップ
21_2,21_5,21_6 アンドゲート
21_3 計測タイマ
21_4 比較器
21_7 オアゲート
22 制御回路部
23 レジスタ部
23_2 割り込みイネーブルレジスタ
23_3 設定値レジスタ
24 演算部
1
DESCRIPTION OF
Claims (2)
要求された割り込み処理の起動が禁止された割り込みディセーブル状態と、要求された割り込み処理の起動が許可された割り込みイネーブル状態とを有し、
前記CPUにおいて実行中の割り込み処理の継続時間を計測するタイマと、該タイマが計測した継続時間が所定値を超えたときに、前記CPUを割り込みディセーブル状態から割り込みイネーブル状態に変化させる割り込みイネーブル変更信号を生成する割り込み制御部と、前記CPUで実行するソフトウエアが参照可能な履歴フラグ記録部とを備え、前記割り込みイネーブル変更信号が生成されたときに該履歴フラグ記録部にフラグを設定することを特徴とするマイクロコントローラ。 A microcontroller with a CPU,
An interrupt disabled state in which activation of the requested interrupt processing is prohibited, and an interrupt enable state in which activation of the requested interrupt processing is permitted,
A timer that measures the duration of interrupt processing being executed in the CPU, and an interrupt enable change that changes the CPU from an interrupt disable state to an interrupt enable state when the duration measured by the timer exceeds a predetermined value An interrupt control unit that generates a signal, and a history flag recording unit that can be referred to by software executed by the CPU, and sets a flag in the history flag recording unit when the interrupt enable change signal is generated A microcontroller characterized by
前記タイマが計測した継続時間が前記所定値を超えたときに、該起動された割り込み処理の優先順位が低くなるように前記優先順位を設定する優先順位設定部を備える割り込みコントローラをさらに備えたことを特徴とする請求項1記載のマイクロコントローラ。 When receiving a request for an interrupt process having a priority set for each factor and receiving a request for an interrupt process having a higher priority than the interrupt process being executed in the CPU, the request is accepted and the CPU receives the request. An interrupt controller that requests activation of the accepted interrupt processing,
And further comprising an interrupt controller including a priority setting unit for setting the priority so that the priority of the activated interrupt processing is lowered when the duration measured by the timer exceeds the predetermined value. The microcontroller according to claim 1.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2008288805A JP5331451B2 (en) | 2008-11-11 | 2008-11-11 | Microcontroller |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2008288805A JP5331451B2 (en) | 2008-11-11 | 2008-11-11 | Microcontroller |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2010117770A JP2010117770A (en) | 2010-05-27 |
JP5331451B2 true JP5331451B2 (en) | 2013-10-30 |
Family
ID=42305428
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2008288805A Expired - Fee Related JP5331451B2 (en) | 2008-11-11 | 2008-11-11 | Microcontroller |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP5331451B2 (en) |
Family Cites Families (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPS5295133A (en) * | 1976-02-06 | 1977-08-10 | Mitsubishi Electric Corp | Buss occupation demand adjusting system |
JPH06103467B2 (en) * | 1985-01-31 | 1994-12-14 | 富士重工業株式会社 | Preventing malfunction of automobile computer |
JPS6214235A (en) * | 1985-07-10 | 1987-01-22 | Nec Corp | Information processor |
JPH0218626A (en) * | 1988-07-06 | 1990-01-22 | Hokuriku Nippon Denki Software Kk | Interruption inhibition monitoring system |
JPH02310629A (en) * | 1989-05-26 | 1990-12-26 | Hitachi Ltd | Interruption controller, common resource exclusive method and assembler program processing method |
JPH03102430A (en) * | 1989-09-14 | 1991-04-26 | Nippon Telegr & Teleph Corp <Ntt> | Interruption control system |
JPH04225432A (en) * | 1990-12-27 | 1992-08-14 | Nec Eng Ltd | Interruption processing time control system for one-chip microcomputer |
JPH05241906A (en) * | 1991-10-21 | 1993-09-21 | Mitsubishi Electric Corp | Programmable controller |
JP3572650B2 (en) * | 1994-01-24 | 2004-10-06 | 株式会社リコー | Interrupt controller and control method thereof |
JP3512603B2 (en) * | 1997-09-11 | 2004-03-31 | 富士通株式会社 | Data processing device |
-
2008
- 2008-11-11 JP JP2008288805A patent/JP5331451B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
JP2010117770A (en) | 2010-05-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP2315113A1 (en) | Multi-threaded processors and multi-processor systems comprising shared resources | |
EP1685486B1 (en) | Interrupt handling in an embedded multi-threaded processor to avoid priority inversion and maintain real-time operation | |
JP2010277303A (en) | Semiconductor device and failure detection method | |
US10229077B2 (en) | Method for data transfer between real-time tasks using a DMA memory controller | |
JP2009110156A (en) | Log output device and log output program | |
JP4523910B2 (en) | Parallel processing device, parallel processing method, and parallel processing program | |
CN109933549B (en) | Interrupt controller suitable for RISC-V treater | |
JP2006244382A (en) | Microprocessor | |
JP2011134162A (en) | System and method for controlling switching of task | |
JP5331451B2 (en) | Microcontroller | |
JP2006201948A (en) | Interrupt signal accepting device and method | |
JP2004127163A (en) | Multiprocessor system | |
US20220415405A1 (en) | Memory-control circuit and method for controlling erasing operation of flash memory | |
JP2007299126A (en) | Controller and program for controller | |
JP4647276B2 (en) | Semiconductor circuit device | |
JP2009098972A (en) | Interruption control method and interruption system | |
JP2010140440A (en) | Bus arbitration device | |
JP2010113414A (en) | Multicore system, thread scheduling method, program, and storage medium | |
JP2011107939A (en) | Redundant system information processor | |
JPH09167117A (en) | Microcomputer and real time system using the microcomputer | |
JP2007128396A (en) | Interrupt control method and information processor | |
KR100930009B1 (en) | Method of interrupt processing | |
JP2009093393A (en) | Data processing device, and self-diagnosis method for data processing device | |
WO2008062508A1 (en) | Multiprocessor system | |
JP2009086908A (en) | Microcomputer device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20111011 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20130426 |
|
A711 | Notification of change in applicant |
Free format text: JAPANESE INTERMEDIATE CODE: A712 Effective date: 20130430 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20130514 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A821 Effective date: 20130516 |
|
RD04 | Notification of resignation of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7424 Effective date: 20130516 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A821 Effective date: 20130620 |
|
RD04 | Notification of resignation of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7424 Effective date: 20130620 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20130708 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20130723 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20130729 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 5331451 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
LAPS | Cancellation because of no payment of annual fees |