Hi,
I a little bit confused after reading BCL12 case. Is there any thing wrong with the following code when we consider BCL12, or any other things about updating DCO?
//---------------------------------------
static int clock_set_dco(const uint8 calbc1_x, const uint8 caldco_x)
{
static int powerup = 0;
if (calbc1_x == 0xFF)
{
return 0; //FAILURE
}
if(powerup == 0)
{
__delay_cycles(100000);
DCOCTL = 0x00;
BCSCTL1 = calbc1_x;
DCOCTL = caldco_x;
powerup = 1;
}
else
{
if( (BCSCTL1 & 0x0F) > 0x0D )
BCSCTL1 = 0x8D;
BCSCTL1 = 0x87;
DCOCTL = caldco_x;
if( (calbc1_x & 0x0F) > 0x0D)
BCSCTL1 = 0x8D;
BCSCTL1 = calbc1_x;
}
return 1; //SUCCESS
}
//---------------------------
Thank you for your reply
Ramazan