알 수 없는 사용자 2013. 10. 22. 10:54
728x90
반응형

 

 LED 켜기 (PC12)

 #define  RCC_AHBENR    (*(volatile unsigned int*)0x40021014) 
 #define  RCC_APB2ENR    (*(volatile unsigned int*)0x40021018) 
 #define GPIOC_CRH  (*((volatile unsigned int *)(0x40011004)))
 #define GPIOC_ODR  (*((volatile unsigned int *)(0x4001100C)))
 #define GPIOC_BSRR  (*((volatile unsigned int *)(0x40011010)))
 #define GPIOC_BRR  (*((volatile unsigned int *)(0x40011014)))

 


 unsigned int uiCnt;
 
  RCC_APB2ENR |= (1<<4); //PC의 클럭 인에이블   
 //RCC_APB2ENR = 0xFFF;   
 //RCC_AHBENR |= (1<<2) | (1<<6);   


  GPIOC_CRH = (0x3 << 16);
  GPIOC_ODR = (1 << 12);
 
 //GPIOC_BSRR = (1 << 12);
 
 while(1)
 {
    GPIOC_BSRR = (1 << 12);

    for(uiCnt = 0 ; 2000000 > uiCnt; ++uiCnt);
      
   
    GPIOC_BRR  = (1 << 12);
    for(uiCnt = 0 ; 2000000 > uiCnt; ++uiCnt);
 }

 while(1);
 return 0;

}

 

 

 

 

728x90