Professional Documents
Culture Documents
MOVLW 0x0
MOVWF TRISB
L1 MOVLW 0x55
MOVWF PORTB
CALL DELAY
MOVLW 0xAA
MOVWF PORTB
CALL DELAY
GOTO Ll
Gaby A.H- M.S. Fall 2017 - 2018
• TRIS register role in inputting data
▫ To make a port an input port, we must first put ls into the TRISx register
for that port, and then bring in (read) the data present at the pins.
▫ Notice that 0 stands for out and 1 for in.
▫ This is easy to remember because 0 and O look alike the same way that I
looks like 1.
• Example:
BSF TRISB,2
CLRF TRISC
BCF PORTD,3
MOVLW 0x45
AGAIN BTFSS PORTB,2
BRA AGAIN
MOVWF PORTC
BSF PORTD,3
BCF PORTD,3
BSF TRISB,3
BCF TRISC,5
HERE BTFSC PORTB,3
BRA HERE
BSF PORTC,5
BCF PORTC,5
BRA HERE
BSF TRISB,0
BCF TRISB,7
AGAIN BTFSS PORTB,0
GOTO OVER
BSF PORTB,7
GOTO AGAIN
OVER BCF PORTB,7
GOTO AGAIN