83:Ports:03

From WikiTI
Revision as of 04:54, 30 March 2005 by Kalimero (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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: Set if pressing the ON key will generate an interrupt. (someone needs to confirm this)
    • Interrupt mode: Set if the ON key generated an interrupt.
  • Bit 1:
    • Normal mode: Set if the first hardware timer will generate an interrupt. (someone needs to confirm this)
    • Interrupt mode: Set if the first hardware timer generated an interrupt.
  • 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?)
    • 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.