Skip to main content
Associate III
July 31, 2024
Solved

keil program with nucleo stm32xubemx

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

 

This topic has been closed for replies.
Andrew Neil
Andrew NeilBest answer
Super User
July 31, 2024

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?
A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.

2 replies

Andrew Neil
Andrew NeilBest answer
Super User
July 31, 2024

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?
A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Associate III
August 1, 2024

big thanks to your help