Hi Vasile, Thankyou for the heads up.
FS On Wednesday, August 3, 2022 at 5:41:53 AM UTC+1 vasile wrote: > 5V/1024=0.0049 (rounded). That means it's worth it to display max 2.50, > there is no better resolution. ( 2.500, 2.505 or 2.495 are all in the same > ADC resolution error, last digit should be then absent). > Perhaps integrating your OLED library with the format library? > > On Tue, Aug 2, 2022 at 1:33 PM flyway38 <[email protected]> wrote: > >> 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 >> >> <https://groups.google.com/d/msgid/jallib/faab018f-fd46-488a-82ba-a898d98c5128n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- 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/d88ec8fd-fe71-47c4-8bc9-339bb1f144ben%40googlegroups.com.
