• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top