我使用的IC是ST7FLITE05Y0M6,使用的晶振是1M的内部晶振。程序如下所示。我想实现的效果是让PA3控制的LED灯先灭2.5秒左右,然后亮1秒左右,再灭2.5秒,如此循环下去。可是实现不了我所想的效果 st7/ ;------------------------------------------------------ ; SEGMENT MAPPING FILE AUTOMATICALLY GENERATED BY STVD7 ; SHOULD NOT BE MANUALLY MODIFIED. ; CHANGES WILL BE LOST WHEN FILE IS REGENERATED. ;------------------------------------------------------ TITLE "KF85.ASM" MOTOROLA #INCLUDE "st7flite05.inc" BYTES ; The following addresses are 8 bits long segment byte at 80-FF 'ram0' MMSH DS.B $1 MMSL DS.B $1 TEMP DS.W $2
WORDS ; The following addresses are 16 bits long segment byte at FA00-FFDF 'rom' TL1 DC.B $0E2 TH1 DC.B $04 TL2 DC.B $0E8 TH2 DC.B $03 COUNT DC.B $10 COUNT1 DC.B $10 MAIN: LD A,#$0 LD PBDDR,A LD A,#$05 LD PBOR,A LD A,#$0F LD PADDR,A LD PAOR,A CLR PADR LD A,$0FFDE LD RCCR,A LD A,#$10 LD LTCSR,A LD A,#0 LD MMSH,A ;LD A,#255 LD MMSL,A BSET PADR,#2 BRES PADR,#3 RIM JRA * TBINT: LD A,LTCSR LD A,#$01 CP A,MMSH JRNE L2 L1: LD A,MMSL CP A,#$02C JRULT L2 CP A,#$90 ;持续亮1000ms后变为灭 JRULE L5 JRA L6 L2: INC MMSL JRNE L4 INC MMSH JRA L4 L5: INC MMSL BSET PADR,#3 JRA L4 L6: BRES PADR,#3 LD A,#0 LD MMSL,A LD MMSH,A L4: IRET NonHandledInterrupt iret WORDS ; The following addresses are 16 bits long segment byte at FFE0-FFFF 'vectit' DC.W NonHandledInterrupt ;FFE0-FFE1h location DC.W NonHandledInterrupt ;FFE2-FFE3h location DC.W TBINT;FFE4-FFE5h location DC.W NonHandledInterrupt ;FFE6-FFE7h location DC.W NonHandledInterrupt ;FFE8-FFE9h location DC.W NonHandledInterrupt ;FFEA-FFEBh location DC.W NonHandledInterrupt ;FFEC-FFEDh location DC.W NonHandledInterrupt ;FFEE-FFEFh location DC.W NonHandledInterrupt ;FFF0-FFF1h location DC.W NonHandledInterrupt ;FFF2-FFF3h location DC.W NonHandledInterrupt ;FFF4-FFF5h location DC.W NonHandledInterrupt ;FFF6-FFF7h location DC.W NonHandledInterrupt ;FFF8-FFF9h location DC.W NonHandledInterrupt ;FFFA-FFFBh location DC.W NonHandledInterrupt ;FFFC-FFFDh location DC.W MAIN ;reset END 我的问题是,在DEBUG调试的过程中可以看到定时周期为8ms,并且可以循环地进入到定时中断。可是就是看不到灯会闪烁,奇怪。请各位高手帮我解答,谢谢! |