DM240002 Microchip Technology, DM240002 Datasheet - Page 33

BOARD DEV EXPLORER 16 44-PIN

DM240002

Manufacturer Part Number
DM240002
Description
BOARD DEV EXPLORER 16 44-PIN
Manufacturer
Microchip Technology
Series
Explorer 16 44-pinr
Type
MCUr
Datasheet

Specifications of DM240002

Contents
Explorer 16 Dev Board, PIC24FJ64GA004 and dsPIC33FJ32GP204 PIM Modules
Processor To Be Evaluated
PIC24FJ128GA010, dsPIC33FJ256GP710
Processor Series
PIC 24, dsPIC33
Data Bus Width
32 bit
Interface Type
RS-232
Silicon Manufacturer
Microchip
Core Architecture
PIC, DsPIC
Core Sub-architecture
PIC24, DsPIC33
Silicon Core Number
PIC24F, DsPIC33F
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
For Use With/related Products
dsPIC30, dsPIC33, PIC32, PIC24FJ, PIC24HJ
Lead Free Status / Rohs Status
Lead free / RoHS Compliant

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
DM240002
Manufacturer:
Microchip Technology
Quantity:
135
Part Number:
DM240002
Manufacturer:
MICROCHIP
Quantity:
12 000
© 2007 Microchip Technology Inc.
When the master interrupt line is asserted, the PIC microcontroller finishes the current
instruction, stores the next address on the CALL stack then jumps to the Interrupt Ser-
vice Routine (ISR). It also clears the GIE bit, preventing another interrupt from occur-
ring while servicing the current one.
Save Current Context
The first thing the ISR must do is to save the current context of the processor so it can
be restored before returning to the main program. Certain SFRs that may be changed
in the ISR should be saved, such as the WREG and STATUS registers at the very least.
Make sure to save the WREG first, as moving other SFRs into it will destroy the value
needing to be saved. The last 16 bytes of each PIC16F887 file register page are
unbanked and are good places to save the context, as they may be accessed from any
register page without regard to the RP0 and RP1 bits in the STATUS register. The
location of unbanked registers may vary from part to part. Check the register map to
find the unbanked region for a specific part.
Identify Triggering Event
Next, the ISR has to figure out what triggered the interrupt. It has to check the interrupt
flags to determine what caused the interrupt. When it finds the source, it can then
service the peripheral.
Restore Context
Once the peripheral is serviced, it needs to restore the context and resume the main
program. The “context” is the state of the SFRs when the interrupt occurred. Restoring
the context is a little harder than it might seem at first. The obvious method doesn’t work
because the MOVF W_Temp,w may affect the Z flag, which was restored in the previ-
ous instruction. Instead, a pair of SWAPF instructions can restore WREG without affect-
ing the flags in the STATUS register. SWAPF exchanges the high and low nibbles. The
first SWAPF switches the nibbles in the file register and the second one switches them
back and puts the result in WREG.
EXAMPLE 3-9:
Finally, RETFIE transfers control back to the original program and sets the GIE bit,
re-enabling interrupts.
;incorrect context restore
MOVF
MOVWF STATUS
MOVF
;good context restore
MOVF
MOVWF STATUS
SWAPF W_Temp,f
SWAPF W_Temp,w
STATUS_Temp,w
W_Temp
STATUS_Temp,w
CONTEXT RESTORE
44-Pin Demo Board Lessons
;this may change the Z bit
;in the Status register
;swap in place
;swap with Wreg destination
DS41296B-page 29

Related parts for DM240002