If ADCINC14_fIsDataAvailable() used to return available data consistently and code inside executes properly, but now ADCINC14_fIsDataAvailable() always returns false after less than a minute of executing the code, what could be the problem?
The code hasn't changed, but now I do not get any data anymore. Could the PSoC be damaged and I just need to replace it?
ADC_Filter1[Ptr1] = ADCINC14_iClearFlagGetData();
/* Simple moving average filter stage 1 */
Filter1_Result += ADC_Filter1;
/* Wrapping around the Filter1 pointer */
if(Ptr1++ == FILTER1_DEPTH)
Ptr1 = 0;
/* Providing first stage result to second stage current pointer */
ADC_Filter2[Ptr2] = Filter1_Result >> SHIFTER;
/* Second stage filter reset to current value of the change is more than noise threshold */
if (((ADC_prev_Value - ADC_Filter2[Ptr2]) > THRESHOLD) || ((ADC_Filter2[Ptr2] - ADC_prev_Value) > THRESHOLD) && (ADC_Filter2[Ptr2] !=0))
ADC_Filter2 = ADC_Filter2[Ptr2];
/* Simple moving average filter stage 2 */
Filter2_Result += ADC_Filter2;
ADC_prev_Value = ADC_Filter2[Ptr2];
/* Wrapping around the Filter2 pointer */
if(Ptr2++ == FILTER2_DEPTH)
Ptr2 = 0;
/* Final shift to divide for moving average filters output shift */
Filter2_Result = Filter2_Result >> SHIFTER;
UART_DB_CPutString("No ADC data\r\n");
I think there's something going on in the filter portion, if I comment the filter out and place the ADCINC14_iClearFlagGetData() directly in the UART_DB_PutSHexInt(ADCINC14_iClearFlagGetData()); it works without hanging.