Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com 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] Only 1.6v~1.8v on pins after programming (16F877A)

Status
Not open for further replies.

m3_catalin

Newbie level 4
Joined
Apr 6, 2010
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Iasi
Activity points
1,325
Hi,
This is my problem :
I made a simple program to flash some leds on PORTB and after programming I only have a constant value (~1.6V or 1,8v)on any pin of the PORTS A,B,C,D,E.
I use PICKIT2 and MPLAB.All goes well, the PIC is detected, programmed with no errors.


This is the code:

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <htc.h>
#include <stdio.h>
#include <time.h>
 
 
 
void delay() //functia delay
{ 
unsigned int i;
for(i=0;i<10000000;i++);
}
 
void main()
{
 
    TRISA = 0; // Port A pins are configured as outputs
    TRISB = 0; // Port B pins are configured as outputs
 
while(1)
{
            
 
PORTA = 0X00;
PORTB = 0X00;
delay();
PORTA = 0XFF;
PORTB = 0XFF;
delay();
 
 
}
}




these are my bits configured:

3.jpg
this is my schematic:
1.jpg
and this is my board:
2.jpg


Where I am doing wrong ?
Thanks
 
Last edited:

try making your delay longer (lets say 10000 instead of 100), do you get a different voltage?
 

There's no difference, that's not the problem.
I simulated the program in proteus and it works fine.

I have 5 volts on Vdd (pins 11, 32), 5v on MCLR when I start the microcontroller after programming, PGD and PGC are linked to the pins 40 and 39 like they should be.
The microcontroller is ok because I tested it at school with another development board from my professor.
I even replaced the oscilator with another one but it's the same thing.

Something is wrong with the programming I think..

thanks
 
Last edited:

The delay you are using is very low so you get a mean voltage in the pin.
Use a high delay and measure again, use 100000 of more, try to make the output change at a rate that the voltmeter can measure like 1/sec

Alex
 

there's no difference I've tried that.
each pin of the uC gives me just 1.6v, no matter how I program it.
thanks
 

are you sure that the delay is not optimized by the compiler?
try volatile unsigned int i;

also try to set PORTA=0xff; anf PORTB=0x00; without any switching
then measure is you get 5v and 0v

Alex
 

also if possible put a breakpoint on each of the states and measure the voltage while stopped.
 

How do you dirve LEDs directly from the PIC IOs? Please send driving scheme also. May be HW problem.
Or just turn on the LEDs and measure again... ) Remove on and off sequence in your code
 

Thanks for the answers.
I've done all of that but there's no change.The leds are connected though a 330ohm rezistor in front of the anode to ground. PIN-REZISTOR-LED-GND
I've tested about an hour ago the pic with another development board and it works ok, it brings 5v to the PORTB pins and this concludes there's no problem with the PIC.(the same .hex- the code is ok also)
There is something with the board but I cannot figure what.
Please post some development board schematics here if you have so I cand compare them with mine.
Thanks a lot for your support.
 

What speed XTAL are you using?? Sounds like you could be loading one of the outputs which stops there being sufficient current to drive the other pins, that or your PIC is buggered!
 

I'm using a HS 4Mhz with 15 pF capacitors.

I solved all the problems:
1-the LED from alimentation was sucking a lot of current from my board,it was a superbright one-got rid of it(probably I'll mount it again with a bigger rezistor in anode~10kohm instead of 330ohm)
2-the dc jack plug was the second problem-when fully inserted the board is not runing, it works fine with the jack plug half way inserted though.

thank you for all your answers guys !
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top