After passing through PGA, the analog signal will vary from 0-3.96V. What is the Reference you are using for the ADC?
Vss is the ground (0V) which is given to the Pin of PSoC. Whereas AGND can be chosen from various options available using PSoC Designer. The Ref Mux can be used to choose the AGND value.
The options available are Vdd/2, BandGap, 1.6BandGap, 2BandGap, or Pins.
If AGND is based on Vdd, then changes in Vdd will also cause change in AGND. BandGap will remain fairly stable.
Thank you !
i set my VDD as 5V,and the ref mux is [vddd/2]+/-[vdd/2], but when i set the parameters for ADC,there are only four options:TMR CLOCK,CNT CLOCK,INPUT and CLOCKPHASE. i didn't see anything about reference.
here are the global resources settings.
psoc1.bmp 494.0 K
Once the ref mux is set to [vddd/2]+/-[vdd/2], the reference is selected internally such that now the ADC input can vary between -vdd/2 to +vdd/2.
The reference to an ADC (and other analog sections) may be selected using the "Ref Mux" parameter in the Global Resources.
Following are the various reference settings available in a PSoC with full function Analog blocks.
1. (Vcc/2)+/- bandgap
2. (VCC/2) +/- Vcc/2
3. Bandgap +/- Bandgap
4. (1.6 Bandgap) +/- (1.6 Bandgap)
5. (2*Bandgap) +/- Bandgap
6. (2*Bandgap) +/- P2
7. P2 +/- Bandgap
8. P2 +/- P2
Using options 7 and 8, an external voltage source may be used as AGND or Reference.
The Reference selected using the RefMux parameter is common to all the analog blocks.
I thought the range was 0-Vdd.but if i set the Reference as -Vdd/2-Vdd/2 and input a 5V signal ,will the result overflowed?
Addressing your original question:
1. When you say you are seeing values greater than 4096, that should be because you may have set the "DataFormat" parameter to "Signed". In this data format, the ADC gives both posive and negative results around AGND. For example, if you have set the Analog Reference parameter in the Global resources to Vdd/2 +/- Vdd/2, AGND is 2.5V. The ADC will produce a +ve value for any voltage above 2.5V and -ve value for a voltage less than 2.5V. A -ve value in 2's compliment format will look like an unsigned value greater than 4096. So, set the DataFormat parameter to Unsigned.
2. For the PGA, the reference should be selected depending on the nature of your input signal. If your input is with respect to VSS and is only +ve, then VSS should be selected as reference. If your input is a bipolar signal that can have both +ve and -ve voltages and is with respect to AGND, then set the reference to AGND. Setting the reference to AGND for a unipolar signal will produce wrong results. For example, let us take a 1.5V signal fed to the PGA with a gain of 2. If you set the reference to VSS, then the PGA will amplify the input with respect to VSS by a factor of 2 and you get 3.0V. But if you set the reference to AGND, and if the analog reference is Vdd/2 +/- Vdd/2, then the PGA sees a 1.5V as -1V with respect to AGND and produces an output of -2V w.r.t AGND, which is actually 0.5V w.r.t VSS. Hope this is clear.
Summarizing, for your input signal, set the PGA reference to VSS, ADC;s data format to unsigned.
The PSoC Hacker