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.
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.
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?
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 ?