资源简介
stm8s LED 入门级示例
代码片段和文件信息
/*
文件名: main.c
编译环境:IAR for STM8S
编译平台:9mcu.com stm8s开发板
编译时间:2012-11-29
编写者: nini-0905
实现功能:开发板上的4个LED灯逐个闪烁
*/
#include “stm8s.h“ //包含用到的外设的头文件
//LED操作宏
#define LED1_ON() GPIO_WriteLow(GPIOCGPIO_PIN_1)//置PC1端口为低电平
#define LED1_OFF() GPIO_WriteHigh(GPIOCGPIO_PIN_1)//置PC1端口为高电平
#define LED2_ON() GPIO_WriteLow(GPIOFGPIO_PIN_6)
#define LED2_OFF() GPIO_WriteHigh(GPIOFGPIO_PIN_6)
#define LED3_ON() GPIO_WriteLow(GPIOFGPIO_PIN_5)
#define LED3_OFF() GPIO_WriteHigh(GPIOFGPIO_PIN_5)
#define LED4_ON() GPIO_WriteLow(GPIOFGPIO_PIN_4)
#define LED4_OFF() GPIO_WriteHigh(GPIOFGPIO_PIN_4)
/**************************实现函数********************************************
*函数原型: void Delay(unsigned int time)
*功 能: 实现一定时间的延时
*******************************************************************************/
void Delay(unsigned int time)
{
volatile unsigned int i;
while(time--){
i=300;
while(i--);
}
}
/**************************实现函数****************
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
....... 1908 2012-12-10 09:53 LED\Debug\Exe\LED.hex
....... 41160 2012-12-10 09:53 LED\Debug\Exe\LED.out
....... 280 2012-12-04 16:38 LED\Debug\Obj\LED.pbd
....... 6811 2012-12-10 09:53 LED\Debug\Obj\main.o
....... 20105 2012-11-29 10:03 LED\Debug\Obj\stm8s_gpio.o
....... 36578 2012-11-29 10:03 LED\Debug\Obj\stm8s_it.o
....... 15991 2010-02-02 14:55 LED\FWLib\examples\Common\microsd.c
....... 8694 2010-02-02 14:55 LED\FWLib\examples\Common\microsd.h
....... 23941 2010-02-02 14:55 LED\FWLib\examples\Common\mono_lcd.c
....... 3502 2010-02-02 14:55 LED\FWLib\examples\Common\mono_lcd.h
....... 98221 2012-03-07 12:35 LED\FWLib\library\inc\stm8s.h
....... 13630 2010-02-02 14:55 LED\FWLib\library\inc\stm8s_adc1.h
....... 11027 2010-02-02 14:55 LED\FWLib\library\inc\stm8s_adc2.h
....... 4871 2010-02-02 14:55 LED\FWLib\library\inc\stm8s_awu.h
....... 3472 2010-02-02 14:55 LED\FWLib\library\inc\stm8s_beep.h
....... 24992 2010-02-02 14:55 LED\FWLib\library\inc\stm8s_can.h
....... 17808 2010-02-02 14:55 LED\FWLib\library\inc\stm8s_clk.h
....... 4564 2010-02-02 14:55 LED\FWLib\library\inc\stm8s_exti.h
....... 12201 2010-02-02 14:55 LED\FWLib\library\inc\stm8s_flash.h
....... 6266 2010-02-02 14:55 LED\FWLib\library\inc\stm8s_gpio.h
....... 15337 2010-02-02 14:55 LED\FWLib\library\inc\stm8s_i2c.h
....... 5006 2010-02-02 14:55 LED\FWLib\library\inc\stm8s_itc.h
....... 4578 2010-02-02 14:55 LED\FWLib\library\inc\stm8s_iwdg.h
....... 2809 2010-02-02 14:55 LED\FWLib\library\inc\stm8s_rst.h
....... 12767 2010-02-02 14:55 LED\FWLib\library\inc\stm8s_spi.h
....... 24968 2010-02-02 14:55 LED\FWLib\library\inc\stm8s_tim1.h
....... 13576 2010-02-02 14:55 LED\FWLib\library\inc\stm8s_tim2.h
....... 12478 2010-02-02 14:55 LED\FWLib\library\inc\stm8s_tim3.h
....... 5131 2010-02-02 14:55 LED\FWLib\library\inc\stm8s_tim4.h
....... 18985 2010-02-02 14:55 LED\FWLib\library\inc\stm8s_tim5.h
............此处省略58个文件信息
评论
共有 条评论