input and output ports - sel.eesc.usp.br

25
Input and Output ports

Upload: others

Post on 14-Jan-2022

0 views

Category:

Documents


0 download

TRANSCRIPT

Input and Output ports

PIC16F84A

PIC16F628A

Pin 11 serves only for the implementation of the 5th bit of port B (RB5)

Power-on default = 1

Port B: Input Operation Power-on default = 1

Port B: Output Operation

STATUS EQU 0x03BSF STATUS,RP1; Change to Bank 1

MOVLW B’00000101’; RB0 e RB2 como entradas; RB1, RB3 a RB7 como saídas

MOVWF TRISB; Aplica as configurações à porta B

MOVLW B’10100010’; (W)=0xA2MOVWF PORTB; (PORTB)=(W)=0xA2

; RB1=1,RB3=0,RB4=0,RB5=1,RB6=0, RB7=1; No effect on RB0 and RB2 due to be; configured as input

BCF STATUS,RP0; Change to Bank 0

PIC16F84A/628A

When used as output use a pull-up resistor

STATUS EQU 0x03BSF STATUS,RP1; Call Bank 1

MOVLW B’00000101’; RA0 e RA2 como entradas; RA1, RA3 e RB4 como saídas

MOVWF TRISA; Aplica as configurações à porta A

MOVLW B’10100010’; (W)=0xA2MOVWF PORTA; (PORTA)=(W)=0xA2

BCF STATUS,RP0; Call Bank 1