2023-12-25 07:20 PM
Hi, I'm using MCSDK-5.4.5 with IAR. Currently, I'm trying to check the PWM duty cycle of each phase (A, B, C).
Luckily, I found out the variable "CntPhA", "CntPhB" and "CntPhC" inside "pwm_curr_fdbk.h" under middlewares.
The problem that I facing is how I can call to watch these three variables in "main.c" or how I can watch these three variables as "Live Watch" in IAR.
Thanks for your every suggestions and answers.
2024-01-08 02:24 AM
Hello @Agga,
Your question is more related to C code than motor control.
The variables you mentioned: "CntPhA", "CntPhB" and "CntPhC" are part of a structure called PWMC_Handle.
This structure is the first member of a wider structure, in my example PWMC_R1_Handle_t (but this depends of your configuration R1 means single shunt, if you use 3 shunts you will find R3) :
typedef struct
{
PWMC_Handle_t _Super;
....} PWMC_R1_Handle_t;
This wider structure PWMC_R1_Handle_t is instantiated in mc_config.c :
PWMC_R1_Handle_t PWM_Handle_M1 =
{
{... <-- from here we initialized _Super member of structure PWMC_Handle_t
.CntPhA = 0,
.CntPhB = 0,
.CntPhC = 0,
.SWerror = 0,
...},
...
} ;
The variable instantiating the structure is then called PWM_Handle_M1, as it is a global you will be able to find it with your debugger.
Inside it you will find the member _Super, which is another structure that will contain the values you are looking for : "CntPhA", "CntPhB" and "CntPhC".
Hope it helps.
Regards
Cedric