This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/TM4C1231D5PZ: Ever-changing ADC value.

Part Number: TM4C1231D5PZ


Tool/software: TI C/C++ Compiler

Hi,

My problem is constantly changing value as in the picture below.

Project link that I bought as a reference : https://github.com/ussserrr/maglev-ti-rtos

CODE :

empty.cfg

  • The problem I suspect is that you set up the ADC to do continuous conversions and then call ADCSequenceDataGet() in the interrupt routine. You assume that ADCSequenceDataGet() will only read two samples. But since the next conversion already started, it may be possible that a third sample has already been put into the 4 level FIFO. ADCSequenceDataGet() will read all three samples. On the next interrupt, CH15 will be the first sample in the buffer and CH7 will be the second. 

    A simple solution would be call ADCSequenceConfigure with ADC_TRIGGER_PROCESSOR instead of ADC_TRIGGER_ALWAYS and then re-enable the ADC sequence in the interrupt routine after you have read the previous results.