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.

I can't get my PIC running no matter what

Status
Not open for further replies.

santais

Junior Member level 1
Joined
Jan 14, 2011
Messages
18
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,474
Hey guys.

I basically tried everything to get my PIC running, both on a bread board and on a print. I have also looked into the threads here on the forum, and tried some of the different solutions, but without luck.

I did succeed in getting a program running on a bread board, where it just turned all ports on and off with 1 sec delay. However, if it turned the power supply off and turned it on again, it just stopped working.

The program has been tested and used on EASYPIC5, and it's also one of the example programs, so it most definitely work. I'm using the same pic on my EASYPIC5, bread board and print. It's a 8 MHz Xtal crystal I'm using, with 2x pF conductors.

And just a quick correction. The diagram shows that I'm using a PIC 16f877, but I'm using a PIC 16f887. The pic diagrams aren't in the program from the start, and I could only find the PIC 16f877, but it's the same pins.

My diagram of the print is as following:
**broken link removed**

The print version:
**broken link removed**



And the code is:

void main() {

ANSEL = 0; // Configure AN pins as digital
ANSELH = 0;
C1ON_bit = 0; // Disable comparators
C2ON_bit = 0;

TRISA = 0x00; // set direction to be output
TRISB = 0x00; // set direction to be output
TRISC = 0x00; // set direction to be output
TRISD = 0x00; // set direction to be output

while(1) {
PORTA = 0x00; // Turn OFF LEDs on PORTA
PORTB = 0x00; // Turn OFF LEDs on PORTB
PORTC = 0x00; // Turn OFF LEDs on PORTC
PORTD = 0x00; // Turn OFF LEDs on PORTD
Delay_ms(500); // 1 second delay

PORTA = 0xFF; // Turn ON LEDs on PORTA
PORTB = 0xFF; // Turn ON LEDs on PORTB
PORTC = 0xFF; // Turn ON LEDs on PORTC
PORTD = 0xFF; // Turn ON LEDs on PORTD
Delay_ms(500); // 1 second delay
}
}

Thanks :)
 

just try by removing that 100uF capacitor @ the MCLR pin
 
One point is that your reset line pull up resistor is to high in value. If you read the electrical spec you will see that the MCLR line has a leakage current of ~5uA which would make the voltage on MCLR lower than the supply voltage, which could lead to spurious resets. The highest value recommended by Microchip is 39K, although a more common range is 4K7 - 10K.
Also you don't need the 100nF cap as this will interfere with the programmer.

This wouldn't stop the micro running though?

The early versions of the 16f88X processor had a bug with the low voltage programming pin RB3. The solution is to tie RB3 to ground if it is not being used.

The 16f88X range also has a configuration debugging option thats set in the configuration register. You haven't shown your configuration.
Typically,

__CONFIG(XT & WDTDIS & PWRTEN & MCLREN & BOREN & IESODIS & FCMDIS & LVPDIS & DEBUGDIS);

__CONFIG(BORV21 & WP2);

Make sure that is set to DEBUGDIS and not DEBUGEN otherwise it wont start.
 
make the MCLR pull up resistor 10K
remove that capacitor on MCLR PIN
Verify your supply voltage
check your configuration that you haven't enabled the WDT
 
Wauw thanks for the fast replies. I'm definitely going to try it out when I get home tomorrow. Leave the capacitor, 10k ohm pull up resistor. I can't quite remember my configuration, since I just use the standard config, which is in the compiler that came with the easypic. But if it doesn't work, I'll post my configs right away :)
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top