Friday, February 26, 2010

LED Blink pic18f4550

here is the code written in ccs :

#include <18f4550.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=4000000)

void main() {

while (TRUE) {
output_high(PIN_D1);
delay_ms(500);
output_low(PIN_D1);
delay_ms(500);
}
}

remeber to select PCH 16 bit to compile

pin1 ---> vcc
pin11 ---> vcc
pin12 ---> gnd
pin13 & pin14 ---> crystal + 20pf capacitor
pin20 ---> led+resistor(470 ohm)
pin31 ---> gnd
pin32 ---> vcc