Unable to get some code to build and can't figure out why.

Status
Not open for further replies.

Chris244

New Member
Hello, I am very new to coding and have to do a bit for a course im doing at the moment.
(sorry if this is the wrong place for this)

I am using MPLAB to get a LED to move and am getting this fault, apart from this the rest looks good but i cant work out what it want me to do with the label as it seems ok to me?

Code:
.ASM 11 : Labels must be defined in a code or data section when making an object file

; U19A2T1-4.asm
; blinks LEDs on outputs in a rotating pattern, with input option to reverse direction
;Set microprocessor as 16F84
   INCLUDE <P16F84.INC>
; Setup processor configuration
   __CONFIG _RC_OSC & _WDT_OFF & _PWRTE_ON
; label 2 symbols as memory addresses for counting loops
J EQU 1F
K EQU 1E

SETUP:
       ORG 0 ;
       BANKSEL TRISA ;
       CLRF TRISA ;
       BCF STATUS , RP0 ;
       BCF STATUS , RP1 ;
       MOVLW 0X01 ;
       MOVWF PORTB ;
       BCF STATUS,C ;

ROTATE:
       BTFSS PORTA,0 ;
       GOTO RR
       RLF PORTB,F ;
       GOTO DELAY
RR:       RRF PORTB,F ;

DELAY:
       MOVLW 0X32 ;
       MOVWF J ;
JLOOP:        MOVWF K ;
KLOOP:        DECFSZ K,F ;
       GOTO KLOOP
       DECFSZ J,F ;
       GOTO JLOOP

DIRECTION:
       MOVLW 0X02 ;
       XORWF PORTA,0;
       GOTO ROTATE ;
       END

Any help would be great thank you
 
Your label SETUP is before your org directive. Swap them.

Mike.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…