2023-10-26 12:06 AM
Solved! Go to Solution.
2023-10-27 03:36 AM
I used volatile keyword before variable, still the value of variable showing zero in watchwindow and when I stopped the execution the value changes
This is normal behavior. when you stop executing the code only you can see the variable value. If you want to see the value during run time or without stopping then install cubemonitor software.
The value of variables used in motor control code showing cannot evaluate in watch window.
Same as first what is the kind of the variable if it is Macro, or local variable or optimized you cannot watch the variable value until you stop, you need to define the variable as global variable. From the images you shared i cannot see those varibles.
2023-10-26 01:47 AM
The variable may have been optimized and the compiler may remove that variable as you are not doing anything without variable. You can define that variable as volatile and see the compiler does not optimize it.
2023-10-27 03:28 AM
first doubt
I used volatile keyword before variable, still the value of variable showing zero in watchwindow and when I stopped the execution the value changes
second doubt
The value of variables used in motor control code showing cannot evaluate in watch window.
Please let me know what the problem is and reply to me as soon as possible.
Thank you
2023-10-27 03:36 AM
I used volatile keyword before variable, still the value of variable showing zero in watchwindow and when I stopped the execution the value changes
This is normal behavior. when you stop executing the code only you can see the variable value. If you want to see the value during run time or without stopping then install cubemonitor software.
The value of variables used in motor control code showing cannot evaluate in watch window.
Same as first what is the kind of the variable if it is Macro, or local variable or optimized you cannot watch the variable value until you stop, you need to define the variable as global variable. From the images you shared i cannot see those varibles.
2023-10-27 04:02 AM
Kindly check image1 . I declared variable as global .
volatile uint16_t val1; like this
2023-10-27 05:23 AM
i am talking about the voltage_mode and potentiometer in your pain2.png image.
2023-10-27 05:29 AM
2023-10-27 06:02 AM - edited 2023-10-27 06:05 AM
It is a Macro and not a variable. It is a pre processor directive before compilation step. Hence it can not be seen in watch window.
2023-10-30 10:54 PM
Good morning sir,
I want to debug in keilv5 software. so i dont required cubemonitor software.
2023-10-31 03:37 AM
I am using the ST Cube ide. i have no idea of Keil software and the related tools.