The acquisition routine of the mTouch CVD Framework is implemented using a library of macro functions that implement the process in assembly. This ensures we achieve an efficient, time-specific algorithm that can be both customizable and robust to external noise. This code is not intended to be touched by the end user. Any edits to this code could result in the loss of noise immunity.
As shown below, the acquisition routine performs two ADC scans. The difference between these two scans is then used to update a decimate-filtered result register. This register is only allowed to update by one count in either the up or down direction. So, for example, you must update this register 100 times to move its result 100 counts. This is done to remove high-frequency impulse noise from the signal.
The decimate-filtered result is then thrown into an accumulator so the shifts can be oversampled. Once it has oversampled CVD_SCANS_PER_SENSOR number of times, the value of the accumulator is scaled so it will fit in a 16-bit integer and then stored into one final, latched result array that can be accessed using the CVDGetSensor(i) macro.
For more information about the acquistion module, check out these help sections: