pic18f45k20

Status
Not open for further replies.

rccman

Newbie level 1
Joined
Aug 31, 2010
Messages
0
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,280
Activity points
1,280
Hi all,

I just bought the pickit3 and try to learn programming using ccs compiler. I try to to get the LED light up but couldn't get the internal xtal working. please take a look at my code and see how do i make it work. any help is appreciated. Thank you.

#include <18f45k20.h>
#include <stdio.h>

#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(internal=4MHz)


void main (void)
{
set_tris_d(0);
while (1)
{
output_high(pin_D1);
delay_ms(3000);

}
}
 

Have u simulated your code on proteus? If it is working properly in simulation, then there may b problem in your circuit or configuration settings. Also try the following code in simulation.

#include <18f45k20.h>
// #include <stdio.h> // no need of this file

#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(internal=4MHz)


void main (void)
{
// set_tris_d(0); // no need of this command
while (TRUE)
{
output_high(PIN_D1);
delay_ms(3000);
output_low(PIN_D1);
delay_ms(3000);
}
}
 

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