Attached is the code which demonstrate how to measure average voltage of an AC signal using PSoC1. Following is the code flow:
Analog to Digital Conversion->Rectify and accumulate the samples->check if integral number of full cycle sample is acquired->divide the sum with the total number of sample->Print the average on the LCD.
Some samples may be missed due to processing delay . In order to avoid that ADC output is collected inside the interrupt and filled into a buffer.Hope this will help.