h文件中:
varStartPtr .usect "BLDC_ISRvarSec",1 ;Must at the biginning of the RAM variables
.global varStartPtr ;It is also double as ISR internal status register
//***ISR internal status
//***ADDR -- varStartPtr
#define ST_ISRLoopBit 0 //bit 0: 1, the first cycle; 0, the 2nd cycle with loop update and
//calculation. After reset, it is 0.
#define StartStepsBits 0xE //bits 1,2,3; the startup steps; max of 7 (It has to be bit 1~3)
#define ILoopENBit 4 //bit 4; 1, the current loop enabled;0,disabled
asm文件中
MOVL XAR6,#varStartPtr
MOV @AR7,#(varEndPrt-varStartPtr);
MOVW DP,#varStartPtr ;set DP
TBIT @varStartPtr, #ST_ISRLoopBit ;ST_ISRLoopBit=0
AND @varStartPtr, #((~(StartStepsBits))&(~(1<
TSET @varStartPtr, #ILoopENBit ;enable the loop
ADD @varStartPtr,#2 ;point to next step