So I'm trying to measure two voltages from different sources. One of the voltages (V1) will end up looking like a square wave. I want to have the high amount of each square wave be a trigger to look at the other voltage (V2) and average it for the last second. I also want to count the number of times the wave form of V1 peaks.
What I think I should do, is have a greater than sign for the V1 reading, going to an incrementer, but how do I make it only count the wave once?
That same greater than sign will trigger recording the average of V2, but can I just always have the average of V2 for the past second?
Option 1: Acquire continuously both channels, analyze on the fly. Depends on your acquisition rate, PC you are using, amount of filtering, etc you want to make. Read voltage, simple comparison, search 1D array, take array subset.
Option 2: if hardware supports analog triggering, this can be done on hardware level - you will only need to average array. Can support much faster rates, but not all boards support it.