当前位置:网站首页>STM8S105k4t6c---------------Light up LED
STM8S105k4t6c---------------Light up LED
2022-08-04 02:35:00 【kick the player】
上一篇文章写了STM8S项目创建
This is to light upstm8s的板载LED
Because of the tests on my boardLED是PE5脚,You can change the code according to your own and you are done
1.Open the created project
Just write it like I do
main.c代码文件

#include "stm8s_conf.h"
#include "led.h"
#include "sysclk.h"
#include "stm8s_it.h"
#include "iostm8s105.h"
#include "stm8s.h"
void System_Init(void)
{
SysHSICLK_Config();//时钟配置初始化
LED_Config();
}
void main(void)
{
System_Init();
while (1)
{
;
}
}
led.c代码文件

#include "led.h"
#include "iostm8s105.h"
void LED_Config(void)
{
GPIO_Init(LED_GPIO_PORT, LED_GPIO_PIN, GPIO_MODE_OUT_PP_HIGH_FAST);
LED_On;
}
**
led.h代码文件
**
#ifndef __LED_H
#define __LED_H
#include "stm8s_conf.h"
#define LED_GPIO_PORT GPIOE
#define LED_GPIO_PIN GPIO_PIN_5
#define LED_On GPIO_WriteLow(LED_GPIO_PORT, LED_GPIO_PIN)
#define LED_Off GPIO_WriteHigh(LED_GPIO_PORT, LED_GPIO_PIN)
void LED_Config(void);
#endif
**
**
烧录
**
That's fine to match.
ST-LINK2 —> STM8S
SWIM ------> SWIM
NRST-------> NRST
VCC--------> VCC
GND-------->GND


现象:LED亮了
烧录前 ↓

烧录后 ↓

总结:stm8s的IOport configuration ratiostm32简单很多,There is no clock configuration,There is no struct assignment and then storing into a register.学过C51,还是很容易上手的!
边栏推荐
猜你喜欢

融云「音视频架构实践」技术专场【内含完整PPT】

uni-app 从零开始-基础模版(一)

2022年茶艺师(中级)考试试题模拟考试平台操作

Example 035: Setting the output color

5. Scrapy middleware & distributed crawler

小程序+新零售,玩转行业新玩法!

halcon自定义函数基本操作

MallBook联合人民交通出版社,推动驾培领域新发展,开启驾培智慧交易新生态

【学习笔记之菜Dog学C】动态内存管理

Rongyun "Audio and Video Architecture Practice" technical session [complete PPT included]
随机推荐
关联接口测试
Utilities of Ruineng Micrometer Chip RN2026
C语言力扣第54题之螺旋矩阵。模拟旋转
The browser
出海季,互联网出海锦囊之本地化
查看mysql死锁语法
FileNotFoundException: This file can not be opened as a file descriptor; it is probably compressed
mpf5_定价Bond_yield curve_Spot coupon_duration_有效利率_连续复利_远期_Vasicek短期_CIR模型Derivatives_Tridiagonal_ppf
异步编程解决方案 Generator生成器函数、iterator迭代器、async/await、Promise
QNX Hypervisor 2.2 user manual] 10.1 gm vdev options
Good bosses, please ask the flink CDC oracle to Doris, found that the CPU is unusual, a run down
sqoop ETL工具
实例041:类的方法与变量
【指针内功修炼】深度剖析指针笔试题(三)
第13章 网络安全漏洞防护技术原理与应用
Example: 036 is a prime number
Sky map coordinate system to Gaode coordinate system WGS84 to GCJ02
单片机C语言->的用法,和意思
Multithreading JUC Learning Chapter 1 Steps to Create Multithreading
小甲鱼汇编笔记