In some cases, we need to measure two channel signals synchronously. For example, we need to measure the voltage signal and current signal synchronously if we want to measure the power of some equipment.
PSoC1 supplied DUALADC component to some family parts which can be used to sample two inputs simultaneously, but PSoC3 only supplied a configurable DelSig ADC. So, how can we measure two inputs with only one ADC?
Creator supplied Sample/Track and Hold component which can work together with Analog Multiplexer Sequencer component to realize the synchronous sampling of two channels.
The top design like below:
In the design, PWM module is used to supply drive clock to two Sample/Track and Hold components which are configured “Track and Hold” sample mode in the design. Counter, two interrupts and Control Register are used to promise correct timing to DelsigADC soc terminal. The key point to realize synchronization is to make sure that on every Track/Hold cycle (PWM output cycle), the output of Control Register needs to trigger SOC of ADC twice. So, ADC can convert both of the two held samples in the same one cycle with switch the Analog Multiplexer Sequencer. The reason why we not using HwMux here for switching is HwMux can only connect to GPIO input, it won’t work in this design.
Demo project is attached for reference.