PIC16F877A Development board

Programmer, In-Circuit Debugger, PIC Start-Up Kit, Memory Interface...

PIC16F877A Development board

Postby vick5821 » Sat Jan 21, 2012 2:26 am

Hey guys, recently I tried to build a development board for PIC...but I failed .

The LED doesnt blink as what the code was.

Any suggestion or maybe my circuit error ?

Thanks

CODE: SELECT_ALL_CODE
#include <pic.h>

__CONFIG ( 0x3F32 );

#define LED RB5

void init(void);
void delay(unsigned long data);

void main(void)
{
init();
LED=1;
delay(10000);
LED=0;
delay(10000);
LED=1;
}

void init()
{
TRISA=0b00000000;
TRISB=0b00000000;
TRISC=0b00000000;
TRISD=0b00000000;
TRISE=0b00000000;

}

void delay(unsigned long data) //delay function, the delay time
{
for( ;data>0;data-=1); //depend on the given value
}
vick5821
Discoverer
 
Posts: 85
Joined: Tue Jun 28, 2011 10:21 pm

Re: PIC16F877A Development board

Postby ABSF » Sat Jan 21, 2012 6:34 am

vick5821 WROTE:Hey guys, recently I tried to build a development board for PIC...but I failed .
The LED doesnt blink as what the code was.
Any suggestion or maybe my circuit error ?

Thanks

CODE: SELECT_ALL_CODE
#include <pic.h>

void main(void)
{
init();
LED=1;
delay(10000);
LED=0;
delay(10000);
LED=1;
}
 


Your program only blink once. you have to enclose the LED on/off inside a "While(1)" loop.
CODE: SELECT_ALL_CODE
void main(void)
{
init();
while(1)
{
LED=1;
delay(10000);
LED=0;
delay(10000);
// LED=1;
}
}


Allen
The next war will determine NOT who is right BUT what is left.
User avatar
ABSF
Professional
 
Posts: 810
Joined: Wed Nov 10, 2010 9:32 am
Location: E Malaysia


Return to PIC Development Tool

Who is online

Users browsing this forum: No registered users and 19 guests