Figure 11. LED Pulse Generation
3.3 Foreground Process
The background process notifies the foreground process through a status flag every time a frame of data is available for processing. The data frame consists of the accumulation of 50 or 60 cycles worth of data samples and is synchronized to the incoming voltage signal. At a sampling rate of roughly 65 samples per cycle, this results in approximately 3276 samples.
The data samples consist of processed current, voltage, active energy, and reactive energy information. These values are accumulated in separate 48-bit registers. In addition, a sample counter keeps track of how many samples have been accumulated over the frame period. This count can vary as the software synchronizes with the incoming mains frequency.
The foreground process (see Figure 12) uses these stored values to calculate the root mean values and the mean values.