STM32 赋值的请教
#include "stm32f10x.h"
int main(void)
{
unsigned int a0,b0,c0,a1,b1,c1,a2,b2,c2;
//初始值
a0=*(unsigned int *)0x40010000;//CRL
b0=*(unsigned int *)0x40021018;//RCC
c0=*(unsigned int *)0x40010c0c;//ODR
//想赋的值
a1=(1<<(4*0));
b1= (1<<3);
c1=~(1<<0);
//传入数值
*(unsigned int *)0x40010000 |= (1<<(4*0)); //CRL 端口配置L
*(unsigned int *)0x40021018 |= (1<<3); //RCC 时钟
*(unsigned int *)0x40010c0c &= ~(1<<0);//ODR 数据
//计算后的数值
a2=*(unsigned int *)0x40010000;//CRL
b2=*(unsigned int *)0x40021018;//RCC
c2=*(unsigned int *)0x40010c0c;//ODR
}
void SystemInit(void)
{
//不报错
}
debug 后,发现
a0b0c0与参考手册初始值不同 ,
a1b1c1与计划值是相同的。
a2b2c2,最后又全是000了。
请问其中的原因。 |