uint16 ADC_Max=65535;
uint16 ADC_Min=0;
uint16 ADC_Result1;
uint16 Period1;
int main()
{
int32 ADC_Result;
float Comp_Val; //,CMP;
// Start the components
Sys_Init();
while(1)
{
ADC_DelSig_StartConvert(); // Start the ADC conversion
if(ADC_DelSig_IsEndConversion(ADC_DelSig_RETURN_STATUS)) // Check ADC EOC flag
{
ADC_Result = ADC_DelSig_GetResult32(); // Get Result
// Limit the result to 0..65535
if(ADC_Result < ADC_Min) ADC_Result = 0;
if(ADC_Result > ADC_Max) ADC_Result = 65535;
// Display ADC result in mVolts on LCD
ADC_Result1 = ADC_DelSig_CountsTo_mVolts((uint16)ADC_Result);
LCD_Position(1u, 0u);
LCD_PrintDecUint16(ADC_Result1);
CyDelay(1000);
if (ADC_Result >= 206)
Period1 = 149; // like this
}
}
}