Hi, i am using MC13213 which the MCU is HCS08GB .I want to input the sensor's analog signal and convert it to digital signal with ATD module. And I configure the registers as follows:
void ADC_INI(void)
{
ATD1C=0xE2; //not interrupt (polling),8-bit conversion
ATD1SC=0x25; //select the channel five
ATD1PE=0x20; //the fifth pin is set as ATD input
}
And my program is :
/*********************define the variable and function****************************/
unsigned int DATA=0;
void ADC_INI(void);
/*****************main function*****************************************/
void main(void)
{
//EnableInterrupts; /* enable interrupts */
ADC_INI();
for(;
{
__RESET_WATCHDOG(); /* feeds the dog */
// ATD1C=0xE2;
while(!ATD1SC_CCF)
__RESET_WATCHDOG(); /***********************the program always stop here
DATA=ATD1RH;
} /* loop forever */
/* please make sure that you never leave main */
}
/*****************initialization*****************************************/
void ADC_INI(void)
{
ATD1C=0xE2;
ATD1SC=0x25;
ATD1PE=0x20;
}
But now i can get the result of conversion and ATD1SC_CCF is always 0.
I don't know why and hope you help!