Microprocessor-microcontrollers-8051-interrupts
提供:Dev Guides
マイクロコントローラー-8051割り込み
割り込みは、メインプログラムを一時的に中断し、外部ソースに制御を渡し、タスクを実行するイベントです。 次に、中断したメインプログラムにコントロールを渡します。
8051には5つの割り込み信号があります。 INT0、TFO、INT1、TF1、RI/TI。 IEレジスタのビットを設定することで各割り込みを有効または無効にでき、同じレジスタのEAビットをクリアすることで割り込みシステム全体を無効にできます。
IE(割り込みイネーブル)レジスタ
このレジスタは、割り込みを有効または無効にする役割を果たします。 EAレジスタは、割り込みを有効にするために1に設定され、割り込みを無効にするために0に設定されます。 ビットシーケンスとその意味を次の図に示します。
EA | IE.7 | It disables all interrupts. When EA = 0 no interrupt will be acknowledged and EA = 1 enables the interrupt individually. |
- | IE.6 | Reserved for future use. |
- | IE.5 | Reserved for future use. |
ES | IE.4 | Enables/disables serial port interrupt. |
ET1 | IE.3 | Enables/disables timer1 overflow interrupt. |
EX1 | IE.2 | Enables/disables external interrupt1. |
ET0 | IE.1 | Enables/disables timer0 overflow interrupt. |
EX0 | IE.0 | Enables/disables external interrupt0. |
IP(割り込み優先度)レジスタ
次の図に示すように、割り込み優先度(IP)レジスタの対応するビットを変更することにより、割り込みの優先度レベルを変更できます。
- 低優先度の割り込みは、高優先度の割り込みによってのみ中断できますが、別の低優先度の割り込みによっては中断できません。
- 異なる優先度レベルの2つの割り込みが同時に受信された場合、より高い優先度レベルの要求が処理されます。
- 同じ優先度レベルのリクエストが同時に受信された場合、内部ポーリングシーケンスはどのリクエストを処理するかを決定します。
- | IP.6 | Reserved for future use. |
- | IP.5 | Reserved for future use. |
PS | IP.4 | It defines the serial port interrupt priority level. |
PT1 | IP.3 | It defines the timer interrupt of 1 priority. |
PX1 | IP.2 | It defines the external interrupt priority level. |
PT0 | IP.1 | It defines the timer0 interrupt priority level. |
PX0 | IP.0 | It defines the external interrupt of 0 priority level. |
TCONレジスタ
TCONレジスタは、マイクロコントローラへの外部割り込みのタイプを指定します。