cancel
Showing results for 
Search instead for 
Did you mean: 

keil program with nucleo stm32xubemx

meriarajagukguk
Associate III

if i have

 int angka_test = 10;

int a;

while (1) {

output = output_start + ((output_end - output_start) * (angka_test - input_start)) / (input_end - input_start);

a = angka_test;

__HAL_TIM_SET_AUTORELOAD(&htim2, output); }

 

why 'a' if i seee form watch is 0, but angka_test=100, help me

 

1 ACCEPTED SOLUTION

Accepted Solutions
Andrew Neil
Evangelist III

Please see the posting tips for how to properly post source code:

https://community.st.com/t5/community-guidelines/how-to-write-your-question-to-maximize-your-chances-to-find-a/ta-p/575228

It should look something  like this:

int angka_test = 10;
int a;

while (1) {
   output = output_start + ((output_end - output_start) * (angka_test - input_start)) / (input_end - input_start);

   a = angka_test;

   __HAL_TIM_SET_AUTORELOAD(&htim2, output); 
}

 


@meriarajagukguk wrote:

why 'a' if i see from watch is 0, but angka_test=100, help me


Perhaps provide a screenshot of how you're seeing this, and a detailed description of how you get there?

Note that Keil is a 3rd-party products - nothing to do with ST - so you really need to be asking Keil about specific issues with their tool:

https://community.arm.com/support-forums/f/keil-forum

Two things to note:

  1. Optimisation: in the code shown, you never use the value of a - so it's likely to have been optimised away;
  2. Understand how Keil updates its "Watched" values - maybe what you're seeing is just "out of date", because the display hasn't updated?

View solution in original post

2 REPLIES 2
Andrew Neil
Evangelist III

Please see the posting tips for how to properly post source code:

https://community.st.com/t5/community-guidelines/how-to-write-your-question-to-maximize-your-chances-to-find-a/ta-p/575228

It should look something  like this:

int angka_test = 10;
int a;

while (1) {
   output = output_start + ((output_end - output_start) * (angka_test - input_start)) / (input_end - input_start);

   a = angka_test;

   __HAL_TIM_SET_AUTORELOAD(&htim2, output); 
}

 


@meriarajagukguk wrote:

why 'a' if i see from watch is 0, but angka_test=100, help me


Perhaps provide a screenshot of how you're seeing this, and a detailed description of how you get there?

Note that Keil is a 3rd-party products - nothing to do with ST - so you really need to be asking Keil about specific issues with their tool:

https://community.arm.com/support-forums/f/keil-forum

Two things to note:

  1. Optimisation: in the code shown, you never use the value of a - so it's likely to have been optimised away;
  2. Understand how Keil updates its "Watched" values - maybe what you're seeing is just "out of date", because the display hasn't updated?
meriarajagukguk
Associate III

big thanks to your help