1 initialization, 2 interrupts, Initialization – Maxim Integrated 71M6534 Energy Meter IC Family Software User Manual
Page 53: Interrupts, Table 5-10: interrupt service routines

71M653X Software User’s Guide
5.4.1 Initialization
When the power applied for the first time or RESETZ is asserted, the 71M653X device executes the code pointed to by
the reset vector.
5.4.2 Interrupts
There are 13 interrupts available for the 80515, and the revision 4.4 Demo Code uses 11 interrupts. Table 5-10 shows
the interrupt service routines (ISRs), the corresponding vectors (Table 6-58 in section 6.3.5.4) and their priority, as
assigned by the MPU using the IP0 and IP1 registers (see section 6.3.5.2). In general, stubbed interrupts or shared
interrupt code is defined in meter\io653x.c.
Interrupt Source
Interrupt Service
Routine
External or
Internal
Interrupt
In source file
Vector
Priority
(3 =
highest)
Pulse count
pcnt_w_isr()
EXT0
Meter\pcnt.c
0x03
0
Pulse count
pcnt_v_isr()
EXT1
Meter\pcnt.c
0x13
3
Flash-Write collision
fwcol0
fwcol_isr() EXT2
Meter\io653x.c
0x4B
0
Flash-Write collision
fwcol1
fwcol_isr() EXT2
Meter\io653x.c
0x4B
0
CE Busy
ce_busyz_int()
EXT3
Meter\ce.c
0x53
3
Power fail/power return
pll_isr()
EXT4
Main\batmodes
.c
0x5B 3
EEPROM eeprom_isr() EXT5
IO\eeprom.c
0x63
0
XFER busy
ce_xfer_busyz_isr ()
EXT6 (shared
w/ RTC)
Meter\ce.c 0x6B
2
RTC rtc_isr()
EXT6
(shared
w/ XFER)
IO\rtc_30.c 0x6B
2
NEAR_OVERFLOW
xfer_rtc_isr ()
EXT6 (shared
w/ XFER)
Meter\io653x.c 0x6B
2
Timer0 tmr0_isr()
IO\tmr0.c
0x0B
0
Timer1 tmr1_isr()
IO\tmr1.c
0x1B
3
UART 0
es0_isr
IO\serial.c
0x23
0
UART 1
es1_isr
IO\serial.c
0x83
0
Table 5-10: Interrupt Service Routines
In general, a higher priority interrupt can preempt lower-priority interrupt code. The interrupt priority hardware is
controlled by two registers, IP and IP1 (named IPL and IPH in the demo code). The MPU supports four priorities, and a
fifth is possible with a small amount of software support.
The best practice is to set priorities once, near the start of initialization. Setting priorities dynamically while interrupts
occur can have undefined results. Since some of the interrupts detect power failures that can occur at any time,
changing interrupt priorities in the middle of the code is not recommended.
In the 653x demo code, interrupt priorities are set higher for urgent tasks. Among equally-urgent tasks, priorities are set
higher for faster interrupts. The following describes interrupt priorities for the version 4.3.3 of the Demo Code:
The priority is set once, in main_init() of main\Main.c. It is also cleared to 0s in the soft reset routine, but this is
followed by logic that calls four RTIs to reset the interrupt acknowledge logic for all four hardware interrupt levels. The
system priority value is assembled from constants in Main\options_gbl.h. The constants are defined in Util\priority2x.h.
The highest priority interrupt group is the PLL_OK interrupt (external interrupt 4, see Main\batmodes.c), and timer 1.
PLL_OK is urgent because it indicates power supply failure, and the software must start battery modes. Timer 1 shares
the same priority bits, and is currently unused (sample code is in Io\tmr1.c, &.h), though earlier versions used it to set
the real-time-clock.
v1.1v1.1
TERIDIAN Proprietary
53 of 116
© Copyright 2005-2008 TERIDIAN Semiconductor Corporation