Bien pues aki les dejo los codigos de un reloj digital en microcode (pic basic)
espero q les sea util...
TRISA=%10000
TRISB=%11110000
'PORTB=0
symbol minn=porta.4
SYMBOL hora=PORTB.7
i VAR word
j var word
k var word
l var word
m var word
n var word
inicio:
i=0
j=0
k=0
l=0
m=0
while (i<3)
while (j<10)
while (k<7)
while (l<10)
while (m<20) '2790
PORTA.0=1
PORTA.1=0
PORTA.2=0
PORTA.3=0
if (l=0) then
PORTB=%0000
endif
if (l=1) then
PortB=%0001
endif
if (l=2) then
PortB=%0010
endif
if (l=3) then
PortB=%0011
endif
if (l=4) then
PortB=%0100
endif
if (l=5) then
PortB=%0101
endif
if (l=6) then
PortB=%0111
endif
if (l=7) then
PortB=%0110
endif
if (l=8) then
PortB=%1000
endif
if (l=9) then
PortB=%1001
endif
pause 5
PORTA.0=0
PORTA.1=0
PORTA.2=1
PORTA.3=0
if (k=0) then
PORTB=%0000
endif
if (k=1) then
PortB=%0001
endif
if (k=2) then
PortB=%0010
endif
if (k=3) then
PortB=%0011
endif
if (k=4) then
PortB=%0100
endif
if (k=5) then
PortB=%0101
endif
if (k=6) then
PortB=%0111
endif
if (k=7) then
PortB=%0110
endif
if (k=8) then
PortB=%1000
endif
if (k=9) then
PortB=%1001
endif
pause 5
PORTA.0=0
PORTA.1=1
PORTA.2=0
PORTA.3=0
if (j=0) then
PORTB=%0000
endif
if (j=1) then
PortB=%0001
endif
if (j=2) then
PortB=%0010
endif
if (j=3) then
PortB=%0011
endif
if (j=4) then
PortB=%0100
endif
if (j=5) then
PortB=%0101
endif
if (j=6) then
PortB=%0111
endif
if (j=7) then
PortB=%0110
endif
if (j=8) then
PortB=%1000
endif
if (j=9) then
PortB=%1001
endif
pause 5
PORTA.0=0
PORTA.1=0
PORTA.2=0
PORTA.3=1
if (i=0) then
PORTB=%0000
endif
if (i=1) then
PortB=%0001
endif
if (i=2) then
PortB=%0010
endif
if (i=3) then
PortB=%0011
endif
if (i=4) then
PortB=%0100
endif
if (i=5) then
PortB=%0101
endif
if (i=6) then
PortB=%0111
endif
if (i=7) then
PortB=%0110
endif
if (i=8) then
PortB=%1000
endif
if (i=9) then
PortB=%1001
endif
pause 5
if (minn==1) then
M = M + 1
WEND
M = 0
L = L + 1
WEND
L = 0
K = K + 1
WEND
K = 0
J = J + 1
WEND
J = 0
I = I + 1
goto sigue
endif
M = M + 1
WEND
M = 0
L = L + 1
WEND
L = 0
K = K + 1
WEND
K = 0
J = J + 1
WEND
J = 0
I = I + 1
WEND
'I = 0
sigue:
GOTO INICIO
END
'arreglo:
'M = M + 2
'WEND
'M = 0
'L = L + 1
'WEND
'L = 0
'K = K + 1
'WEND
'K = 0
'J = J + 1
'WEND
'J = 0
'I = I + 1
'goto sigue
creado por alumnos de la universidad nacional de trujillo UNT, ING. MECATRONICA
Tags: RELOJ, DISPLAYS, PIC16F84A