.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