ADC & Binary Maths

Status
Not open for further replies.

dons21

New Member
Hello all.

My ultimate goal is a volt meter for my power supply and I learning along the way.

Anyway I have a written a code which take the result of the ADC and displays it on a 7 segment display.

MOVFW ADRESH
MOVWF TEMP
SWAPF TEMP,W
andlw 0x0F
CALL Table

The code takes the top 4 bits swaps them to the lower and makes sure bits 3 to 7 read 0. This then allows me to display 0 to F (HEX) on the display.

I wish It to read 0 to 9. So I would need to divide the adc result by 25 to get 10 even steps.

Is my method correct or have I been barking up the wrong tree???

Advices and suggestions please.

Don
 
I suggest you have a read of my tutorials, which include routines for displaying both hex and decimal on an LCD from the ADC.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…