FANDOM


Interrupts Intro Edit

Interrupts allow immediate processing of high-priority tasks. The Atom Pro uses a number of interrupts, based on timers and other events, as well as providing for external (hardware generated) interrupts.

Atom BASIC allows access to the microcontroller's built-in interrupt processing via BASIC commands. Explanation of uses and operation of interrupts is beyond the scope of this manual.

Note: For more information on the operation of interrupts, refer to the H8/3664F or H8/3687F hardware manual, available at http://www.renesas.com


This chapter contains the following sections:

  • Interrupts
    • Enable
    • Disable
    • OnInterrupt
    • Resume


Conventions Used in this Chapter Edit

{ ... } represent optional components in a command. The { } are not to be included.
[ ... ] used for lists - the [ ] are required.
( ... ) used for some arguments. The ( ) are required.


Interrupt List Edit

The following interrupts are available for use in the Atom Pro:


All Modules
Name Description
IRQ0INT Irq0 pin interrupt
IRQ1INT Irq1 pin interrupt
IRQ2INT Irq2 pin interrupt
IRQ3INT Irq3 pin interrupt
WKPINT_0 WKP0 pin onchange interrupt
WKPINT_1 WKP1 pin onchange interrupt
WKPINT_2 WKP2 pin onchange interrupt
WKPINT_3 WKP3 pin onchange interrupt
WKPINT_4 WKP4 pin onchange interrupt
WKPINT_5 WKP5 pin onchange interrupt
TIMERVINT_OVF TimerV overflow interrupt
TIMERVINT_CMEB TimerV compare match A int
TIMERVINT_CMEA TimerV compare match B int
SCI3INT_TDRE Transmit Data Register Empty interrupt
SCI3INT_RDRF Read Data Register Full interrupt
SCI3INT_TEND Transmit End interrupt
SCI3INT_OER Overflow Error interrupt
SCI3INT_FER Frame Error interrupt
SCI3INT_PER Parity Error interrupt
IICINT I2C interrupt
ADINT Analog conversion complete int
HSERIALINT_TDRE Transmit Data Register Empty interrupt
HSERIALINT_RDRF Read Data Register Full interrupt
HSERIALINT_TEND Transmit End interrupt
HSERIALINT_OER Overflow Error interrupt
HSERIALINT_FER Frame Error interrupt
HSERIALINT_PER Parity Error interrupt.98
HSERVOINT_IDLE Any Servo Idle interrupt
HSERVOINT_IDLE0-31 # Servo Idle interrupt
HSERVOINT_USER HServo User Interrupt
HSERVOINT Hservo Interrupt


ATOM-Pro only (H8/3664/3694)
Name Description
TIMERAINT Overflow interrupt
TIMERWINT_OVF Overflow interrupt
TIMERWINT_IMIEA Capture/Compare Match A int
TIMERWINT_IMIEB Capture/Compare Match B int
TIMERWINT_IMIEC Capture/Compare Match C int
TIMERWINT_IMIED Capture/Compare Match D int


ATOM-Pro Plus only (H8/3687)
Name Description
RTCINT Real time clock interrupt
TIMERZ0INT_OVF Overflow interrupt
TIMERZ0INT_IMIEA Capture/Compare Match A int
TIMERZ0INT_IMIEB Capture/Compare Match B int
TIMERZ0INT_IMIEC Capture/Compare Match C int
TIMERZ0INT_IMIED Capture/Compare Match D int
TIMERZ1INT_UDF Underflow interrupt
TIMERZ1INT_OVF Overflow interrupt
TIMERZ1INT_IMIEA Capture/Compare Match A int
TIMERZ1INT_IMIEB Capture/Compare Match B int
TIMERZ1INT_IMIEC Capture/Compare Match C int
TIMERZ1INT_IMIED Capture/Compare Match D int
TIMERB1INT Overflow interrupt
SCI3_2INT_TDRE Transmit Data Register Empty interrupt
SCI3_2INT_RDRF Read Data Register Full interrupt
SCI3_2INT_TEND Transmit End interrupt
SCI3_2INT_OER Overflow Error interrupt
SCI3_2INT_FER Frame Error interrupt
SCI3_2INT_PER Parity Error interrupt
HSERIAL2INT_TDRE Transmit Data Register Empty interrupt
HSERIAL2INT_RDRF Read Data Register Full interrupt
HSERIAL2INT_TEND Transmit End interrupt
HSERIAL2INT_OER Overflow Error interrupt
HSERIAL2INT_FER Frame Error interrupt
HSERIAL2INT_PER Parity Error interrupt.99


Interrupts must be enabled before they can be used. You can enable and disable them globally or individually, using the ENABLE and DISABLE commands, described below.


ENABLE, DISABLE Edit

Enables or disables one or all interrupts. ENABLE must be used before interrupts will work. DISABLE prevents the specified interrupt from working.

Syntax

enable {intname}
disable {intname}
intname must be one of the interrupt names from the table on the previous page. Intname is optional, if it is omitted all interrupts will be enabled or disabled.


ONINTERRUPT Edit

This is a compile time function that sets the label that the specified interrupt will jump to when it occurs. You must also enable the interrupt before it will work.

Syntax

oninterrupt intname, label
intname is the name of the desired interrupt (see the table on page 174).
label is the label to which program execution will jump when this interrupt occurs.

Note: You must use the RESUME command (see below) to return to normal program execution after your interrupt has been processed.

Example

ONINTERRUPT TIMERAINT,IntHandler
TMA = (TMA & 0xF0) | 0x4 ;Sets TimerA to increment once
                         ;every 256 clock cycles.
timer var long
ENABLE TIMERAINT

main
   serout S_OUT,i9600,[dec timer,13]
   pause 100
   goto main

IntHandler
   timer = timer + 1
   resume


RESUME Edit

Return from interrupt. This command is used to return to the point in your program where execution was interrupted. It should be used at the end of the interrupt processing code for ONINTERRUPT.

Syntax

resume (no arguments)

Examples

See the example under ONINTERRUPT on page 177.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.