From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Power Electronics Development Center

cancel
Showing results for 
Search instead for 
Did you mean: 

timing error

Hey

So i change the theta generation, speed encoder, and pwm blocks into while loop and the code can be successfully compiled. However, I still have one question, I change a bit of the FXP triangle(SCTL) vi to work in while loop. The new vi I got is attached, this vi if works in SCTL it can generate 10k Hz triangle waveform (which is the frequency I desired ). However if I put the same block in while loop, it can give me some right waveform up to 5Khz and if I want 10kHz it gives some frequency between 8.5 and 12.5Khz . No matter how I choose the while loop ticks number it wont work

Please tell me where I did wrong

Thank you

0 Kudos
Message 11 of 12
(417 Views)

In a PWM modulator, the carrier generator, which is often based on a counter, must be executed inside a SCTL.

In this case, each execution results in a constant time step equals to a single clock pulse.

When it is executed outside a SCTL, you cannot control the time-step resulti, often, in a different switching/sampling frequency.

Moreover, you can use integer data type instead of FXP.

If you need higher PWM resolution, you can link the SCTL to a higher derived clock. I run my PWM modulator and its scheduler @ 120MHz.

0 Kudos
Message 12 of 12
(417 Views)