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.

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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top