Uploaded by carmenlonginospina

CARMENLONGINOS

advertisement
00000110 1
00000000 0
00000010 0
00000100 1
; PIC16F84A Configuration Bit Settings
; Assembly source line config statements
; CONFIG
CONFIG FOSC = XT
; Oscillator Selection bits (XT oscillator)
CONFIG WDTE = ON
; Watchdog Timer (WDT enabled)
CONFIG PWRTE = OFF
; Power-up Timer Enable bit (Power-up Timer is disabled)
CONFIG CP = OFF
; Code Protection bit (Code protection disabled)
// config statements should precede project file includes.
#include <xc.inc>
STATUS EQU 0X03 ; manda a llamar estatus
PORTA EQU 0X05 ;manda a llamar PORTA
PORTB EQU 0X06 ;manda a llamar PORTB
TRISA EQU 0X85 ;manda a llamar TRISA
TRISB EQU 0X86 ;manda a llamar TRISB
PSECT code ;el codigo es ejecutable
ORG 0
// hasta aqui es lo principal y no cambia del programa
CONFIGURACION: ;ETIQUETA DONDE SE CONFIGURA
BSF STATUS,5
MOVLW 0b00000110
MOVWF TRISB
CLRF TRISA
BCF STATUS,5
ENCENDERMOTOR:
MOVLW 0b1000
MOVWF PORTA
BTFSC PORTB,1
MOVLW 0b1000
MOVWF PORTA
BTFSC PORTB,2
GOTO ENCENDERMOTOR
GOTO APAGARMOTOR
APAGARMOTOR:
MOVLW 0b0000
MOVWF PORTA
BTFSS PORTB,1
MOVLW 0b0000
MOVWF PORTA
BTFSS PORTB,2
GOTO APAGARMOTOR
GOTO ENCENDERMOTOR
END
00000110 1
00000000 0
00000010 1
00000100 0
CONFIGURACION: ;ETIQUETA DONDE SE CONFIGURA
BSF STATUS,5
MOVLW 0b00000110
MOVWF TRISB
CLRF TRISA
BCF STATUS,5
ENCENDERMOTOR:
MOVLW 0b1000
MOVWF PORTA
BTFSC PORTB,1
GOTO ENCENDERMOTOR
GOTO APAGARMOTOR
APAGARMOTOR:
MOVLW 0b0000
MOVWF PORTA
BTFSS PORTB,1
GOTO APAGARMOTOR
GOTO ENCENDERMOTOR
ENCENDERMOTOR0:
MOVLW 0b1000
MOVWF PORTA
BTFSC PORTB,2
GOTO ENCENDERMOTOR0
GOTO APAGARMOTOR0
APAGARMOTOR0:
MOVLW 0b0000
MOVWF PORTA
BTFSS PORTB,2
GOTO APAGARMOTOR0
GOTO ENCENDERMOTOR0
END
NUEVO CODIGOOOO
; PIC16F84A Configuration Bit Settings
; Assembly source line config statements
; CONFIG
CONFIG FOSC = XT
; Oscillator Selection bits (XT oscillator)
CONFIG WDTE = ON
; Watchdog Timer (WDT enabled)
CONFIG PWRTE = OFF
; Power-up Timer Enable bit (Power-up Timer is disabled)
CONFIG CP = OFF
; Code Protection bit (Code protection disabled)
// config statements should precede project file includes.
#include <xc.inc>
STATUS EQU 0X03 ; manda a llamar estatus
PORTA EQU 0X05 ;manda a llamar PORTA
PORTB EQU 0X06 ;manda a llamar PORTB
TRISA EQU 0X85 ;manda a llamar TRISA
TRISB EQU 0X86 ;manda a llamar TRISB
PSECT code ;el codigo es ejecutable
ORG 0
// hasta aqui es lo principal y no cambia del programa
CONFIGURACION: ;ETIQUETA DONDE SE CONFIGURA
BSF STATUS,5
MOVLW 0b00000110
MOVWF TRISB
CLRF TRISA
BCF STATUS,5
ENCENDERMOTOR1:
MOVLW 0b1000
MOVWF PORTA
BTFSC PORTB,2
GOTO ENCENDERMOTOR2
GOTO APAGARMOTOR1
ENCENDERMOTOR2:
MOVLW 0b1000
MOVWF PORTA
BTFSC PORTB,1
GOTO ENCENDERMOTOR1
GOTO APAGARMOTOR2
APAGARMOTOR1:
MOVLW 0b0000
MOVWF PORTA
BTFSS PORTB,1
GOTO APAGARMOTOR1
GOTO ENCENDERMOTOR1
APAGARMOTOR2:
MOVLW 0b0000
MOVWF PORTA
BTFSS PORTB,2
GOTO APAGARMOTOR2
GOTO ENCENDERMOTOR2
END
Download