测试程序如下:
mov.b #2eh,hr1 ;<10MHz
mov.b #01h,hr0 ;enable high-speed on-chip oscillator
nop ;wait for oscillator stable
nop
nop
nop
mov.b #03h,hr0 ;select high-speed on-chip oscillator
mov.b #10h,cm1 ;low-speed on-chip oscillator off
;set cpu clock as Fosc
;set P4_6,P4_7 as input and low drive capacity
mov.b #2ch,cm0 ;no external clock
;stop peripheral funtion clock in wait mode
mov.b #0ch,ocd ;disable oscillation stop detection.Confirmed:disable
;main oscillor stopped
;select internal oscillor
;下面的为循环,测试周期
loop:
mov.b 501h,503h ;3个指令周期 X 10行
mov.b 501h,503h
mov.b 501h,503h
mov.b 501h,503h
mov.b 501h,503h
mov.b 501h,503h
mov.b 501h,503h
mov.b 501h,503h
mov.b 501h,503h
mov.b 501h,503h
bnot p04 ;取反P04口,用示波器观察周期,3个指令周期
jmp.b loop ;4个指令周期
理论计算高/低电平的时间应当小于4us,实际测量居然近13us,为什么???