下面列出调整HIRC的例程,
sfr RCTRIM0 = 0x84;
sfr RCTRIM1 = 0x85;
bit BIT_TMP;
#define set_IAPEN BIT_TMP=EA;EA=0;TA=0xAA;TA=0x55;CHPCON|=SET_BIT0 ;EA=BIT_TMP
#define set_IAPGO BIT_TMP=EA;EA=0;TA=0xAA;TA=0x55;IAPTRG|=SET_BIT0 ;EA=BIT_TMP
#define clr_IAPEN BIT_TMP=EA;EA=0;TA=0xAA;TA=0x55;CHPCON&=~SET_BIT0;EA=BIT_TMP
unsigned char hircmap0,hircmap1;
unsigned int trimvalue16bit;
void MODIFY_HIRC_VLAUE(void)
{
set_IAPEN;
IAPAL = 0x30;
IAPAH = 0x00;
IAPCN = READ_UID;
set_IAPGO;
hircmap0 = IAPFD;
IAPAL = 0x31;
IAPAH = 0x00;
set_IAPGO;
hircmap1 = IAPFD;
clr_IAPEN;
trimvalue16bit = ((hircmap0<<1)+(hircmap1&0x01));
trimvalue16bit = trimvalue16bit - 15;
hircmap1 = trimvalue16bit&0x01;
hircmap0 = trimvalue16bit>>1;
TA=0XAA;
TA=0X55;
RCTRIM0 = hircmap0;
TA=0XAA;
TA=0X55;
RCTRIM1 = hircmap1;
}
但是这个例子里面用的手法是读取的0x30和0x31.为什么不是84和85呢?手册也没有介绍。
|