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.

Problems with simple flashing LED program

Status
Not open for further replies.

saad

Advanced Member level 4
Joined
Jun 8, 2005
Messages
101
Helped
10
Reputation
20
Reaction score
7
Trophy points
1,298
Location
Pakistan
Activity points
2,080
I have written code in my PIC compiler "WIZ-C"

I am using simple program flashing LED on all ports but it did not work

although its simulation is 100% correct and show exactly output what i required

Programmer is also programming PIC16F877 correctly no error exist

watchdog timer=off, brown out rest=off

XT is the oscillator type i also tried RC circuit
in RC circuit i used RC is the oscillator type
Mclr pin is connected to 5V

Oscillator is working properly i checked it on OSCILLOSCOPE

I have different types of oscillator 4MHz , 10MHz and 12MHz are all in good conditions and working properly i also checked it in Oscilloscope

when i use red wire of function generator to CLKIN pin and floating ground pin it work properly but if i grounded the black wire led does'nt flash

I also tried RC circuit 11.36KΩ with 22pF capacitor but also failed what can i do:cry::cry::cry::cry::cry::cry::cry::cry::cry:

i tried different configuration of oscilator and burned the PIC but after insert in bradboard i failed to execute the circit :cry::cry::cry::cry::cry::cry::cry:

Plz provide me the solution
I shall be very thankful to you
 

Re: Please Help me

Did you set the port A pins to digital?

Make sure you have this in your code:

MOVLW 0x06 ; Configure all pins
MOVWF ADCON1 ; as digital inputs
 

Re: Please Help me

Did you set yor TRISx registers to output?
Are you using LATx registers to output values?
 

Re: Please Help me

I have done it but problem is same actually saad is my group member
 

Re: Please Help me

Can you post the code please?
 

Re: Please Help me

Salam,

try making a flasher for one pin only (RB0) so as to know if the problem in harware or software.

i don't think that u can supply all this current

please submit the schematic & code

hope that helps
 

Re: Please Help me

#include <displays.h>
#include <delays.h>
#include<P16F877.h>

#__config _CP_OFF & _BODEN_ON & _WDT_OFF & _PWRTE_ON & _RC_OSC & _LVP_OFF

//////////////configuration register=0x3F73 PortB is disable to pull up

void main ()
{

#pragma asm
CLRWDT;
#pragma asmend



ADCON1=7;

TRISA=0x00;
PORTA = 0;

TRISB=0x00;
PORTB = 0;

TRISC=0x00;
PORTC = 0;

TRISD=0x00;
PORTD = 0;

TRISE=0x00;
PORTE = 0;


while(1)
{
Wait(100);
PORTA = 0;
PORTB = 0;
PORTC = 0;
PORTD = 0;
PORTE = 0;

Wait(100);
PORTA = 255;
PORTB = 255;
PORTC = 255;
PORTD = 255;
PORTE = 255;

} // end of while
}//end of main


Pin#1 (MCLR) is connected to +5V
Both vdd is connected to +5V
Both Vss is ground
For OSC1/CLKIN
+5V
|
|
|
|
|
|
\
/
\ 3.3KΩ
/
OSC1/CLKIN_____\
|
|
|
|
|
______
______ 100pF (1.5MHz)
|
|
|
|
|
___
= Ground
 

Re: Please Help me

What compiler are you using?
Have you tried simply turn on 1 LED from a one pin without all the delays and other stuff?
Try to use XT osc option
 

Re: Please Help me

I think you have problem with hardwere. I make code in basic for you for 877A and one led on portb.0 this led blink every one second. Pic is ruuning on 4 MHz. I send you hex file. Only put this file in pic with programmer,
if OK you's hardware is probably OK
Best regards
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top