void delay(unsigned int i)
{
unsigned int j=0;
for(j=0;j<=i;j++)
{}
}
int main(void)
{
//PB5 0 1对应R G B
while(1)
{
//打开GPIOB端口的时钟(绿色)
*(unsigned int *)0x40021018 |=((1)<<3);
//配置IO口为输出,CRL端口偏移地址为00,十进制的1,即为0001,左移0位
*(unsigned int *)0x40010C00 |=((1)<<(4*0));
//控制ODR寄存器,ODR偏移地址为0C
*(unsigned int *)0x40010C0C &=~(1<<0);
delay(500000);
*(unsigned int *)0x40010C00 &=~((15)<<(4*0));
//打开GPIOB端口的时钟(蓝色)
*(unsigned int *)0x40021018 |=((1)<<3);
//配置IO口为输出,CRL端口偏移地址为00,十进制的1,即为0001,左移0位
*(unsigned int *)0x40010C00 |=((1)<<(4*1));
//控制ODR寄存器,ODR偏移地址为0C
*(unsigned int *)0x40010C0C &=~(1<<1);
delay(500000);
*(unsigned int *)0x40010C00 &=~((15)<<(4*1));
//打开GPIOB端口的时钟(红色)
*(unsigned int *)0x40021018 |=((1)<<3);
//配置IO口为输出,CRL端口偏移地址为00,十进制的1,即为0001,左移0位
*(unsigned int *)0x40010C00 |=((1)<<(4*5));
//控制ODR寄存器,ODR偏移地址为0C
*(unsigned int *)0x40010C0C &=~(1<<5);
delay(500000);
*(unsigned int *)0x40010C00 &=~((15)<<(4*5));