This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: Code Composer Studio
I have used ramp generation to generate sine wave by using following.
RAMPGEN_IQ Ramp;
RAMPGEN_IQ_init(&Ramp);
Ramp.Freq = _IQ24(GRID_FREQ);
Ramp.StepAngleMax = _IQ24(1.0/ISR_FREQUENCY);
RAMPGEN_IQ_MACRO(Ramp);
InvSine = _IQsinPU(rgen1.Out);
I have input of one sine wave to detect frquency, i can detect frquency and zero crossing.
I can change the output frquency with input and can changing Ramp.Freq variable.
I want to sync ramp output of zero crossing with input.
can you pelease help me on this.
Thanks,
Jignesh Patel
Jignesh,
I am not able to understand your request properly - can you please elaborate?
Thanks,
Sira
Thanks Sira,
I have one sine input for zero crossing and frequency calculation. I can successfully detected that.
I am generating sine pwm using ramp as following
RAMPGEN_IQ_init(&Ramp);
I can able to change frequency from following
Ramp.Freq = _IQ24(GRID_FREQ);
I am getting phase different between input and output.
how can I phase lock with input and output?
Thanks,
Jignesh
Jignesh,
If I understand correctly, you are generating a Ramp wave using the SGEN library, and then computing the sin of that using the _IQsinPU(). So that should generate a sine wave. This is correct.
I replicated the experiment with the C2000Ware example (I didn't use _IQsinPU(), but a simple sin()), and I can confirm that the zero crossings of the ramp match that of the sin output. This has to be the case, because sin(0) = 0, regardless of the phase you set for the Ramp signal. The sin output will track it.
Thanks,
Sira
Thanks Sira,
"If I understand correctly, you are generating a Ramp wave using the SGEN library, and then computing the sin of that using the _IQsinPU(). So that should generate a sine wave. This is correct."
above is one part and another is:
I have on sine input(on adc vgrid) to measure frquency and dection of zero crossing. I want match my zero crossing of input sine to output sine on changing of input frequency.
let me know if you need more information.
Thanks,
Jignesh Patel
Hi Sira,
what is role of "Angle" in "RAMPGEN_IQ" of ramp genration function?
if i set Angle = 0, will start ramp sine from starting?
Thanks,
Jignes Patel
Yes, Angle refers to the phase of the ramp. If you set 0, it will start from 0. If you set 8192, it will start at 45degree phase.
See comment in code /* phase_norm =(pi/4/(2*pi))*2^16=8192 */
Thanks,
Sira
Jignesh,
I still don't understand it properly.
Do you have a block diagram picture of your system?
For example: Ramp parameters -> [RMPGEN] -> Ramp waveform -> [SIN generation] -> Sine waveform
I specifically don't understand what you mean by input sine and output sine.
Also, I am not sure how TI can help your further. The SGEN library offerings are pretty clear.
Thanks,
Sira