Académique Documents
Professionnel Documents
Culture Documents
PRUEBA #1
ERICK PEÑAHERRERA
DATASHEETS
PIC16F877A
2N3904
DECODIFICADOR 74LS48
program contadorascendente
main:
dim A,B,X,H,J as Byte
dim I as word
A=0
B=0
X=0
I=0
trisb=0
trisc=0
trisa=0
trisd=$ff
J=portd.2 and portd.3
porta.0=0
if J=1 then
porta.0=1
delay_ms(200)
H=portd.2 or portd.3
if H=1 then
if portd.2=1 then
while true
lazo1:
Portc=1
Portb=A
delay_us(100)
Portc=2
Portb=B
delay_us(100)
Portc=4
Portb=X
delay_us(100)
if portd.3=1 then
goto lazo
end if
inc(I)
if I=2000 then
inc(X)
if X=10 then
X=0
inc(B)
if B=10 then
B=0
inc(A)
else
if A=10 then
A=0
end if
end if
end if
I=0
else
end if
wend
end if
if portd.3=1 then
while true
lazo:
Portc=1
Portb=A
delay_us(200)
Portc=2
Portb=B
delay_us(200)
Portc=4
Portb=X
delay_us(200)
if portd.2=1 then
goto lazo1
end if
inc(I)
if I=2000 then
inc(X)
if X=10 then
X=0
inc(B)
if B=10 then
B=0
inc(A)
else
if A=10 then
A=0
end if
end if
end if
I=0
else
end if
wend
end if
else
portb.0=0
portb.1=0
portb.2=0
portb.3=0
end if
end if
goto main
end.
DIAGRAMA DE FLUJO
INICIO
PORTD.2=1
PORTD.3=1
S
I
M
U
L
A
C
I
Ó
N
FOTOS
CONCLUSIONES
Que la elaboración de esta práctica nos sirve para comprender como son los bucles: if, while
y for, además pueda desarrollar habilidades lógicas que ayuden a resolver de una forma
más sencilla cualquier problema.
Tener en cuenta o memorizado el diagrama de pines (datasheet) del pic, del transistor y del
display para facilitar ya sea la armada en el protoboard como en la programación en la
declaración de puertos a utilizar.
BIBLIOGRAFIA
http://www.datasheetcatalog.net/es/datasheets_pdf/7/4/4/8/7448.shtml , Microchip,
datasheet decodificador 7448, fecha de revisión: 13/11/2010
http://ww1.microchip.com/downloads/en/devicedoc/30292c.pdf , Microchip,
datasheet PIC16F877A, fecha de revisión: 25/09/2010.