I have recently started using a PIC18F4550, and my first attempt at programming it in assembly was to make it blink one LED on a loop. However, I do not have very much experience at programming in this language, and so had to rely on other snippets of code to get me started. My code is below:
#include<p18f4550.inc>
CONFIG WDT = OFF
CONFIG MCLRE = ON
CONFIG DEBUG = ON
CONFIG LVP = OFF
CONFIG FOSC = INTOSCIO_EC
ORG 0
Delay1 res 2
Delay2 res 2
Start:
CLRF PORTB
CLRF TRISB
CLRF Delay1
CLRF Delay2
MainLoop:
BSF PORTB,1
GOTO DelayA
DelayA:
DECFSZ Delay1,1
GOTO DelayA
BCF PORTB,1
GOTO DelayB
DelayB:
DECFSZ Delay2,1
GOTO DelayB
GOTO MainLoop
end
I cannot understand why it doesn't work, but think it may have something to do with the instruction cycle speed, which I believe is 1 MHz, causing the delays to be excessively short.
Any help greatly appreciated!