CPUFreqInMHz是DSP的實際工作頻率,這個引數的單位是MHz,PeriodInUSec是要定時的時間長度,單位是微秒定時值=定時長度/(CPU的週期)=定時長度×CPU的頻率Timer->RegsAddr->PRD.all= temp 向定時器週期暫存器賦值 Timer->RegsAddr->TPR.all = 0; Timer->RegsAddr->TPRH.all = 0;上面兩句是配置定時器預定標暫存器,每個定時器源時鐘週期TIM(定時器計數器)減一 Timer->RegsAddr->TCR.bit.TSS = 1; // 1 = Stop timer, 0 = Start/Restart Timer Timer->RegsAddr->TCR.bit.TRB = 1; // 1 = reload timer Timer->RegsAddr->TCR.bit.SOFT = 0; Timer->RegsAddr->TCR.bit.FREE = 0; // Timer Free Run Disabled Timer->RegsAddr->TCR.bit.TIE = 1; // 0 = Disable/ 1 = Enable Timer Interrupt上面這五句是配置定時器控制暫存器,TSS寫1,停止定時器;TRB寫1,使能定時器重新裝載;SOFT=0、FREE=0是配置CPU定時器模擬模式;TIE寫1,CPU定時器中斷使能。以上是我的理解,我也是剛學,如有錯誤,還望高三指點
CPUFreqInMHz是DSP的實際工作頻率,這個引數的單位是MHz,PeriodInUSec是要定時的時間長度,單位是微秒定時值=定時長度/(CPU的週期)=定時長度×CPU的頻率Timer->RegsAddr->PRD.all= temp 向定時器週期暫存器賦值 Timer->RegsAddr->TPR.all = 0; Timer->RegsAddr->TPRH.all = 0;上面兩句是配置定時器預定標暫存器,每個定時器源時鐘週期TIM(定時器計數器)減一 Timer->RegsAddr->TCR.bit.TSS = 1; // 1 = Stop timer, 0 = Start/Restart Timer Timer->RegsAddr->TCR.bit.TRB = 1; // 1 = reload timer Timer->RegsAddr->TCR.bit.SOFT = 0; Timer->RegsAddr->TCR.bit.FREE = 0; // Timer Free Run Disabled Timer->RegsAddr->TCR.bit.TIE = 1; // 0 = Disable/ 1 = Enable Timer Interrupt上面這五句是配置定時器控制暫存器,TSS寫1,停止定時器;TRB寫1,使能定時器重新裝載;SOFT=0、FREE=0是配置CPU定時器模擬模式;TIE寫1,CPU定時器中斷使能。以上是我的理解,我也是剛學,如有錯誤,還望高三指點