Hello All, New question. Sorry if asked already. I need to find the quickest way to convert my ADC value (10bits) into digits format. Need to show this result in an Oled Display using my digit fonts in this format; "X.XXX", where max value to show is 5V, so as an example and assuming my ADC is reading half voltage (0x0200) it would show on display "2.500". Have my code (working ok) here, but wanted to know if there is any better / faster way to do it;
CODE: mmVal = (dword(mVal) * 5 * 1000) / 1024 vShowValU = mmVal / 1000 vShowValD = (mmVal - vShowValU * 1000) / 100 vShowValC = (mmVal - vShowValU * 1000 - vShowValD * 100) / 10 vShowValM = mmVal - vShowValU * 1000 - vShowValD * 100 - vShowValC * 10 -- OLED_0in95_rgb_DisplayImage(10,20,byte(vShowValU),fColorH,fColorL,fColorMH,fColorML,20) OLED_0in95_rgb_DisplayImage(25,20,10,fColorH,fColorL,fColorMH,fColorML,20) -- Decimal DOT OLED_0in95_rgb_DisplayImage(40,20,byte(vShowValD),fColorH,fColorL,fColorMH,fColorML,20) OLED_0in95_rgb_DisplayImage(55,20,byte(vShowValC),fColorH,fColorL,fColorMH,fColorML,20) OLED_0in95_rgb_DisplayImage(70,20,byte(vShowValM),fColorH,fColorL,fColorMH,fColorML,20) Thank you all. Cheers. Filipe Santos -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/faab018f-fd46-488a-82ba-a898d98c5128n%40googlegroups.com.
