cancel
Showing results for 
Search instead for 
Did you mean: 

Code deleted after re-generation

luke514
Senior

I generated with MC Workbench some code sa use to program an inverter. I want to plot with the monitor the value read from the potentiometer, i.e., the value stored in "rawValue"

I had managed to graphically plot on the monitor "rawValue" variable used only in the two functions "potentiometer.c" and "speed_potentiometer.c" using a variable "pot" declared in main and reported in "potentiometer.c" as external (extern uint16_t pot):

luke514_0-1729863051366.png

The problem is that when I regenerate the code with the .ioc file .. everything I wrote inside this function (fortunately only two lines) is deleted!

How can I do to avoid this problem?

 

 

 

3 REPLIES 3
GMA
ST Employee

Hello @luke514,

You have to add this code between these two comment lines (see main.c file as example)

/* USER CODE BEGIN x */
new lines
/* USER CODE END x */

If you agree with the answer, please accept it by clicking on 'Accept as solution'.
Best regards.
GMA

>>How can I do to avoid this problem?

Don't regenerate into your primary branch?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Can you explain more in detail?

Thanks