problem in blinking led with 16f877a

Status
Not open for further replies.

hassan khan

Junior Member level 1
Joined
Mar 25, 2012
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,370
i wrote a program in mikro c & put it into 16f877a, led didnt glow but when i touch one of the probe of multimeter with vdd pin of controller & other with osc2 then it was glowing, what is this?
please tell where i m making mistake??

code is

void main() {

TRISB = 0; // TO MAKE ALL PORT OUTPUT
PORTB = 0; // TO OFF PORTB
while(1)
{
PORTB = 0xff; // TO TOGGLE PORTB

}
}
 

USe This:
Code:
while(1)
{
PortB.F0=0XFF
Delay_ms(500)
PortB.F0=0x00
Delay_ms(500)
}
 

sorry i made mistake in title i m not blinking an led , i wanted to glow led constantly.
 

sorry i made mistake in title i m not blinking an led , i wanted to glow led constantly.



Code:
void main()
{

 TRISB = 0;    // set PORTB to be digital output

 PORTB = 1;    // Turn OFF LEDs on PORTB


while(1)
{

 PORTB = PORTB;       // LED constant on PORTB

 Delay_ms(1000);    // Delay 1000 ms
 }

}
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…