Skip to main content
Fixed formatting
Source Link
JRE
  • 73.6k
  • 10
  • 112
  • 195

I use the following function in my code with uVision 4.70

__asm void SetPOWCON( u16 u16POWCON) // POWCON register value {
Z_PLL EQU 0xFFFF0400 // PLL base address R_NUM EQU 0x12345678 // Random Number for Dummy Multiplication

LDR r3,=R_NUM // Load random number for multiplication LDR r1,=Z_PLL // Load base address of PLL / POWCON related MMRs MOV r2,#1 // POWKEY0 = 1 STR r2,[r1,#4] STR r0,[r1,#8] // Set POWCON value MOV r0,#0xf4 // POWKEY1 = 0xF4 STR r0,[r1,#0xc] UMLAL r2,r0,r3,r1
BX lr }

__asm void SetPOWCON(
    u16 u16POWCON)  // POWCON register value
{   
Z_PLL   EQU     0xFFFF0400  // PLL base address
R_NUM   EQU     0x12345678  // Random Number for Dummy Multiplication

   LDR      r3,=R_NUM      // Load random number for multiplication
   LDR      r1,=Z_PLL      // Load base address of PLL / POWCON related MMRs
   MOV      r2,#1          // POWKEY0 = 1
   STR      r2,[r1,#4]
   STR      r0,[r1,#8]     // Set POWCON value
   MOV      r0,#0xf4       // POWKEY1 = 0xF4
   STR      r0,[r1,#0xc]
   UMLAL    r2,r0,r3,r1    
   BX       lr
}

I use the following function in my code with uVision 4.70

__asm void SetPOWCON( u16 u16POWCON) // POWCON register value {
Z_PLL EQU 0xFFFF0400 // PLL base address R_NUM EQU 0x12345678 // Random Number for Dummy Multiplication

LDR r3,=R_NUM // Load random number for multiplication LDR r1,=Z_PLL // Load base address of PLL / POWCON related MMRs MOV r2,#1 // POWKEY0 = 1 STR r2,[r1,#4] STR r0,[r1,#8] // Set POWCON value MOV r0,#0xf4 // POWKEY1 = 0xF4 STR r0,[r1,#0xc] UMLAL r2,r0,r3,r1
BX lr }

I use the following function in my code with uVision 4.70

__asm void SetPOWCON(
    u16 u16POWCON)  // POWCON register value
{   
Z_PLL   EQU     0xFFFF0400  // PLL base address
R_NUM   EQU     0x12345678  // Random Number for Dummy Multiplication

   LDR      r3,=R_NUM      // Load random number for multiplication
   LDR      r1,=Z_PLL      // Load base address of PLL / POWCON related MMRs
   MOV      r2,#1          // POWKEY0 = 1
   STR      r2,[r1,#4]
   STR      r0,[r1,#8]     // Set POWCON value
   MOV      r0,#0xf4       // POWKEY1 = 0xF4
   STR      r0,[r1,#0xc]
   UMLAL    r2,r0,r3,r1    
   BX       lr
}
Source Link

I use the following function in my code with uVision 4.70

__asm void SetPOWCON( u16 u16POWCON) // POWCON register value {
Z_PLL EQU 0xFFFF0400 // PLL base address R_NUM EQU 0x12345678 // Random Number for Dummy Multiplication

LDR r3,=R_NUM // Load random number for multiplication LDR r1,=Z_PLL // Load base address of PLL / POWCON related MMRs MOV r2,#1 // POWKEY0 = 1 STR r2,[r1,#4] STR r0,[r1,#8] // Set POWCON value MOV r0,#0xf4 // POWKEY1 = 0xF4 STR r0,[r1,#0xc] UMLAL r2,r0,r3,r1
BX lr }