big execution time
Hi!
when I tried to run the code below at an interrupt it took 123u sec! (I measured that by toggle PGIOB7) which is too big for me . any one can advice?
I am using STM32F429 running at 70MHz (I can't increase the clk frequency for some hardware limitations)
HAL_GPIO_WritePin (GPIOB, GPIO_PIN_7,GPIO_PIN_SET);
//HAL_GPIO_TogglePin (GPIOB, GPIO_PIN_7);
D101Value=((ADC1_ConvertedValue[0]*3.3/ADC1_Full_Scale)-0)*CURRENT_SENSOR_SCALE;
D102Value=((ADC1_ConvertedValue[0]*3.3/ADC1_Full_Scale)-0)*CURRENT_SENSOR_SCALE; D103Value=((ADC1_ConvertedValue[0]*3.3/ADC1_Full_Scale)-0)*CURRENT_SENSOR_SCALE; D104Value=((ADC1_ConvertedValue[0]*3.3/ADC1_Full_Scale)-0)*VOLTAGE_SENSOR_SCALE; D105Value=((ADC1_ConvertedValue[0]*3.3/ADC1_Full_Scale)-0)*TEMP_SENSOR_SCALE1; D106Value=((ADC1_ConvertedValue[0]*3.3/ADC1_Full_Scale)-0)*TEMP_SENSOR_SCALE2; D107Value=((ADC1_ConvertedValue[0]*3.3/ADC1_Full_Scale)-0)*PRESSURE_SENSOR_SCALE; HAL_GPIO_WritePin (GPIOB, GPIO_PIN_7,GPIO_PIN_RESET);I made another trial by replacing
ADC1_ConvertedValue[0] with constant value (eg 50) to be sure if the problem from the calculation time or what. I wondered from the result where execution of (
D101Value=((50*3.3/ADC1_Full_Scale)-0)*CURRENT_SENSOR_SCALE;) took only 0.25u sec instead of 20u sec previously !!! so the long time should be spend in calling variable
ADC1_ConvertedValue[0]
from the memory and really I don't have explanation for that
