Difference between revisions of "83:Ports:03"

From WikiTI
Jump to: navigation, search
 
(Read Values)
Line 9: Line 9:
 
=== Read Values ===
 
=== Read Values ===
 
* Bit 0:
 
* Bit 0:
** Normal mode: Set if pressing the ON key will generate an interrupt. (someone needs to confirm this)
+
** Normal mode: Always 0.
 
** Interrupt mode: Set if the ON key generated an interrupt.
 
** Interrupt mode: Set if the ON key generated an interrupt.
 
* Bit 1:
 
* Bit 1:
** Normal mode: Set if the first hardware timer will generate an interrupt. (someone needs to confirm this)
+
** Normal mode: Always 0.
 
** Interrupt mode: Set if the first hardware timer generated an interrupt.
 
** Interrupt mode: Set if the first hardware timer generated an interrupt.
 
* Bit 2:
 
* Bit 2:
** Normal mode: Set if the second hardware timer will generate an interrupt. (someone needs to confirm this. is this a second timer at all?)
+
** Normal mode: Always 0.
 
** Interrupt mode: Set if the second hardware timer generated an interrupt.
 
** 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.

Revision as of 09:44, 1 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.