Hi everyone,
I am new to the forum and this is my first day trying to program a PIC. I have created a small program to turn a few LEDs on and off. The program seems to compile without any errors but when I try and simulate it in MPLabSIM with Special Function Registers turned on, I dont see any changes to PORTA or PORTB. What am I doing wrong? Please understand, I am trying to get the actions down for now, I will add some delays at a later time to slow down the LED's flashing frequency.
Here is a copy of my code:
I am new to the forum and this is my first day trying to program a PIC. I have created a small program to turn a few LEDs on and off. The program seems to compile without any errors but when I try and simulate it in MPLabSIM with Special Function Registers turned on, I dont see any changes to PORTA or PORTB. What am I doing wrong? Please understand, I am trying to get the actions down for now, I will add some delays at a later time to slow down the LED's flashing frequency.
Here is a copy of my code:
Rich (BB code):
; Program Functions:
list P=16F690
include "C:\Program Files\Microchip\MPASM Suite\P16F690.inc"
;============================
;Declarations:
porta equ 05h
portb equ 06h
portc equ 07h
goto Start
;============================
;Subroutines:
Init clrf porta ; Resets the input/output ports
clrf portb
clrf portc
movlw b'0000' ; Setting all a ports to output
movwf porta
movlw b'00000000' ; Setting all b ports to output
movwf portb
retlw 0
;============================
;Program Start:
Start call Init
Main bsf porta,0 ;Turn on LED on porta
bsf portb,0 ;Turn on LED on portb
bsf porta,1 ;Turn off LED on porta
bsf portb,1 ;Turn off LED on portb
goto Main ;Loops back to Main
END
Last edited by a moderator: