Fcrystal = 4000000 ;unit: Hz Time = 140 ;US GetTimeMC Time c_valOfT0M EQU #ValOfTimeM ;T0多少分频 c_valOfT0C EQU #ValOfTimeC ;T0初值
GetTimeMC MACRO Time @s_VALUE = Time * (Fcrystal / 1000) / 8000 @s_RATE = 0x70
REPEAT 7 ;循环执行7次意思 IF @s_VALUE > 256 @s_VALUE = @s_VALUE / 2 @s_RATE = @s_RATE - 0x10 ENDIF ENDM
IF @s_VALUE > 256 ERROR time over range exitm ELSE ValOfTimeM = @s_RATE ValOfTimeC = 256-@s_Value ENDIF endm |