miyop
Newbie level 6
I'm new at PIC programming and I have a project with 18F4520. My code language is C and I use CCs C as a compiler. I wrote a code to blink a led for beginning but I couldn't achieve it. The code is very easy but I couldn't understand where the error is. The code I wrote is this:
#include<18f4520.h>
#fuses XT,NOWDT,NOPROTECT,NOBROWNOUT,NOLVP,NOPUT,NOWRT,NODEBUG,NOCPD
#use delay (clock = 4000000)
#use fast_io(b)
void main(void)
{
int a=0;
set_tris_b(0x00);
while(TRUE){
if(a>9) break;
output_high(pin_b0);
delay_ms(300);
output_low(pin_b0);
delay_ms(300);
a++;
}
}
Can anyone help me with this easy code? I don't know if I am wrong with the fuses or configuration settings.
#include<18f4520.h>
#fuses XT,NOWDT,NOPROTECT,NOBROWNOUT,NOLVP,NOPUT,NOWRT,NODEBUG,NOCPD
#use delay (clock = 4000000)
#use fast_io(b)
void main(void)
{
int a=0;
set_tris_b(0x00);
while(TRUE){
if(a>9) break;
output_high(pin_b0);
delay_ms(300);
output_low(pin_b0);
delay_ms(300);
a++;
}
}
Can anyone help me with this easy code? I don't know if I am wrong with the fuses or configuration settings.