11.07.2015 Views

PicC 9.50 dsPIC Manual.pdf

PicC 9.50 dsPIC Manual.pdf

PicC 9.50 dsPIC Manual.pdf

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Library FunctionsDI, EISynopsis#include EI ()DI ()DescriptionThe DI() and EI() routines disable and re-enable interrupts respectively. These are implemented asmacros defined in <strong>dsPIC</strong>.h. The example shows the use of EI() and EI() around access to a longvariable that is modified during an interrupt. If this was not done, it would be possible to return anincorrect value, if the interrupt occurred between accesses to successive words of the count value.Example#include long count;voidinterrupt void tick (void) @ T1_VCTR{count++;}longgetticks (void){long val;}DI();val = count;EI();return val;/* Disable interrupts around accessto count, to ensure consistency.*/140

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!