void Adc_init(void)
{
/* ADC initialization */
MyADCPtr = ADC_Init((LDD_TUserData *)NULL); /* Initialize the device */
Vr_temp_PutVal(1);
/* Create 8-sample group */
SampleGroup[0].ChannelIdx = 0U; /* ADC of Vref */
SampleGroup[1].ChannelIdx = 1U; /* ADC of T1 */
SampleGroup[2].ChannelIdx = 2U; /* ADC of T2 */
SampleGroup[3].ChannelIdx = 3U; /* ADC of T3 */
SampleGroup[4].ChannelIdx = 4U; /* ADC of T4 */
SampleGroup[5].ChannelIdx = 5U; /* ADC of T5 */
SampleGroup[6].ChannelIdx = 6U; /* ADC of T6 */
SampleGroup[7].ChannelIdx = 7U; /* ADC of VCP */
SampleGroup[8].ChannelIdx = 8U; /* ADC of current shunt */
PE_Error = ADC_CreateSampleGroup(MyADCPtr, (LDD_ADC_TSample *)SampleGroup, 8U); /* Set created sample group */
if(PE_Error != 0)
{
SS_ERROR=0x71;
}
}
void Adc_Pro(void)
{
static uint8_t ADCAverge;
uint8_t ADC_Cunter;
PE_Error = ADC_StartSingleMeasurement(MyADCPtr); /* Start continuous measurement */
if ( PE_Error )
{
SS_ERROR=0x71;
}
while (!ADC_GetMeasurementCompleteStatus(MyADCPtr)) {}; /* Wait for conversion completeness */
PE_Error = ADC_GetMeasuredValues(MyADCPtr, (LDD_TData *)MeasuredValues); /* Read measured values */
if ( PE_Error )
{
SS_ERROR=0x71;
}
Hi 育鈞,
Sorry for the late reply!
Number of items in the sample definition array. Must be less than or equal to ComponentName_MAX_HW_SAMPLE_COUNT.
Best Regards,
Robin
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
----------------------------------------------------------------------------------------------------------------------