I use the "NCO_FIXED_DUTY_MODE" and "CWG_MODE_HALF_BRIDGE" to control a half-bridge. This works fine!
To set the frequency at 55kHz I need to fill the NCO varible with 7256d.
But for better understanding I like to use a simple calculation/description.
Code:
Freq = (55000 / 7.58); // Here I can see immediately the frequency is 55kHz.
set_nco_inc_value(Freq); // = 55kHz
I also have a simple while loop as you can see underneath:
Code:
Freq = (75000 / 7.58); // Here I can see immediately the frequency is 75kHz.
while (Freq > (55000/7.58)) // And here it's 55kHz
{
......... code
set_nco_inc_value(Freq);
delay_us(50);
}
I thought the compiler does this calculation and converts to a constant but it's not.
When I open the .LST file this calculation is fully performed in the program and uses a lot of memory and time.
Probably a silly question but any help is welcome.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum