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.

how does SINGEN_1CH macro work?

Can anyone explain how the SINGEN_1CH macro in the F280x DPS library works?

  • Michael Nguyen said:

    Can anyone explain how the SINGEN_1CH macro in the F280x DPS library works?

    Maybe I am not specific enough in my question, so, let me repeat the question in a long-form:

    In the DCAC_SinglePhase example (this example is a part of the DPS_C280x library package), in file DCAC_main.c, I really appreciate the fact that the author lists the period for switching frequency @CPU sysclk of 100MHz, so the function call HrFullBdgBipolarDrvCnf(1667, 100) is very clear. But the following assignments of gain1, offset1, and freq1, are not explained well, such as Based on ISR freq = 30 kHz and SIN_FREQ_MAX = 0x1000 (4096), freq1 = 60 Hz (with Base frequency of 937.5 Hz = 4096*30000/2^17), is not clear, where does 2^17 come from? Where do the values of 0x4000, 0x0000, and 0x0831 come from?

             In file WaveGenMacro.h, the SINGEN_1CH macro is well commented, but there is no definition for step_max (Freq max), alpha, index. It would be nice if the accompanied document explains these terms in a graphic form, together with the scaling factor for each variable.

             The same for RAMPGEN_1CH macro.

    I would greatly appreciate your assistance, or at least pointing me to a right direction. Many thanks in advance J!