当前位置:网站首页>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,还是很容易上手的!
边栏推荐
- Flink原理流程图简单记录
- Variable string
- 织梦响应式酒店民宿住宿类网站织梦模板(自适应手机端)
- 【原创】启动Win10自带的XPS/OXPS阅读器
- C语言力扣第54题之螺旋矩阵。模拟旋转
- Development of Taurus. MVC WebAPI introductory tutorial 1: download environment configuration and operation framework (including series directory).
- golang中的unsafe.Pointer,指针,引用
- 香港服务器有哪些常用的型号
- sqoop ETL工具
- 小程序+新零售,玩转行业新玩法!
猜你喜欢
Zabbix set up email alert + enterprise WeChat alert
Flask Framework Beginner-05-Command Management Manager and Database Use
Example: 036 is a prime number
[Study Notes Dish Dog Learning C] Dynamic Memory Management
MallBook 助力SKT思珂特教育集团,立足变化,拥抱敏捷交易
Small Turtle Compilation Notes
Web APIs BOM- 操作浏览器:swiper 插件
单片机C语言->的用法,和意思
Homemade bluetooth mobile app to control stm8/stm32/C51 onboard LED
参加Oracle OCP和MySQL OCP考试的学员怎样在VUE预约考试
随机推荐
QNX Hypervisor 2.2 user manual] 10.1 gm vdev options
P3384 【模板】轻重链剖分/树链剖分
【原创】启动Win10自带的XPS/OXPS阅读器
Development of Taurus. MVC WebAPI introductory tutorial 1: download environment configuration and operation framework (including series directory).
ant-design的Select组件采用自定义后缀图标(suffixIcon属性)时,点击该自定义图标没有反应,不会展示下拉菜单的问题
织梦响应式酒店民宿住宿类网站织梦模板(自适应手机端)
sqoop ETL工具
如何在MySQL中的数据库下删除所有的表
TOML配置文件格式,YAML最有力的竞争者
【Playwright测试教程】5分钟上手
In a more general sense, calculating the displacement distance and assumptions
小甲鱼汇编笔记
一文看懂推荐系统:召回04:离散特征处理,one-hot编码和embedding特征嵌入
Continuing to invest in product research and development, Dingdong Maicai wins in supply chain investment
贪吃蛇游戏Bug解析及功能扩展
Flask Framework Beginner-05-Command Management Manager and Database Use
WPE详细教程
flinkcdc 消费 mysql binlog 没有 sqltype=delete 的数据是什么原
keytool命令
【云原生】DevOps(六):Jenkins流水线