Find the point in array when polarity changes then restart array - compute space been these zero crossing to get frequency - use a variable phase timer to start saving your data in array - and adjust array size to adapt to exactly half or full cycle using a ti...