SW500007 Microchip Technology, SW500007 Datasheet - Page 206

PICC-18 PRO

SW500007

Manufacturer Part Number
SW500007
Description
PICC-18 PRO
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC18r
Datasheets

Specifications of SW500007

Supported Families
PIC18
Core Architecture
PIC
Software Edition
Professional
Kit Contents
Software And Docs
Mcu Supported Families
PIC18
Tool Function
Compiler
Tool Type
Compiler
Lead Free Status / RoHS Status
Not applicable / RoHS Compliant
For Use With/related Products
PIC18 Series
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Other names
015P
778-1002
778-1002
DI, EI
Synopsis
Description
The di() macro disables all interrupts globally (regardless of priority settings), ei() re-enables inter-
rupts globally. These are implemented as macros defined in PIC18.h. The example shows the use
of ei() and di() around access to a long variable that is modified during an interrupt. If this was not
done, it would be possible to return an incorrect value, if the interrupt occurred between accesses to
successive words of the count value.
Example
192
#include <htc.h>
void ei (void)
void di (void)
#include <htc.h>
long count;
void
interrupt tick (void)
{
}
long
getticks (void)
{
count++;
long val;
di();
val = count;
ei();
return val;
/* Disable interrupts around access
to count, to ensure consistency.*/
Library Functions

Related parts for SW500007