This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DMA Problem!!! please help

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:

          u[0]=((float)ADC_Data[0])*3;
                sprintf(str,"%.2fv   ",u[0]);
                LCD_SetPos(0,0);
                LCD_String(str);

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

Parents
  • Hello and thanks for replay
    what i meant by slow :
    when using float lcd scans is very fast and not noticable and the lcd flickers from speed regardldess of halt delay .. i removed halt delay because the scanning was very slow
    anyway i was working with this LCD library and it works for sure with no problem
    but using double makes every letter when scaning needs about 300ms that means for the whole scan of line it needs 1 to 2 seconds !!
    only changing the float to double makes this happens.
    the same problem was when i didn't use .0 after the float number
    anyway this is the whole project with cubemx and Keil project
    thanks in advance
    www.mediafire.com/.../file

Reply
  • Hello and thanks for replay
    what i meant by slow :
    when using float lcd scans is very fast and not noticable and the lcd flickers from speed regardldess of halt delay .. i removed halt delay because the scanning was very slow
    anyway i was working with this LCD library and it works for sure with no problem
    but using double makes every letter when scaning needs about 300ms that means for the whole scan of line it needs 1 to 2 seconds !!
    only changing the float to double makes this happens.
    the same problem was when i didn't use .0 after the float number
    anyway this is the whole project with cubemx and Keil project
    thanks in advance
    www.mediafire.com/.../file

Children