Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] pic output is just 2.5v

Not open for further replies.

rishad babu

Member level 2
Oct 6, 2015
Reaction score
Trophy points
Activity points
323 here with a problem with pic18f4550.the output voltage is said to be 5v.but instead o get just 2.5v .i tried by disconnecting the load.even then its just 2.5v .what could be the problem...?and what could be the solution..?

Could be several things. I'm assuming you are talking about a port I/O pin.

1. the PIC is in reset state. Is it doing other things as expected?
2. the pin is set to input mode. Unless driven it will 'float' to any voltage between VSS and VDD.
3. the pin is set to analog mode. It makes it an input and connects it to the internal multiplexer instead of being an output.
4. The watchdog timer is constantly resetting the PIC. It may make it loop between being an input and output.



... or VCC is less than 5V
... or a PWM out. If you measure with a DVM you will see something between 0V and VCC.


The output port is RD5.
Its set as TRISDbits.TRISD5=0

Are you just measuring an active high TTL/ST output with a voltmeter, or seeing the waveform of a pulsed output at high frequency with an oscilloscope ?

I guess it is the voltage that has been measured by using multimeter or voltmeter. Better check the signal with the oscilloscope.

But the other voltage measurements are gives 5v in my voltmeter

Vcc is 5v itself..program output is also a lil wrong.but when i simulate it in proteus the output is the exact one i needed.

I think Enhanced CCP1 PWM output, channel B is enabled and you will be getting PWM signal only, That is the reason you are getting 2.5V as a output. Try to measure with oscilloscope for your confirmation.

maybe something like that:

     ADCON1 |= 0x0F;                         // Configure all ports with analog function as digital
     CMCON  |= 7;                                  // Disable comparators
might help..
what PIC mcu exacly are u using?

Am using using only RD ports..
When i touch on some ground points i get the output as 5v.but when i take off my hand the output again drops to 2.5v .
The Ground is common itself..

That suggests you have an electrical problem rather than software. Things to check:

1. have you connected all VSS and VDD pins?
2. do you have decoupling capacitors across VSS and VDD, mounted as close as possible to the PIC?
3. do you have a pull-up resistor fitted to the reset (MCLR) pin?
4. do you have the correct capacitor fitted between Vusb and ground?
5. do you have LVP mode selected and if so, is the PGM pin connected?


All the Vss and Vdd pins are connected.
Decoupling capacitors are also connected as close as possible.but the value is that ok...?
LVP mode is not on.
Vusb and ground are not connected through any capacitor

- - - Updated - - -

I connected a pull up resistor across the program is working perfectly.the only problm now is the output is 2.5v and when i touch any ground points am getting the output as 5v..


When i touch on some ground points i get the output as 5v.but when i take off my hand the output again drops to 2.5v .
The Ground is common itself..

is your FOSC OK ?
did you try to put a led on another output and test if the program is running well

#define LED1 LATA4_bit;
// initialise PORTA as output for RA4 
// RA4 --Led1 ----R=470--- +5V 

Led1=0;  //ON
Led1=1; //Off

what kind of power supply ?
Earth and 230V AC insulation problem ?
Try to power on your PIC with a battery (4x1,5V + LM705 regulator)


i wonder what voltmeter you use and where you connect the two wires.


You should really connect a capacitor from Vusb to ground as mentioned in the data sheet. It is part of the internal voltage regulator circuit and may have consequences in parts of the PIC other than the USB pins.

Another question: if you are using the internal clock oscillator, do you have loading capacitors ~22pF from each side of the crystal to ground? Like the supply decoupling capacitors, they should have short wires and be connected close to the PIC.

The symptoms you describe are suggesting either static charge is changing logic levels on some pins or the oscillator circuit is operating intermittently and the extra wires are enough to stop and start it. Can you post your schematic and maybe a photograph of your construction.


Yes i have connected that 22pf capacitor..but its not very close..i will try to make it as close as possible..could you tell me what should be the value of that decoupling capacitor to be connected across Vdd and Vss?i connected a 0.1microfarad ceramic capacitor

0.1uF is good enough but you should have one between each VSS/VDD pair of pins. It may work better if you also add a higher value across them as well, in parallel with the 0.1uF, I suggest 10uF. I doub't that is the problem at the moment though, the 0.1uF you already have should be sufficient to stop power line impedance problems.


Ok..i wish if thats the problem here.let me connect a 10microfarad in parallel..
Yes i have connected 0.1 acros both Vss/Vdd pins..please help me with tha value of capacitor to be connected across Vusb n ground..
I would be very happy if u could also tell me what is the purpose of that Vss/Vdd decoupling capacitor.

It's in Table 28-5 of the data sheet. Typically 0.47uF ceramic with low ESR between Vusb and VSS.

The decoupling capacitors are to ensure low impedance to high frequencies across the supply lines. The thousands of digital switches operating inside the PIC each draw a short spike of current as they operate, if you do not fit those capacitors, the inductance and resistance of the wiring to the VDD and VSS pins will cause a voltage drop in sympathy with them switching, it can be enough to disrupt operation, especially to the clock genarating circuit. The drops are fast, you need an oscilloscope to see them but it only takes a few nS of voltage change to cause errors. The capacitors work like local energy sources, close to the PIC where the energy is needed. They keep the supply voltage constant by discharging when the PIC demands current and re-charging from the supply wiring when it isn't.


Not open for further replies.

Part and Inventory Search

Welcome to