setfreq.asm

来自「这是我编一个DSP的USP的程序 调试通过」· 汇编 代码 · 共 40 行

ASM
40
字号
     .title " set frequency"
     .global _pllx100
     .global _pllx10
     .mmregs

_pllx100:				; change PLL is x10, CLK=100MHz
     pshm ah
     pshm al
     stm  #0,58h
wait_pll:
     ldm  58h,a
     and  #1,a
     bc   wait_pll,aneq
     stm  #97ffh,58h      ; switch pll*10 -> 100M clk

     rpt  #100
     nop
     popm al
     popm ah
     ret
;/*------------------------------------------------------------------------
;  The following codes switch to 10MHz clock !
;-------------------------------------------------------------------------*/
_pllx10:				; change PLL is x1, CLK=10MHz
     pshm ah
     pshm al
     stm  #0,58h
wait_pll1:
     ldm  58h,a
     and  #1,a
     bc   wait_pll1,aneq
     stm  #17ffh,58h      ; switch pll*1 -> 10M clk

     rpt  #100
     nop
     popm al
     popm ah
     ret

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?