Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

10 bit ADC result to 8 bits?

Status
Not open for further replies.

M3GAPL3X

Junior Member level 3
Junior Member level 3
Joined
Jul 29, 2009
Messages
30
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Visit site
Activity points
1,521
adc result registers justified

Hi guys,

Quick question. What is the best way for me to convert a 10 bit ADC result (it uses two registers - ADRESL and ADRESH to store the results in either a left or right justified manner) into 8 bits? I will need to take that 10 bit ADC result and eventually send it over serial.

Any guidance would be much appreciated!
 

how to convert 10 bit result to 8 bit result

Hi,

If you set your ADC to save the result Left Justified, bits 9 - 2 are stored in the ADRESH byte, so just use that, it also preserves bits 0-1 in ARESL.

You can see examples of what I mean in the chips datasheet.
 
n bit adc explanation

Thanks WP100 that makes sense. I'll go ahead and try it
 

adc result ,right justify

either left justify them, or right shift the 10-bit results by 2 bits.
 

    M3GAPL3X

    Points: 2
    Helpful Answer Positive Rating
16f687 diagram

Thanks guys. My question is, if I left shift them, I will have 8 bits in the ADDRESH register and 2 bits in the ADDRESSL register. Should I not care about the 2 bits in the ADDRESSL register?
 

usar el adc 10 bits con en el pic

Hi,

Think you are missing the point about AdresH and L.

Don't know which chip you are using - not all datasheets give a clear explanation of adc justification - if you look up the PIC 16F887 datasheet - fig 9.3 on page 102 shows a clear diagram.

For the 8 bit result you just copy ADRESH to your working resigister - no need to shift or anything - the 2 LSBs in ADRESL are what you want to loose anyway according to what you said earlier ?
 
how to store 10bit adc in 2 registers

Thanks WP. I understand now. I will be using a PIC 16F687.

Thanks again!
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top