Prova IFSP 2010 Programação de PIC - Controlador Digital
__CONFIG _CP_OFF & _PWRTE_ON & _WDT_OFF & _LVP_OFF & _HS_OSC
;*****************************************************
;Definição de comandos para a alteração da página de memoria
;*******************************************************
#DEFINE BANK0 BCF STATUS, RP0
#DEFINE BANK1 BSF STATUS, RP0
;********************************************
;Entradas: Definição das Variáveis de temporização
;********************************************
;********************************************
;Armazenamento na memoria RAM
;********************************************
CBLOCK 0x20 DelayL ;Registro de delay do byte LOW DelayM ;Registro de delay do byte MIDDLE DelayH ;Registro de delay do byte HIGH CONTADOR
ENDC
;********************************************************
;Entradas: chaves sw4 e sw5
;********************************************************
#DEFINE CHAVESW4 PORTB,0
#DEFINE CHAVESW5 PORTB,1
;********************************************
;Saidas: SEGMENTO
;********************************************
#DEFINE DISPLAY PORTD
;********************************************
;Vetor de Reset
;********************************************
ORG 0x00 ;Endereço inicial de Processamento
GOTO INICIO
;********************************************
;Vetor de interrupção
;********************************************
ORG 0x04 ;Endereço inicial de interrupção
RETFIE ;Retorno da Interrupção
;********************************************
;Inicio do Programa
;********************************************
INICIO CLRF PORTB ;Limpa a porta B CLRF PORTD ;Limpa a porta D BANK1 ;Alterar para Banco 1 BCF OPTION_REG, NOT_RBPU ;Habilita os resistores de pull-up da porta B MOVLW B'11111111' ; habilita as chaves MOVWF TRISB MOVLW B'00000000' MOVWF TRISD MOVLW B'00000000' ; habilita o display MOVWF TRISA
BANK0