rtccwron.c
来自「基於 c51/8051 的 nand Flash Memory HY27US08」· C语言 代码 · 共 41 行
C
41 行
#if defined(__PIC24F__)
#include <p24Fxxxx.h>
#endif
#include "Rtcc.h"
#ifdef _TMR_RTCC_V1
/*********************************************************************
* Function: void _RtccWrOn(void)
*
* PreCondition: None
* Input: None
* Output: None
* Side Effects: None
* Overview: Function to set the RCFGCAL.RTCWREN.
* Note: The interrupts are disabled in order to have a proper device initialization
********************************************************************/
void RtccWrOn(void)
{
UINT8 CPU_IPL;
unsigned int data;
/* Disable Global Interrupt */
mSET_AND_SAVE_CPU_IP(CPU_IPL,7);
asm volatile ("MOV #0x55,%0" : "=r"(data));
asm volatile ("MOV %0,NVMKEY" : : "r"(data)); // Write the 0x55 key
asm volatile ("MOV #0xAA,%0" : "=r"(data));
asm volatile ("MOV %0,NVMKEY" : : "r"(data)); // Write the 0xAA key
RCFGCALbits.RTCWREN=1;
/* Enable Global Interrupt */
mRESTORE_CPU_IP(CPU_IPL);
}
#else
#warning "Does not build on this target"
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?