Beruflich Dokumente
Kultur Dokumente
Microcomputadoras/Prctica5
Microcomputadoras
PRACTICAS DE LABORATORIO
Prctica 1
Prctica 2
Prctica #4
Prctica 3
Prctica 4
(Control de motores de
Prctica 5
CD).
Prctica 6
la
Prctica 7
Prctica 8
Prctica 9
LO QUE NECESITAS
Descargar MPLAB-IDE
Entorno de desarrollo para
ensamblador
processor16f877
include<p16f877.inc>
;VariablesparaelDELAY
valor1equh'21'
valor2equh'22'
valor3equh'23'
http://www.openboxer.260mb.com/asignaturas/microcomp/practica4.html
1/5
14/9/2016
Microcomputadoras/Prctica5
cte1equ10h
cte2equ50h
cte3equ60h
;Definiciondevariablesautilizarpara
;compararlasentradasatravsdelpuertoA
v0equh'24'
v1equh'25'
v2equh'26'
v3equh'27'
v4equh'28'
c0equ0h
c1equ2h
c2equ4h
c3equ8h
c4equ16h
org0h
gotoINICIO
org05h
INICIO:
clrfPORTA
bsfSTATUS,RP0;Cambialabanco1
bcfSTATUS,RP1
movlwh'0'
movwfTRISB;ConfigurapuertoBcomosalida
clrfPORTB
movlw06h;ConfigurapuertosAyEcomodigitales
movwfADCON1
movlw3fh;ConfiguraelpuertoAcomoentrada
movwfTRISA
bcfSTATUS,RP0;regresaalbanco0
CICLO:
movlwc0
movwfv0
movfwPORTA;MueveloquehayenPORTAaW
xorwfv0,w;Verificasilaentradaes00000000
btfscSTATUS,Z;z=0?
gotoPARO;NO,entoncesv0=W
;SI,entoncesv0!=W
movlwc1
movwfv1
movfwPORTA
xorwfv1,w;Verificasilaentradaes00000010
btfscSTATUS,Z
gotoHORARIO
movlwc2
movwfv2
movfwPORTA
xorwfv2,w;Verificasilaentradaes000100
btfscSTATUS,Z
gotoANTIHORARIO
movlwc3
movwfv3
movfwPORTA
xorwfv3,w;Verificasilaentradaes001000
btfscSTATUS,Z
gotoHORARIO1
movlwc4
movwfv4;Verificasilaentradaes010000
movfwPORTA
xorwfv4,w
btfscSTATUS,Z
http://www.openboxer.260mb.com/asignaturas/microcomp/practica4.html
2/5
14/9/2016
Microcomputadoras/Prctica5
btfscSTATUS,Z
gotoANTIHORARIO1
PARO:
movlwh'00';MOTORIZQ=OFFDER=OFF
movwfPORTB
gotoCICLO
HORARIO:
movlwb'1100';MOTORIZQ=OFFDER=ONDIR1=1
movwfPORTB
callretardo
gotoCICLO
ANTIHORARIO:
movlwb'1000';MOTORIZQ=OFFDER=ONDIR1=0
movwfPORTB
callretardo
gotoCICLO
HORARIO1:
movlwb'0011';MOTORIZQ=ONDER=OFFDIR2=1
movwfPORTB
callretardo
gotoCICLO
ANTIHORARIO1:
movlwb'0010';MOTORIZQ=ONDER=OFFDIR2=0
movwfPORTB
callretardo
gotoCICLO
retardomovlwcte1;;RutinaquegeneraunDELAY
movwfvalor1
tresmovwfcte2
movwfvalor2
dosmovlwcte3
movwfvalor3
unodecfszvalor3
gotouno
decfszvalor2
gotodos
decfszvalor1
gototres
return
end
http://www.openboxer.260mb.com/asignaturas/microcomp/practica4.html
3/5
14/9/2016
Microcomputadoras/Prctica5
processor16f877
include<p16f877.inc>
;VariablesparaelDELAY
valor1equh'21'
valor2equh'22'
valor3equh'23'
cte1equ10h
cte2equ50h
cte3equ60h
;Definiciondevariablesautilizarpara
;compararlasentradasatravesdelpuertoA
v0equh'24'
v1equh'25'
v2equh'26'
v3equh'27'
v4equh'28'
c0equ0h
c1equ1h
c2equ2h
c3equ3h
c4equ4h
org0h
gotoINICIO
org05h
INICIO:
clrfPORTA
bsfSTATUS,RP0;Cambialabanco1
bcfSTATUS,RP1
movlwh'0'
movwfTRISB;ConfigurapuertoBcomosalida
clrfPORTB
movlw06h;ConfigurapuertosAyEcomodigitales
movwfADCON1
movlw3fh;ConfiguraelpurtoAcomoentrada
movwfTRISA
bcfSTATUS,RP0;refresaalbanco0
CICLO:
movlwc0
movwfv0
movfwPORTA;MueveloquehayenPORTAaW
xorwfv0,w;Verificasilaentradaes00000000
btfscSTATUS,Z;z=0?
gotoPARO;NO,entoncesv0=W
;SI,entonvesv0!=W
movlwc1
movwfv1
movfwPORTA
xorwfv1,w;Verificasilaentradaes$01
btfscSTATUS,Z
gotoHORARIO
movlwc2
movwfv2
movfwPORTA
xorwfv2,w;Verificasilaentradaes$02
btfscSTATUS,Z
gotoANTIHORARIO
movlwc3
movwfv3
movfwPORTA
xorwfv3,w;Verificasilaentradaes$03
http://www.openboxer.260mb.com/asignaturas/microcomp/practica4.html
4/5
14/9/2016
Microcomputadoras/Prctica5
btfscSTATUS,Z
gotoHORARIO1
movlwc4
movwfv4
movfwPORTA
xorwfv4,w;Verificasilaentradaes$04
btfscSTATUS,Z
gotoANTIHORARIO1
PARO:
movlwh'00';M1=paroM2=paro
movwfPORTB
gotoCICLO
HORARIO:
movlwb'1010';M1=DerechaM2=Derecha
movwfPORTB
callretardo
gotoCICLO
ANTIHORARIO:
movlwb'1111';M1=IzquierdaM2=Izquierda
movwfPORTB
callretardo
gotoCICLO
HORARIO1:
movlwb'1011';M1=DerechaM2=Izquierda
movwfPORTB
callretardo
gotoCICLO
ANTIHORARIO1:
movlwb'1110';M1=IzquierdaM2=Dercha
movwfPORTB
callretardo
gotoCICLO
retardomovlwcte1;RutinaquegeneraunDELAY
movwfvalor1
tresmovwfcte2
movwfvalor2
dosmovlwcte3
movwfvalor3
unodecfszvalor3
gotouno
decfszvalor2
gotodos
decfszvalor1
gototres
return
end
http://www.openboxer.260mb.com/asignaturas/microcomp/practica4.html
5/5