Hi Fabio, I answer to your question:
1- Did you enabled the bandgap reference voltage ? This is done by the BGBE bit in SPMSC1 register.
Yes, I enable the Bandgap buffer
SPMSC1 = 0x1D; // BGBE = 1 from datasheet pag 121 Bandgap buffer enable
2- You can read the ADC result using 16-bit variables, just write: Href_code = ADCR; or Lref_code = ADCR;
Thanks for this suggestion; I don't know this. I always used 2 variable to read separately H. and L. ADC data register.
A question. If I want to work in this way it's necessary that I define result data format 10 bit when I define ADC result data format?
3- You will probably want do disable the digital input buffers on the pins operating in analog mode. You can do it setting the corresponding bit in APCTL1 register.
Excuse me but I have confusione. If I use a pin with analog input for ADC, this pin must to be enable or disable ( APCTL1_ADPCpin = 0 or 1) for I/O control ?
4- What is your ADC clock and sampling time? Maybe you are not sampling long enough.
To define clock time I use devices Initialization tool and I have: 1152 KHz for frequency and 37,87us.
--------------------------------------------------------------------------------------------------------------------------------
I try to change pin (pin1
TA1 or pin2
TA2) to sample a generical voltage but the result is not right.
But I realize that the result of the ADC conversion is always the same. I read always the same with GND (I dont't read 0) or Vdd (I don't read 1023) or a generical voltage with an external power supply(I don't read the right voltage conversion).
Why?
Thanks in advance for your help.
Gardo