Padrão pic

Disponível somente no TrabalhosFeitos
  • Páginas : 2 (268 palavras )
  • Download(s) : 0
  • Publicado : 13 de outubro de 2012
Ler documento completo
Amostra do texto
;PROGRAMA PADRAO PIC 16 F628A
#INCLUDE <P16F628A.INC>
#DEFINE BANK0 BCF STATUS,RP0
#DEFINE BANK1 BSF STATUS,RP0
#DEFINE BANK2 BCF STATUS,RP1
#DEFINE BANK3 BSF STATUS,RP1;DEFINICAO DE PORTAS
;VETOR RESET
ORG 0X00
GOTO INICIO

; DEFINICAO DE VARIAVEIS
CBLOCK 0X20
VALOR1
VALOR2
VALOR3
ENDC
;VETOR DE INTERRUPCAO
ORG 0X04
BCF INTCON,7
MOVWFW_TEMP
MOVF STATUS,0
MOVWF STATUS_TEMP
BTFSS INTCON,1
GOTO SAI_IRQ
GOTO IRQ
GOTO SAI_IRQ
GOTO IRQ
SAI_IRQ
BANK0
MOVF STATUS_TEMP,0
MOVWF STATUS
MOVFW_TEMP,0
BCF INTCON,1
BSF INTCON,7
RETFIE
IRQ
BTFSS PORTB,1
GOTO ON
GOTO OFF
ON BSF PORTB,1
BTFSS PORTB,0
GOTO $-1
GOTO SAI_IRQ
OFF BCF PORTB,1
BTFSS PORTB,0GOTO $-1
GOTO SAI_IRQ
;MAIN
; BSF PORTB,2
; CALL ATRASO
; BCF PORTB,2
; CALL ATRASO
; GOTO MAIN

GOTO SAI_IRQ
;DEFINICAO DE VARIAVEIS
CBLOCK 0X20
W_TEMP
STATUS_TEMP
ENDCINICIO
BANK1
MOVLW B'10000000'
MOVWF OPTION_REG
MOVLW B'00000000'
MOVWF INTCON
MOVLW B'00010000'
MOVWF PIE1
MOVLW B'00001011'
MOVWF PCON
MOVLW B'00000000'
MOVWF TRISAMOVLW B'00000001'
MOVWF TRISB
MOVLW B'00010000'
MOVWF TXSTA
MOVLW B'00000000'
MOVWF VRCON


BANK0
MOVLW B'00010000'
MOVWF T1CON
MOVLW B'00000000'
MOVWF RCSTA
MOVLWB'00000000'
MOVWF PIR1
MOVLW B'00000111'
MOVWF CMCON
MOVLW B'00000000'
MOVWF TMR0
MOVLW B'00000000'
MOVWF T2CON
MOVLW B'00000000'
MOVWF CCP1CON


BANKO
; BANK1
BSFINTCON,4
BSF INTCON,7
; BANK0
MAIN
BSF PORTB,2
CALL ATRASO
BCF PORTB,2
CALL ATRASO
GOTO MAIN

ATRASO MOVLW .14
MOVWF VALOR1
LOOP0 MOVLW .7
MOVWF VALOR2
LOOP1 MOVLW.247
MOVWF VALOR3
LOOP2 NOP
DECFSZ VALOR3,1
GOTO LOOP2
DECFSZ VALOR2,1
GOTO LOOP1
DECFSZ VALOR1,1
GOTO LOOP0
GOTO LOOP4
LOOP4 NOP
RETURN


END
tracking img