blink.bas for 18f4520 for newbie - HELP
Hi there
I am trying to get back into my pic programming hobby again (I had a lot of fun previously but had to stop becuase of other commitments)
Please could someone reply with the correct program to get my pic to blink an LED on PORT D 0
I have been trying for days now and am not having any luck.
I am using a pickit 2 and picbasic pro and MPLAB
I have also tried from Microcode studio and a few others.
I tried using the picbasic pro sample called blink.bas and it seems to compile and program but the led never blinks :-(
I went to a friend who did the same thing using a C complier and we programmed my 18F4520 with the hex from his compiler using MPLAb and it worked !!
Please also include the config bits I should use I think the ones I would like to switch off are watchdog and brown out detection.
I would also like to make us of the internal oscillator ..is it INTIO67 ??
Here is my code ..
Define CONFIG1L = 0x00
Define CONFIG1H = 0x02
Define CONFIG2L = 0x1a
Define CONFIG2H = 0x00
Define CONFIG3L = 0x00
Define CONFIG3H = 0x03
Define CONFIG4L = 0x80
Define CONFIG4H = 0x00
Define CONFIG5L = 0x0f
Define CONFIG5H = 0xc0
Define CONFIG6L = 0x0f
Define CONFIG6H = 0xe0
Define CONFIG7L = 0x0f
Define CONFIG7H = 0x40
Define CONFIG1L = 0x00
Define CONFIG1H = 0x08
Define CONFIG2L = 0x1a
Define CONFIG2H = 0x00
Define CONFIG3L = 0x00
Define CONFIG3H = 0x83
Define CONFIG4L = 0x80
Define CONFIG4H = 0x00
Define CONFIG5L = 0x0f
Define CONFIG5H = 0xc0
Define CONFIG6L = 0x0f
Define CONFIG6H = 0xe0
Define CONFIG7L = 0x0f
Define CONFIG7H = 0x40
Define CLOCK_FREQUENCY = 8
AllDigital
TRISD = 0 'Sets pin 1 on port D to an output
flip:
PORTD.0 = 1 'Turn on LED
Delay 500 'Delay for .5 seconds
PORTD.0 = 0 'Turn off LED
Delay 500
goto flip
Any help would be greatly appeciated
Kind regards
Dennis
There is NO include file for the pic 18f4520
Is that maybe why nothing is working when I program it ?
HELP !!!!!!!1