BTFSS INSTRUCTION IN ASSEMBLER FOR PIC18F
In this sample, we show that how to use a switch input to make an action.
Remember that I can teach you or help you in your projects. If you interested please ask at:
postgraduatecahg@gmail.com
list p=18f2550
include "P18F2550.INC"
;Bits de configuration
CONFIG FOSC = HS
CONFIG PWRT = OFF ; Power-up Timer OFF
CONFIG BOR = OFF ; Brown-out OFF
CONFIG WDT = OFF;
CONFIG MCLRE = ON
CONFIG PBADEN = OFF
CONFIG LVP = OFF
CONFIG DEBUG = OFF
CONFIG XINST = OFF
; CODE ******************************************************
#define Led PORTB, 4
ORG 0x00
; start from 0x00 address
GOTO START
;jump to start label.
ORG 0x50 ; space for IRS
START
MOVLW 0x0F;
MOVWF TRISA
CLRF PORTB; PORTB = 0x00
CLRF TRISB;
MOVLW 0x0F;
MOVWF ADCON1
LOOP
BTFSS PORTA,0;skip next instruction if RB0 = 1
GOTO LEDOFF; RB0 = 0,
BSF Led; LED is on now
BRA LOOP ; Branch to START
LEDOFF
BCF Led; LED is OFF.
BRA START
END;END of program.
You can ask by my course in Spanish.