Hello i am trying to build a simple DMA program to read ADC values and its working but not completely
the problem is here: at first this code is working 1.
u[0]=((float)ADC_Data[0])*3; sprintf(str,"%.2fv ",u[0]); LCD_SetPos(0,0); LCD_String(str);
when changed to : or even divide by 1 its not working any more and the LCD is too slow
u[0]=((float)ADC_Data[0])*3/4096; sprintf(str,"%.2fv ",u[0]); LCD_SetPos(0,0); LCD_String(str);
2. the debugger is updating the correct u[0] in this code without a problem:
but in this code not !!! why even when i put the 3 lines to comments its must not affect the u[0] value
u[0]=((float)ADC_Data[0])*3; // sprintf(str,"%.2fv ",u[0]); // LCD_SetPos(0,0); // LCD_String(str);
please please i spend hours ... hours without any success please help why the division is not working and the bug in updating u[0] value i tryied to use volatile variable double or others but always when i use division the code runs very slow
the full code is generated with Cubemx.
www.mediafire.com/.../file
i think the problem is because stm32 doesn't support the double-precision division check the file: page 16 www.stmicroelectronics.com.cn/.../dm00047230.pdf maybe thats why it takes too much time or ?? has anyone any idea please reply thanks.
The processor is running at tens of millions of cycles per second, the fact it doesn't natively support floating point in either float OR double mode shouldn't be an issue.
You're probably perceiving a strobe-scope issue, put the 1 second delay in the loop as suggested earlier. Or for that matter toggle a GPIO pin and put it on a scope, determine if it is running at human perceivable speeds, or not.
You are using an STM32F103, this is a Cortex-M3 processor, it doesn't have an FPU
NOW i understood !! i red too many threads and articels the problem is : conflict between LCD and DMA STM32f103 is not as STM32F4 it has a differnt DMA architectur anyway no LCD everything works with LCD i should edit the timing in LCD library to work but it is not a solution anyway