当前位置:网站首页>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,还是很容易上手的!
边栏推荐
- 实例041:类的方法与变量
- Continuing to invest in product research and development, Dingdong Maicai wins in supply chain investment
- Continuing to invest in product research and development, Dingdong Maicai wins in supply chain investment
- Kubernetes:(十一)KubeSphere的介绍和安装(华丽的篇章)
- 参加Oracle OCP和MySQL OCP考试的学员怎样在VUE预约考试
- 异步编程解决方案 Generator生成器函数、iterator迭代器、async/await、Promise
- Engineering drawing review questions (with answers)
- 【Playwright测试教程】5分钟上手
- Multithreading JUC Learning Chapter 1 Steps to Create Multithreading
- Qt中对象树的机制介绍以及底层实现,各种结果分析:(以及自己写容易犯错的点)
猜你喜欢
5. Scrapy middleware & distributed crawler
董明珠直播时冷脸离场,员工频犯低级错误,自家产品没人能弄明白
Web APIs BOM- 操作浏览器:swiper 插件
编写 BOLL 心得体会
[Study Notes Dish Dog Learning C] Dynamic Memory Management
Security First: Tools You Need to Know to Implement DevSecOps Best Practices
什么是SVN(Subversion)?
Rongyun "Audio and Video Architecture Practice" technical session [complete PPT included]
LeetCode:899. 有序队列【思维题】
Day13 Postman的使用
随机推荐
Example 037: Sorting
DDTL: Domain Transfer Learning at a Distance
关联接口测试
Kubernetes:(九)coredns(浪不动了)
2022年T电梯修理考题及答案
sql有关问题,小时粒度,找到前一个小时内的数据
贪吃蛇游戏Bug解析及功能扩展
脚手架内容详解分析
There are too many systems, how to realize multi-account interworking?
(cf)Codeforces Round #811 (Div. 3)A--E详细题解
0.1 前言
Taurus.MVC WebAPI 入门开发教程1:框架下载环境配置与运行(含系列目录)。
Countdown to 2 days, the "New Infrastructure of Cultural Digital Strategy and Ecological Construction of Cultural Art Chain" will kick off soon
Flink原理流程图简单记录
实例036:算素数
MallBook联合人民交通出版社,推动驾培领域新发展,开启驾培智慧交易新生态
Simple sorting (summer vacation daily question 14)
自制蓝牙手机app控制stm8/stm32/C51板载LED
Example 039: Inserting elements into an ordered list
In the season of going overseas, the localization of Internet tips for going overseas