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.

what is problem with my pic16f877a

Status
Not open for further replies.

aa_mane3

Newbie level 4
Newbie level 4
Joined
Jun 7, 2013
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,324
hello ,
I USE PIC16F877A FOR BUILDING SIMPLE LED ON OFF PROGRAM USING MIKRO C PRO SIMULATION SOFTWARE.
I BUILD IT SUCCESSFULLY. BUT WHEN I TRY IT ON HARDWARE , MY LED WILL GLOW CONTINUOUSLY, SO WHAT IS PROBLEM ?? AND IT WORK SUCCESSFULLY IN PROTEUS SOFTWARE.
I USE 8MHz CRYSTAL OSCILLATOR AND 33pF TWO CAPACITORS ....
HERE IS MY CODE ........

void main() {
// set PORTB to be digital output
TRISB = 0;
// Turn OFF LEDs on PORTB
PORTB= 0;
while(1) {
// Toggle LEDs on PORTB

PORTB = ~PORTB;
// Delay 1000 ms
Delay_ms(1000);
}
}
 

try something in between 15-33pF, like 12 or 22pF caps.
And be sure your MCLR pin is tied to VDD via resistor.
 

Simulation is tool for check ur logic. Check Reset Circuitry . Check code for Crystal setting not Capacitor. Capacitor Affect but not 15f or 33pf value to much. Check config Resistor.
 
how to check code for crystal setting in Mikro c pro. In MIKRO C PRO default configuration setting is available for pic16f877a

- - - Updated - - -

how to check config reg. in mikro c pro
 

Sorry but i DON'T know mikro C detail but in MPLAB u can easily config as well as check bit set
 

i think in MIKRO C PRO no need to set config bits.........
 

It is because of configuration setting...post the configuration bits you have already.
 

please it's urgent any one help me ....................
 

first of all the xtal used is inappropriate ,try 20mhz and check if your reset button is still working,if its not then you might have installed the PIC with opp polarity on vdd vss ,otherwise it shud have worked,sometimes placing the PIC with its nodge in opp direction actually damages its internal registers and this causes such issues.
 

Check the working of LED with another pin of another port. Maybe the pin has become direct and it is sinking or sourcing current directly.
 

To see the config, use the keys CTRL + SHIFT + E.

Post the full project!!!
 

First of all, PORTB has pullup resistors. You need to clear this pull up resister using RBPU register or you can refer Control registers which contains information about this RBPU.
If Pull up is off, you can try the below method.

You can find where the problem exists by doing this.
Apply break point in main function before while(1) while debugging.
For sake, I would suggest you to put break point in TRISB=0 line.
void main() {
// set PORTB to be digital output
TRISB = 0; // Apply your break point here.
// Turn OFF LEDs on PORTB
PORTB= 0;
while(1) {
// Toggle LEDs on PORTB

PORTB = ~PORTB;
// Delay 1000 ms
Delay_ms(1000);
}
}

If the program hits that break point more than one time, you are having some problem with your reset connection. Else, try to increase the delay function. say for 3 seconds.

while(1) {
// Toggle LEDs on PORTB
PORTB|=0x01; //If LED is connected in RB0
Delay(500);
PORTB&=~0x01;
}
 
thank you all of you , finally it worked.
 

Where was the problem?
Please post it here. Some one in future, could be helped. :)

Apparently it was ONLY important to themselves.... a product of what the cell phone and computer abuse gives you..!
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top