In ST motor control code I have a section that compiles with warnings in the STM32CubeIDE & build okay but in Keil MDK gives an error and won't build.
#define PH_KIDIV_LOG 38 #define PH_KDDIV_LOG 10 #define PH_KPDIV (1<<PH_KPDIV_LOG) #define PH_KIDIV (1<<PH_KIDIV_LOG) #define PH_KDDIV (1<<PH_KDDIV_LOG) PID64_Handle_t g_PhaseLockPID = { .hDefKpGain = 27586, .hDefKiGain = 22611, .wUpperIntegralLimit = (int64_t) IQMAX * (int64_t)PH_KIDIV, // HERE
The left shift is 38 but it is a 64-bit word. This is error #63: shift count is too large. Can someone explain why I get the error in this case? How can I fix this or make Keil ignore it?
Thanks so much for the quick response & the explanation. Much appreciated ;)