0
votes

I am using PIC18f452 in boost converter. For the control of Boost converter output voltage (200V) , i used feedback resister (R1=99K ohm , and R2 =2.5K ohm). The voltage across R2 is 5V with the input 200V.

V2 = (2.5)/(99+2.5) *200 = 4.92 V

when i want to measure the voltage at controller . i connected the controller pin to R2 resister for measurement. The value of V2 derease to 2.3V. its value never increase to 4.9 voltage. after that i disconnect the chanal ,then i measured again , its value correct that was 4.9 volts. now i am confused , what is the problem with controller. why the value of v2 decreases to 2.3v from 4.9v while connecting to microcontroller pin for measurement of this voltage .

the code s attached here. you can see the configuration of pins .

void main() {

ADCON1 =1;

PORTC = 0;

TRISC = 0;

PORTA = 0;

TRISA = 0xFF;

ADC_Init();

3
Is the pin configured to be output?Stian Skjelstad
no. TRISA=0xFF ,, that are configured as inputMisal313
i am getting at pin RA1 .. which is configured as inputMisal313

3 Answers

1
votes

There can be a lot of reasons for that.

  1. Wrong ADC TAD time, check datasheet.
  2. To short ADC sample time, check datasheet.
  3. You are using ADC configuration (ADCON1 =1) with reference Vref+ on AN3 so is 5 VDC on that pin?
  4. You are using to high ADC input impedance for good ADC results. The maximum recommended impedance for analog sources is 2.5 kΩ, check datasheet. (You need to put a small cheramic cap. parallel to PIN or buffer the input with OP amplifier.)
0
votes

You have to take care of internal ADC resistance. Connecting divider directly to pin probably would end up with changing signal characteristics. I would strongly recommend adding op amp buffer or changing the value of divider resistors.

0
votes

I had similar problem and solved it like Darko suggested, using a OpAmp voltage buffer. You can use any Opamp, I used Microchip's MCP601. This lowered the ADC input impedance to almost nothing.

At the same time, I increased your resistor's to ten times larger resistors, so they do not load the circuit you are measuring. It is not necessary, but why not to do it, when OpAmp allows it.