201404 - 程序员玩耍的小窝

STM32 寄存器操作 GPIO

作者:fly 发布于:2014-4-1 18:07 分类:嵌入式

阅读这篇文章的童鞋们,其实作为STM应用真心没必要直接操作寄存器,用库函数就足够了,除非对于底层有需求的,例如需要汇编的,才用的到。

int main(void)
{ 
     RCC->AHB1ENR |= RCC_AHB1Periph_GPIOF;   
   	 
     GPIOF->MODER &= 0xFFCFFFFF;
     GPIOF->MODER |= 0x00100000;

     GPIOF->OTYPER &= 0xFFFFBFFF;	  
     GPIOF->OTYPER |= 0x00000000;
     GPIOF->OSPEEDR &= 0xFFCFFFFF;	   
     GPIOF->OSPEEDR |= 0x00200000;
    
    while (1)
    {
	    GPIOF->BSRRL=GPIO_Pin_10;  
	    Delay(0x2FFFFF);	
  	    GPIOF->BSRRH=GPIO_Pin_10;
  	    Delay(0x2FFFFF);
    }
}
void Delay(vu32 nCount)	
{
  for(; nCount != 0; nCount--);
}

 

 

评论(0) 浏览(9761)

STM32 ARM THUMB指令机器码表

作者:fly 发布于:2014-4-1 17:52 分类:嵌入式

v is immed_value
n is Rn
m is Rm
s is Rs
r is register_list
c is condition

阅读全文>>

评论(0) 浏览(5826)

 
Powered by emlog sitemap