本帖最后由 CC2530 于 2011-6-16 22:08 编辑
开始玩STM8L101,IAR模板工程。#include "stm8l10x.h"
#include "periph_io.h"
#include "delay.h"
volatile uint8 temp;
int main()
{
GPIO_LED_0_MakeOutputPushPullFast(); //LED_0设置成推挽输出高速
GPIO_LED_1_MakeOutputPushPullFast(); //LED_1设置成推挽输出高速
GPIO_LED_2_MakeOutputPushPullFast(); //LED_2设置成推挽输出高速
GPIO_LED_3_MakeOutputPushPullFast(); //LED_3设置成推挽输出高速
while(1)
{
GPIO_LED_0_Toggle(); //LED_0翻转
delay();
GPIO_LED_0_On(); //LED_0亮
delay();
GPIO_LED_0_Off(); //LED_0灭
delay();
GPIO_LED_0_Set(); //LED_0输出高
delay();
GPIO_LED_0_Clr(); //LED_0输出低
delay();
temp=GPIO_LED_0_ReadIn(); //读取LED_0引脚电平
temp=GPIO_LED_0_IsOn(); //判断LED_0是否亮
temp=GPIO_LED_0_IsOutHigh(); //判断LED_0是否输出高
GPIO_LED_1_Toggle(); //LED_1翻转
GPIO_LED_2_Toggle(); //LED_2翻转
GPIO_LED_3_Toggle(); //LED_3翻转
}
//return 0;
}
|