Difference between revisions of "83:Ports:03"

From WikiTI
Jump to: navigation, search
(Synopsis)
(revert)
Line 5: Line 5:
 
'''Function:''' Interrupt Control Port
 
'''Function:''' Interrupt Control Port
  
This port has two modes. During normal program flow it controls what devices are allowed to generate an interrupt. During an interrupt it indicates what device generated the interrupt.
+
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.
  
 
=== Read Values ===
 
=== Read Values ===
Line 23: Line 23:
 
* Bit 0:
 
* Bit 0:
 
** Normal mode: Set 1 to enable the ON key interrupt. Set 0 to disable it.
 
** Normal mode: Set 1 to enable the ON key interrupt. Set 0 to disable it.
** Interrupt mode: Set 1 if you handled the ON key interrupt. Set 0 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.
+
** 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 1:
 
* Bit 1:
 
** Normal mode: Set 1 to enable the first hardware timer. Set 0 to disable it.
 
** Normal mode: Set 1 to enable the first hardware timer. Set 0 to disable it.
** Interrupt mode: Set 1 if you handled the first timer interrupt. Set 0 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.
+
** 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:
 
* Bit 2:
 
** Normal mode: Set 1 to enable the second hardware timer. Set 0 to disable it.
 
** Normal mode: Set 1 to enable the second hardware timer. Set 0 to disable it.
** Interrupt mode: Set 1 if you handled the second timer interrupt. Set 0 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.
+
** 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 3: Set 1 to enable the LCD. Set 0 to turn off the LCD.
 
* Bit 4-7: Unused.
 
* Bit 4-7: Unused.

Revision as of 02:47, 2 April 2005

Synopsis

Port Number: 03h

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.

Read Values

  • Bit 0:
    • Normal mode: Always 0.
    • Interrupt mode: Set if the ON key 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 4-7: Unused.

Write Values

  • Bit 0:
    • Normal mode: Set 1 to enable the ON key interrupt. Set 0 to disable it.
    • 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 1:
    • 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.

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.