Difference between revisions of "83:Ports:03"

From WikiTI
Jump to: navigation, search
(revert)
(redid bits 0,1,2)
Line 5: Line 5:
 
'''Function:''' Interrupt Control Port
 
'''Function:''' Interrupt Control Port
  
This port has two modes. During normal program flow it indicates what devices are allowed to generate an interrupt. During an interrupt it indicates what device generated the interrupt.
+
This port controls all devices that can generate interrupts.
  
 
=== Read Values ===
 
=== Read Values ===
* Bit 0:
+
* Bit 0: Set if the ON key generated an interrupt.
** Normal mode: Always 0.
+
* Bit 1: Set if the first hardware timer generated an interrupt.
** Interrupt mode: Set if the ON key generated an interrupt.
+
* Bit 2: Set if the second hardware timer generated an interrupt.
* Bit 1:
+
** Normal mode: Always 0.
+
** Interrupt mode: Set if the first hardware timer generated an interrupt.
+
* Bit 2:
+
** Normal mode: Always 0.
+
** Interrupt mode: Set if the second hardware timer generated an interrupt.
+
 
* Bit 3: Reset if the ON key is being pressed; set otherwise.
 
* Bit 3: Reset if the ON key is being pressed; set otherwise.
 
* Bit 4-7: Unused.
 
* Bit 4-7: Unused.
  
 
=== Write Values ===
 
=== Write Values ===
* Bit 0:
+
* Bit 0: Set 0 to disable ON key interrupts and to acknowledge an ON key interrupt. Set 1 to enable ON key interrupts.
** Normal mode: Set 1 to enable the ON key interrupt. Set 0 to disable it.
+
* Bit 1: Set 0 to disable interrupts from the first timer and to acknowledge an interrupt from the first timer. Set 1 to enable interrupts from the first timer.
** Interrupt mode: Set 0 if you handled the ON key interrupt. Set 1 if you did not. If the ON key was one of the devices that triggered an interrupt, a new interrupt will then be generated immediately after you enable interrupts (EI) again.
+
* Bit 2: Set 0 to disable interrupts from the second timer and to acknowledge an interrupt from the second timer. Set 1 to enable interrupts from the second timer.
* Bit 1:
+
* Bit 3: Set 0 to turn off the LCD. Set 1 to enable the LCD.
** Normal mode: Set 1 to enable the first hardware timer. Set 0 to disable it.
+
** Interrupt mode: Set 0 if you handled the first timer interrupt. Set 1 if you did not. If the first timer was one of the devices that triggered an interrupt, a new interrupt will then be generated immediately after you enable interrupts (EI) again.
+
* Bit 2:
+
** Normal mode: Set 1 to enable the second hardware timer. Set 0 to disable it.
+
** Interrupt mode: Set 0 if you handled the second timer interrupt. Set 1 if you did not. If the second timer was one of the devices that triggered an interrupt, a new interrupt will then be generated immediately after you enable interrupts (EI) again.
+
* Bit 3: Set 1 to enable the LCD. Set 0 to turn off the LCD.
+
 
* Bit 4-7: Unused.
 
* Bit 4-7: Unused.
  
 
== Comments ==
 
== Comments ==
When in interrupt mode, the port will return to normal mode after the first write, so after that you can set a proper interrupt mask from within your interrupt routine if you want.
+
* Outside an interrupt routine, this port always reads either 00h or 08h.
 +
* You need to acknowledge interrupts. Otherwise a new interrupt will be generated directly after you enable interrupts again with EI. Because that disables that particular interrupt at the same time, you may have to write a second value to this port to reenable it.

Revision as of 12:54, 2 April 2005

Synopsis

Port Number: 03h

Function: Interrupt Control Port

This port controls all devices that can generate interrupts.

Read Values

  • Bit 0: Set if the ON key generated an interrupt.
  • Bit 1: Set if the first hardware timer generated an interrupt.
  • Bit 2: Set if the second hardware timer generated an interrupt.
  • Bit 3: Reset if the ON key is being pressed; set otherwise.
  • Bit 4-7: Unused.

Write Values

  • Bit 0: Set 0 to disable ON key interrupts and to acknowledge an ON key interrupt. Set 1 to enable ON key interrupts.
  • Bit 1: Set 0 to disable interrupts from the first timer and to acknowledge an interrupt from the first timer. Set 1 to enable interrupts from the first timer.
  • Bit 2: Set 0 to disable interrupts from the second timer and to acknowledge an interrupt from the second timer. Set 1 to enable interrupts from the second timer.
  • Bit 3: Set 0 to turn off the LCD. Set 1 to enable the LCD.
  • Bit 4-7: Unused.

Comments

  • Outside an interrupt routine, this port always reads either 00h or 08h.
  • You need to acknowledge interrupts. Otherwise a new interrupt will be generated directly after you enable interrupts again with EI. Because that disables that particular interrupt at the same time, you may have to write a second value to this port to reenable it.