PIC17CXX器件的C语言中断保存/恢复语句
来源:--
作者:--
浏览:257
时间:2016-08-10 14:18
标签:
摘要:
// File name: int17cxx.h /* Interrupt context save and restore for PIC17C42 PIC17C42A, PIC17C43, PIC17C44, PIC17C752,
// File name: int17cxx.h /* Interrupt context save and restore for PIC17C42 PIC17C42A, PIC17C43, PIC17C44, PIC17C752, PIC17C756
__Wimage变量可能并不需要保存,该变量出现在所提供的延时程序中,用于计算指针/阵列地址。 FSR0寄存器也用于计算指针/阵列RAM的地址。 这些变量是否需要保存取决于代码的复杂程度。根据代码要求,可修改这些指令。 */ #pragma option -l #asm MACRO PUSH MOV FP ALUSTA, temp_ALUSTA ;save flags MOV fp __WImage,temp_WImage MOV pf WREG,temp_WREG MOV pf BSR,temp_BSR MOV pf FSR0,temp_FSR0 ENDM #endasm #define save_context #asm ( PUSH) #asm MACRO POP MOV fp temp_FSR0,FSR0 MOV fp temp_BSR,BSR MOV fp temp_WREG,WREG MOV fp temp_WImage,__WImage MOV fp temp_ALUSTA,ALUSTA ;restore flags ENDM #endasm #define restore_context #asm ( POP) #pragma option +l 标题: PIC16CXX 4K字器件的C语言中断保存/恢复语句 解答: // File name: int16c4k.h /* PIC16C642, PIC16C662, PIC16C63, PIC16C65, PIC16C65A, PIC16C73, PIC16C73A, PIC16C74, PIC16C74A, PIC16C923, PIC16C924, PIC14000, PIC16C66, PIC16C67, PIC16C76, PIC16C77器件的中断保存和恢复语句。 这些例程主要用于PIC14架构中程序存储器为4k或8k的器件中。 __Wimage变量可能并不需要保存,该变量出现在所提供的延时程序中,用于计算指针/阵列地址。 FSR0寄存器也用于计算指针/阵列RAM的地址。 这些变量是否需要保存取决于代码的复杂程度。根据代码要求,可修改这些指令。 */ #pragma option -l #asm MACRO PUSH MOV wf temp_WREG ;save copy w register MOV f STATUS,w bcf STATUS,RP0 ;set bank to 0 bcf STATUS,RP1 ; MOV wf temp_STATUS ;save status MOV f FSR,w ; MOV wf temp_FSR ;save copy of FSR MOV f PCLATH,w ; MOV wf temp_PCLATH ;save copy of PCLATH MOV f __WImage,w ; MOV wf temp_WImage ;save copy of __WImage ENDM #endasm #define save_context #asm ( PUSH) #asm MACRO POP bcf STATUS,RP0 ;ensure bank is set to 0 bcf STATUS,RP1 ; MOV f temp_WImage,w ; MOV wf __WImage ;restore __WImage MOV f temp_PCLATH,w ; MOV wf PCLATH ;restore PCLATH MOV f temp_FSR,w ; MOV wf FSR ;restore FSR MOV f temp_STATUS,w MOV wf STATUS ;restore status and bank information swapf temp_WREG,f ; swapf temp_WREG,w ;restore working register ENDM #endasm #define restore_context #asm ( POP) #pragma option +l 标题: PIC16CXX 2K字器件的C语言中断保存/恢复语句 关于 中断 发表日期: 10/25/1997 解答: // File Name: int16C2k.h /* PIC16C558, PIC16C622, PIC16C61, PIC16C62, PIC16C62A, PIC16C64, PIC16C64A, PIC16C710, PIC16C71, PIC16C711, PIC16C72, PIC16F83, PIC16F84器件的中断保存和恢复语句。 这些例程主要用于PIC14架构中程序存储器为2k或更小的器件中。 __Wimage变量可能并不需要保存,该变量出现在所提供的延时程序中,用于计算指针/阵列地址。 FSR0寄存器也用于计算指针/阵列RAM的地址。 这些变量是否需要保存取决于代码的复杂程度。根据代码要求,可修改这些指令。 */ #pragma option -l #asm MACRO PUSH MOV wf temp_WREG ;save copy w register MOV f STATUS,w bcf STATUS,RP0 ;set bank to 0 MOV wf temp_STATUS ;save status MOV f FSR,w ; MOV wf temp_FSR ;save copy of FSR MOV f __WImage,w ; MOV wf temp_WImage ;save copy of __WImage ENDM #endasm #define save_context #asm ( PUSH) #asm MACRO POP bcf STATUS,RP0 ;ensure bank is set to 0 MOV f temp_WImage,w ; MOV wf __WImage ;restore __WImage MOV f temp_FSR,w ; MOV wf FSR ;restore FSR MOV f temp_STATUS,w MOV wf STATUS ;restore status and bank information swapf temp_WREG,f ; swapf temp_WREG,w ;restore working register ENDM #endasm #define restore_context #asm ( POP) #pragma option +l
分享到: