Dear
I use CodeWarrior 11.1. I am a bit confused about the PE setting of IO_MAP.h of ADC channel.
The IO_Map.h show the ADCH0 is 0x01U, ADCH1 is 0x02U and so forth.
But the MC9S08PA4 Reference Manual, Rev. 6, show the AD0 of ADCH is 0, AD1 of ADCH is 1 and so forth.
if I want to get ADC value of AD0, how can I get it?
Is it use below
ADC_SC1 = ADC_SC1_ADCH0_MASK;
or
ADC_SC1=ADC_SC1_ADCH_BITNUM;
Kris
Hello Kris,
They are not contradictory.
"#define ADC_SC1_ADCH0_MASK 0x01U " in the IO_Map.h just some Macros.
The Table9-2 shows how to set ADCH bits when config Input channel.
"if I want to get ADC value of AD0, how can I get it?"
-> I guess you meaning how to select AD0, the answer is
ADC_SC1 = 0x00; ( haven't consider other bits of ADCSC1 Register, only ADCH)
I recommend you refer to the demo code under "Help on Component" of ADC component :
Have a great day,
TIC
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Dear Alice Yang
-> I guess you meaning how to select AD0, the answer is
-> ADC_SC1 = 0x00; ( haven't consider other bits of ADCSC1 Register, only ADCH)
So I can't use ADC_SC1 = ADC_SC1_ADCH0_MASK, because it mean ADC_SC1 = 0x1?
Kris
Yes.
Have a great day,
TIC
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Dear Alice
Got it.
So that is my doubt, I know the ADC_SC1_ADCH0_MASK just is Macros.
And tthe name of the definition will make people misunderstand.
ADCH0 is mean 0x1 for ADCH channel number 1.
ADCH1 is mean 0x2 for ADCH channel number 2.
Kris