Hi,
I am new to programming MCUs and am trying to program my MC68HC098QY4 using CodeWarrior.
In my program I am incorporating the analog-digital convertor and I have a question regarding the nature of its output in the ADR register.
Currently what I am doing is assigning the value of the ADR to an integer as such:
int adrval; adrval = ADR;
from the datasheets, I see that if the input to the ADC (analog digital convertor) is equal to Vss of the MCU, then the output is $00 and if it's equal to Vdd then the output is $FF so using my integer approach, does that mean that the output will be a linear distribution between 0 and 255 (decimal equivalent of hex FF) with no offsets?
I was browsing through the Freescale documentations and found one for program the ADC at
unsigned char result; result = ADR;
so is the result now put into a character array with 8 elements (0 to
7)? If so, do I now have to manually convert the 8 elements (each being either 0 or 1) to an integer?I am a little confused between which approach to take. Can you please clarify my questions.
Thanks in advance, Aria Kashefi