HCS12 Assembly controlling frequency with PPL

Discussion in 'Programmer's Corner' started by justtrying, Mar 8, 2012.

  1. justtrying

    Thread Starter Active Member

    Mar 9, 2011
    329
    339
    I am trying to write a code to double frequency of bus clock. Here is what I have:

    Code ( (Unknown Language)):
    1. PROGRAM_ADD     EQU     $0800
    2.  
    3. PLLCTL  EQU     $003A
    4. CLKSEL  EQU     $0039
    5. SYNR    EQU     $0034
    6. REFDV   EQU     $0035
    7. FREQUENCY_ADD   EQU  $0900
    8.  
    9.         ORG  FREQUENCY_ADD
    10.  
    11. SYN_MULT        DB      $0
    12. REF_DV          DB      $1
    13.  
    14.         ORG     PROGRAM_ADD
    15.  
    16.         BSET    PLLCTL,$01000000        ;turn PLL on
    17.         MOVB    SYN_MULT,SYNR
    18.         MOVB    REF_DV,REFDV
    19.        
    20.         SWI
    I am really unsure about it. All I know is that the steps are to turn PLL on and provide appropriate status to SYNR and REFDV. I think I did that, but I feel like it is wrong...
     
  2. nigelwright7557

    Senior Member

    May 10, 2008
    487
    71
    Try outputing a square wave to an I/O pin and scoping that will give you an idea of the speed of the PIC.
     
Loading...