这是一个四个LED发光管的显示同步的程序 00表示灭 01表示慢闪 10表示快闪 11表示常亮 但在程序的运行中第一个灯和第三个灯总是不会亮 求高手帮忙解答为什么会这样??
;IO引脚初始化 其中 LED_stu 和 LED_SF已经在前面定义过了
BSET PC_DDR,#1
BRES PC_CR1,#1
#define LED1_Con PC_ODR,#1
BRES LED1_Con
BSET PC_DDR,#2
BRES PC_CR1,#2
#define LED2_Con PC_ODR,#2
BRES LED2_Con
BSET PC_DDR,#3
BRES PC_CR1,#3
#define LED3_Con PC_ODR,#3
BRES LED1_Con
BSET PC_DDR,#4
BRES PC_CR1,#4
#define LED4_Con PC_ODR,#4
BRES LED4_Con
MOV TIM1_SMCR,#00H
BRES TIM1_ETR,#6
MOV TIM1_PSCRH,#00H
MOV TIM1_PSCRL,#00H
MOV TIM1_ARRH,#27H
MOV TIM1_ARRL,#10H
MOV TIM1_RCR,#00H
MOV TIM1_CR1,#04H
BSET TIM1_EGR,#0
BSET TIM1_IER,#0
BSET TIM1_CR1,#0
MOV LED_stu,#0AAH
RIM
; MOV LED_stu,#0AAH
LED:
JP LED
interrupt TIM1_Interrupt_Over
TIM1_Interrupt_Over.l
BRES TIM1_SR1,#0
;在主定时器中与LED显示有关的指令系列
INC LEDTIME
LD A,LEDTIME
CP A,#48
JRC LED_Disp_NEXT1
CLR LEDTIME
BCPL LED_low_SB
JRT LED_Disp_NEXT2
LED_Disp_NEXT1:
AND A,#0FH
JREQ LED_Disp_NEXT2
JP LED_Disp_EXIT
LED_Disp_NEXT2:
BCPL LED_faster_SB
;LED1显示设置
LD A,LED_stu
AND A,#03H
JRNE LED_Disp_LED11
BSET LED1_Con
JRT LED_Disp_LED14
LED_Disp_LED11:
CP A,#01H
JRNE LED_Disp_LED12
BTJT LED_low_SB,LED_Disp_LED121
LED_Disp_LED121:
BCCM LED1_Con
JRT LED_Disp_LED14
LED_Disp_LED12
CP A,#02H
JRNE LED_Disp_LED13
BTJT LED_faster_SB,LED_Disp_LED131
LED_Disp_LED131:
BCCM LED1_Con
JRT LED_Disp_LED14
LED_Disp_LED13:
BRES LED1_Con
LED_Disp_LED14:
;LED2显示设置
LD A,LED_stu
AND A,0CH
JRNE LED_Disp_LED21
BSET LED2_Con
JRT LED_Disp_LED24
LED_Disp_LED21:
CP A,#04H
JRNE LED_Disp_LED22
BTJT LED_low_SB,LED_Disp_LED221
LED_Disp_LED221:
BCCM LED2_Con
JRT LED_Disp_LED24
LED_Disp_LED22:
CP A,#08H
JRNE LED_Disp_LED23
BTJT LED_faster_SB,LED_Disp_LED231
LED_Disp_LED231:
BCCM LED2_Con
JRT LED_Disp_LED24
LED_Disp_LED23:
BRES LED2_Con
LED_Disp_LED24:
;LED3显示设置
LD A,LED_stu
AND A,#30H
CP A,#00H
JRNE LED_Disp_LED31
BSET LED3_Con
JRT LED_Disp_LED34
LED_Disp_LED31:
CP A,#10H
JRNE LED_Disp_LED32
BTJT LED_low_SB,LED_Disp_LED321
LED_Disp_LED321:
BCCM LED3_Con
JRT LED_Disp_LED34
LED_Disp_LED32:
CP A,#20H
JRNE LED_Disp_LED33
BTJT LED_faster_SB,LED_Disp_LED331
LED_Disp_LED331:
BCCM LED3_Con
JRT LED_Disp_LED34
LED_Disp_LED33:
BRES LED3_Con
LED_Disp_LED34:
;LED4显示设置
LD A,LED_stu
AND A,#0C0H
CP A,#00H
JRNE LED_Disp_LED41
BSET LED4_Con
JRT LED_Disp_LED44
LED_Disp_LED41:
CP A,#40H
JRNE LED_Disp_LED42
BTJT LED_low_SB,LED_Disp_LED421
LED_Disp_LED421:
BCCM LED4_Con
JRT LED_Disp_LED44
LED_Disp_LED42:
CP A,80H
JRNE LED_Disp_LED43
BTJT LED_faster_SB,LED_Disp_LED431
LED_Disp_LED431:
BCCM LED4_Con
JRT LED_Disp_LED44
LED_Disp_LED43:
BRES LED4_Con
LED_Disp_LED44:
LED_Disp_EXIT:
IRET
IRET
IRET
IRET
IRET |