I am trying to program a DSP (TMSF28335) using writing C codes in Control Studio V6.02.
In this project, I need to make a 90 degrees phase offset on an AC signal that I measure by the sensors. I was advised to use a circular buffer in order to make such phase shift. But unfortunately, I am not very familiar how to write a circular buffer in C language. According to the concept, I know that the "head" of the buffer should be the input signal (measured AC signal) and the "tail" is the shifted input signal that is used as the output signal of the circular buffer.
The sampling time of the system is set to 3.84599989e-5 (s) and one period is 0.02 (s) (50 Hz). So 1/4 of one period constitutes (0.02/4)/3.84599989e-5=130 samples. In the other word, I need to make 130 samples delay.
I would be grateful if you can tell me how to write the circular buffer in C for my controller and accordingly I can make phase delay.