We have written a code in C language for a microcontroller from Nuvoton , which has an ARM Cortex M4 core. Essentislly , the microcontroller is connected to three multi-channel simultaneously sampling sigma-delta convertors in cascade and gets data for 3 voltage channels and 21 current channels. The microcontroller has to essentially run RMS calculating algorithms for all channels , multiply the signed samples for voltage and current to arrive at watts and finally , run Hilbert tranform on current channels and then multiply with voltage samples to arrive at VAR values. For 24 channels total , the microcontroller , running at 84 MHz seems to do the job with the code we have written. However , when we simulate for 87 channels , the code doesn't deliver and arrays get over-run with new data before old data is processed . We suspect our algorithms and code ( all in C ) , though proven for functionality , need to be optimised ( probably by converting some or all to assembly language ) aggresively .
The optimization can be by tweaking the algorithms , changing data types or structures used or converting some/all portion to assembly language. There are Interupt service routines handling communication with ADCs over SPI .
We are an India based company dealing in power and energy measuring products . Established in 1993 . I am the technical director responsible for development of new products.