刚玩STM8L101
例子模板用的CC2530大侠的,在此先谢过
下面的代码问题是不能自动唤醒,一执行halt();就睡死了:)
int main()
{
CLK_DeInit(); //时钟恢复默设置
//CLK_MasterPrescalerConfig(CLK_MasterPrescaler_HSIDiv1); //HSI不分频,16M
CLK_MasterPrescalerConfig(CLK_MasterPrescaler_HSIDiv8); //HSI8分频,2M
GPIO_LED_1_Off();
GPIO_LED_1_MakeOutputPushPullSlow();
CLK_PeripheralClockConfig(CLK_Peripheral_AWU, ENABLE);
while(1)
{
GPIO_LED_1_On();//PC2输出低电平,使LED2点亮
AWU_Cmd(ENABLE);
AWU_Init(AWU_Timebase_64ms);
halt();
nop();
GPIO_LED_1_Off();//PC2输出高电平,LED2熄灭
AWU_Cmd(ENABLE);
AWU_Init(AWU_Timebase_2s);
halt();
nop();
}
}
|