所以,我正在做一个螺旋桨时钟,它应该使用汇编程序和PIC 18F4550来显示小时和一个名字。我觉得一切都很好。只是因为我无法做到"制造"一个合适的时间基地。
PIC自然以8 MHz工作。
我尝试做的是创建一个计数为1分钟的例程,之后,时钟将在#34;分钟和#34;中添加1分钟,依此类推(该部分已完成) )。
用户将使用4个按钮设置小时,然后设置当前小时,然后按最后一个按钮。当时间基准开始的时候。
我想我不能做最后一部分,我只需要时间基础的帮助,因为我似乎无法在汇编程序中理解这一点(在C#中我只是出价而o做的时候或者也许是为了。)
我看到这种情况的一种方式 - 也许我只需要做一个很大的延迟 - 持续60秒 - 但我可以用汇编语言,或者我错了?
提前谢谢你们 这是时钟的代码:
LIST P = 18f4550
#include<p18f4550.inc>
CONFIG WDT = OFF
CONFIG MCLRE = ON
CONFIG DEBUG = OFF
CONFIG LVP = OFF
CONFIG FOSC = INTOSC_EC
Delay1 EQU 0x00
Delay2 EQU 0x01
AUX1 EQU 0x02
AUX2 EQU 0x03
ORG 0
MOVLW b'01110111' ;8 MHz
MOVWF OSCCON
CLRF PORTA
CLRF PORTB
CLRF TRISB
CLRF AUX1
CLRF AUX2
;MOVWF b'01100100'
;MOVLW AUX1
TEST
BTFSS PORTA,4
GOTO TEST
GOTO MainLoop
MainLoop
MOVLW b'00000001'
ADDWF AUX2,1
CALL K
CALL retardo
CALL RE
CALL retardo
CALL O
CALL retardo
CALL NN
CALL retardo
CALL O
CALL retardo
CALL SS
CALL retardo
CALL MM
CALL retardo
CALL YY
CALL retardo
CALL GG
CALL retardo
;MOVWF b'01100100'
MOVLW b'00000011'
CPFSEQ AUX2,1
GOTO MainLoop
CALL OPT
GOTO TEST
;*******************LETTERS****************
K
MOVLW b'11111111'
MOVWF PORTB
CALL retardo
MOVLW b'00001000'
MOVWF PORTB
call retardo
MOVLW b'00010100'
MOVWF PORTB
CALL retardo
MOVLW b'00100010'
MOVWF PORTB
CALL retardo
MOVLW b'01000001'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
RETURN
RE
MOVLW b'01111111'
MOVWF PORTB
CALL retardo
MOVLW b'01001100'
MOVWF PORTB
call retardo
MOVLW b'01001100'
MOVWF PORTB
CALL retardo
MOVLW b'00110011'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
RETURN
NN
MOVLW b'01111111'
MOVWF PORTB
CALL retardo
MOVLW b'00100000'
MOVWF PORTB
CALL retardo
MOVLW b'00010000'
MOVWF PORTB
CALL retardo
MOVLW b'00001000'
MOVWF PORTB
CALL retardo
MOVLW b'00000100'
MOVWF PORTB
CALL retardo
MOVLW b'01111111'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
RETURN
O
MOVLW b'00001000'
MOVWF PORTB
CALL retardo
MOVLW b'00010100'
MOVWF PORTB
call retardo
MOVLW b'00100010'
MOVWF PORTB
CALL retardo
MOVLW b'01000001'
MOVWF PORTB
CALL retardo
MOVLW b'00100010'
MOVWF PORTB
CALL retardo
MOVLW b'00010100'
MOVWF PORTB
call retardo
MOVLW b'00001000'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
RETURN
SS
MOVLW b'00010001'
MOVWF PORTB
CALL retardo
MOVLW b'00101010'
MOVWF PORTB
CALL retardo
MOVLW b'01000100'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
RETURN
MM
CALL retardo
MOVLW b'01111111'
MOVWF PORTB
CALL retardo
MOVLW b'00000010'
MOVWF PORTB
CALL retardo
MOVlW b'00000100'
MOVWF PORTB
CALL retardo
MOVLW b'00001000'
MOVWF PORTB
CALL retardo
MOVlW b'00000100'
MOVWF PORTB
CALL retardo
MOVLW b'00000010'
MOVWF PORTB
CALL retardo
MOVLW b'01111111'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
RETURN
YY
MOVLW b'00000001'
MOVWF PORTB
CALL retardo
MOVLW b'00000010'
MOVWF PORTB
CALL retardo
MOVLW b'00000100'
MOVWF PORTB
CALL retardo
MOVLW b'01111000'
MOVWF PORTB
CALL retardo
MOVLW b'00000100'
MOVWF PORTB
CALL retardo
MOVLW b'00000010'
MOVWF PORTB
CALL retardo
MOVLW b'00000001'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
RETURN
GG
MOVLW b'01111001'
MOVWF PORTB
CALL retardo
MOVLW b'00101010'
MOVWF PORTB
CALL retardo
MOVLW b'00010100'
MOVWF PORTB
CALL retardo
MOVLW b'00001000'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
RETURN
OPT
MOVLW b'11111111'
MOVWF PORTB
CALL retardo
CALL retardo
CALL retardo
CALL retardo
CALL retardo
CALL retardo
CALL retardo
CALL retardo
CALL retardo
CLRF AUX2
MOVLW b'00000000'
MOVWF PORTB
RETURN
;*******NUMBER************
HORAS1
BTFSC PORTA,0
GOTO CERO1
CERO1
BTFSC PORTA,0
GOTO UNO1
MOVLW b'00111110'
MOVWF PORTB
CALL retardo
MOVLW b'01000001'
MOVWF PORTB
CALL retardo
MOVLW b'01000001'
MOVWF PORTB
CALL retardo
MOVLW b'00111110'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
UNO1
BTFSC PORTA,0
GOTO CERO1
MOVLW b'00010000'
MOVWF PORTB
CALL retardo
MOVLW b'00100001'
MOVWF PORTB
CALL retardo
MOVLW b'01111111'
MOVWF PORTB
CALL retardo
MOVLW b'00000001'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
HORAS2
BTFSC PORTA,1
GOTO CERO2
CERO2
BTFSC PORTA,1
GOTO UNO2
MOVLW b'00111110'
MOVWF PORTB
CALL retardo
MOVLW b'01000001'
MOVWF PORTB
CALL retardo
MOVLW b'01000001'
MOVWF PORTB
CALL retardo
MOVLW b'00111110'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
UNO2
BTFSC PORTA,1
GOTO DOS2
MOVLW b'00010000'
MOVWF PORTB
CALL retardo
MOVLW b'00100001'
MOVWF PORTB
CALL retardo
MOVLW b'01111111'
MOVWF PORTB
CALL retardo
MOVLW b'00000001'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
DOS2
BTFSC PORTA,1
GOTO TRES2
MOVLW b'00110011'
MOVWF PORTB
CALL retardo
MOVLW b'01000101'
MOVWF PORTB
CALL retardo
MOVLW b'01001001'
MOVWF PORTB
CALL retardo
MOVLW b'01110001'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
TRES2
BTFSC PORTA,1
GOTO CUATRO2
MOVLW b'01001001'
MOVWF PORTB
CALL retardo
MOVLW b'01001001'
MOVWF PORTB
CALL retardo
MOVLW b'01001001'
MOVWF PORTB
CALL retardo
MOVLW b'00111110'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
CUATRO2
BTFSC PORTA,1
GOTO CINCO2
MOVLW b'01111000'
MOVWF PORTB
CALL retardo
MOVLW b'00001000'
MOVWF PORTB
CALL retardo
MOVLW b'00001000'
MOVWF PORTB
CALL retardo
MOVLW b'01111111'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
CINCO2
BTFSC PORTA,1
GOTO SEIS2
MOVLW b'01111001'
MOVWF PORTB
CALL retardo
MOVLW b'01001001'
MOVWF PORTB
CALL retardo
MOVLW b'01001001'
MOVWF PORTB
CALL retardo
MOVLW b'01001111'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
SEIS2
BTFSC PORTA,1
GOTO SIETE2
MOVLW b'00111110'
MOVWF PORTB
CALL retardo
MOVLW b'01000001'
MOVWF PORTB
CALL retardo
MOVLW b'01001001'
MOVWF PORTB
CALL retardo
MOVLW b'01001110'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
SIETE2
BTFSC PORTA,1
GOTO OCHO2
MOVLW b'01000000'
MOVWF PORTB
CALL retardo
MOVLW b'01001000'
MOVWF PORTB
CALL retardo
MOVLW b'01111111'
MOVWF PORTB
CALL retardo
MOVLW b'00001000'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
OCHO2
BTFSC PORTA,1
GOTO NUEVE2
MOVLW b'00111110'
MOVWF PORTB
CALL retardo
MOVLW b'01001001'
MOVWF PORTB
CALL retardo
MOVLW b'01001001'
MOVWF PORTB
CALL retardo
MOVLW b'00111110'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
NUEVE2
BTFSC PORTA,1
GOTO CERO2
MOVLW b'00110001'
MOVWF PORTB
CALL retardo
MOVLW b'01001001'
MOVWF PORTB
CALL retardo
MOVLW b'01001001'
MOVWF PORTB
CALL retardo
MOVLW b'00111110'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
MINUTOS1
BTFSC PORTA,2
GOTO CEROM1
CEROM1
BTFSC PORTA,2
GOTO UNOM1
MOVLW b'00111110'
MOVWF PORTB
CALL retardo
MOVLW b'01000001'
MOVWF PORTB
CALL retardo
MOVLW b'01000001'
MOVWF PORTB
CALL retardo
MOVLW b'00111110'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
UNOM1
BTFSC PORTA,2
GOTO DOSM1
MOVLW b'00010000'
MOVWF PORTB
CALL retardo
MOVLW b'00100001'
MOVWF PORTB
CALL retardo
MOVLW b'01111111'
MOVWF PORTB
CALL retardo
MOVLW b'00000001'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
DOSM1
BTFSC PORTA,2
GOTO TRESM1
MOVLW b'00110011'
MOVWF PORTB
CALL retardo
MOVLW b'01000101'
MOVWF PORTB
CALL retardo
MOVLW b'01001001'
MOVWF PORTB
CALL retardo
MOVLW b'01110001'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
TRESM1
BTFSC PORTA,2
GOTO CUATROM1
MOVLW b'01001001'
MOVWF PORTB
CALL retardo
MOVLW b'01001001'
MOVWF PORTB
CALL retardo
MOVLW b'01001001'
MOVWF PORTB
CALL retardo
MOVLW b'00111110'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
CUATROM1
BTFSC PORTA,2
GOTO CINCOM1
MOVLW b'01111000'
MOVWF PORTB
CALL retardo
MOVLW b'00001000'
MOVWF PORTB
CALL retardo
MOVLW b'00001000'
MOVWF PORTB
CALL retardo
MOVLW b'01111111'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
CINCOM1
BTFSC PORTA,2
GOTO CEROM1
MOVLW b'01111001'
MOVWF PORTB
CALL retardo
MOVLW b'01001001'
MOVWF PORTB
CALL retardo
MOVLW b'01001001'
MOVWF PORTB
CALL retardo
MOVLW b'01001111'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
MINUTOS2
BTFSC PORTA,3
GOTO CEROM2
CEROM2
BTFSC PORTA,3
GOTO UNOM2
MOVLW b'00111110'
MOVWF PORTB
CALL retardo
MOVLW b'01000001'
MOVWF PORTB
CALL retardo
MOVLW b'01000001'
MOVWF PORTB
CALL retardo
MOVLW b'00111110'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
UNOM2
BTFSC PORTA,3
GOTO DOSM2
MOVLW b'00010000'
MOVWF PORTB
CALL retardo
MOVLW b'00100001'
MOVWF PORTB
CALL retardo
MOVLW b'01111111'
MOVWF PORTB
CALL retardo
MOVLW b'00000001'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
DOSM2
BTFSC PORTA,3
GOTO TRESM2
MOVLW b'00110011'
MOVWF PORTB
CALL retardo
MOVLW b'01000101'
MOVWF PORTB
CALL retardo
MOVLW b'01001001'
MOVWF PORTB
CALL retardo
MOVLW b'01110001'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
TRESM2
BTFSC PORTA,3
GOTO CUATROM2
MOVLW b'01001001'
MOVWF PORTB
CALL retardo
MOVLW b'01001001'
MOVWF PORTB
CALL retardo
MOVLW b'01001001'
MOVWF PORTB
CALL retardo
MOVLW b'00111110'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
CUATROM2
BTFSC PORTA,3
GOTO CINCOM2
MOVLW b'01111000'
MOVWF PORTB
CALL retardo
MOVLW b'00001000'
MOVWF PORTB
CALL retardo
MOVLW b'00001000'
MOVWF PORTB
CALL retardo
MOVLW b'01111111'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
CINCOM2
BTFSC PORTA,3
GOTO SEISM2
MOVLW b'01111001'
MOVWF PORTB
CALL retardo
MOVLW b'01001001'
MOVWF PORTB
CALL retardo
MOVLW b'01001001'
MOVWF PORTB
CALL retardo
MOVLW b'01001111'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
SEISM2
BTFSC PORTA,3
GOTO SIETEM2
MOVLW b'00111110'
MOVWF PORTB
CALL retardo
MOVLW b'01000001'
MOVWF PORTB
CALL retardo
MOVLW b'01001001'
MOVWF PORTB
CALL retardo
MOVLW b'01001110'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
SIETEM2
BTFSC PORTA,3
GOTO OCHOM2
MOVLW b'01000000'
MOVWF PORTB
CALL retardo
MOVLW b'01001000'
MOVWF PORTB
CALL retardo
MOVLW b'01111111'
MOVWF PORTB
CALL retardo
MOVLW b'00001000'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
OCHOM2
BTFSC PORTA,3
GOTO NUEVEM2
MOVLW b'00111110'
MOVWF PORTB
CALL retardo
MOVLW b'01001001'
MOVWF PORTB
CALL retardo
MOVLW b'01001001'
MOVWF PORTB
CALL retardo
MOVLW b'00111110'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
NUEVEM2
BTFSC PORTA,3
GOTO CEROM2
MOVLW b'00110001'
MOVWF PORTB
CALL retardo
MOVLW b'01001001'
MOVWF PORTB
CALL retardo
MOVLW b'01001001'
MOVWF PORTB
CALL retardo
MOVLW b'00111110'
MOVWF PORTB
CALL retardo
MOVLW b'00000000'
MOVWF PORTB
CALL retardo
retardo
decfsz Delay1,1
goto retardo
decfsz Delay2,1
goto retardo
return
END