当前位置: 首页 > news >正文

做公司网站 找谁做上海seo培训中心

做公司网站 找谁做,上海seo培训中心,短视频运营计划书,安卓app免费下载1、标准外设库获取 第一步,首先获取标准外设库,可以从官网进行下载。 https://www.st.com.cn/zh/embedded-software/stm32-standard-peripheral-libraries.html 根据自己的型号选择不同的系列,我这里选择是STM32F1系列 下载最新版本V3.6&a…

1、标准外设库获取

第一步,首先获取标准外设库,可以从官网进行下载。

https://www.st.com.cn/zh/embedded-software/stm32-standard-peripheral-libraries.html

根据自己的型号选择不同的系列,我这里选择是STM32F1系列

下载最新版本V3.6,点击获取版本后,需要进行登录账号,没有账号的话,可以填写邮箱,ST官方会通过邮件的方式自动发送下载链接,一般点击之后几分钟之内就会收到邮件,邮件里面点击链接进行获取软件。

2、标准库模板搭建

在标准库模块搭建之前,需要做好下面工作,keill安装不做过多介绍,pack包可以在keill在线安装,也可以通过官网下载安装,标准库第一步已经完成。

  • 已经安装好 Keil 软件
  • 已经安装好 STM32F1xx 的 Pack 包
  • 已经下载好 STM32F1xx 标准固件库

2.1、工程文件目录创建

  • Project:放工程文件,编译文件等。
  • Firmware:放 ARM 内核文件,标准外设库文件等。
  • Hardware:放开发板的硬件驱动文件。
  • User:放 main 函数,stm32f4xx_it 文件,systick 文件。
  • Doc: 放 readme.txt 文件,工程说明文件。

2.2、固件库移植

下载官方标准固件库之后,得到是是一个zip压缩文件,将文件解压。

然后将en.stsw-stm32054_v3-6-0\STM32F10x_StdPeriph_Lib_V3.6.0\Libraries 文件夹下的内容全部拷贝到新建目录的Firmware 下

2.3、程序入口移植

找到我们的固件库的下载目录,将en.stsw-stm32054_v3-6-0\STM32F10x_StdPeriph_Lib_V3.6.0\Project\STM32F10x_StdPeriph_Template中的如下文件进行拷贝

将这些文件全部都拷贝到我们的新建目录User文件下

2.4、Keil工程相关配置

打开 keil,点击最上面的 Project 选项卡,选择 New uVision Project 选项新建一个工程

选择保存路径为我们刚才创建的文件夹下的 Project,文件名为 STM32Template,然后点击保存

现在我们工程创建好了,下一步选择对应芯片型号

确定所需芯片之后,弹出 RTE 的环境配置对话框,选择工程所需的组件,不用配置,点击取消

下一步分组创建,将相应文件添加到分组中

创建完分组左边项目览 如下图所示,Firmare中存放着我们的标准外设文件。根据需要进行添加,

需要注意,不同103的启动文件不一样,根据自己的型号进行选择,我这边是STMF103C6T6,32k内存,属于小容量芯片,选择startup_stm32f10x_ld.s

如何选择可以看这下面两个图片,了解自己的芯片内存大小选择合适的启定文件导入。

导入之后下一步进入工程配置

点击魔法棒,进入配置,在Target中选择V6.21。

output中勾选Browse infomation,勾选之后编译的时候自动生成hex文件。

在C/C++中按照如下图进行配置,include Path为文件路径,根据自己分组进行添加。

在Debug选择自己的烧录方式

2.5、增加延时函数

在User中增加systick.hsystick.c

/*!\file    systick.h\brief   the header file of systick\version 2016-08-15, V1.0.0, firmware for GD32F4xx\version 2018-12-12, V2.0.0, firmware for GD32F4xx\version 2020-09-30, V2.1.0, firmware for GD32F4xx\version 2022-03-09, V3.0.0, firmware for GD32F4xx
*//*Copyright (c) 2022, GigaDevice Semiconductor Inc.Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:1. Redistributions of source code must retain the above copyright notice, thislist of conditions and the following disclaimer.2. Redistributions in binary form must reproduce the above copyright notice,this list of conditions and the following disclaimer in the documentationand/or other materials provided with the distribution.3. Neither the name of the copyright holder nor the names of its contributorsmay be used to endorse or promote products derived from this software withoutspecific prior written permission.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/#ifndef SYS_TICK_H
#define SYS_TICK_H#include <stdint.h>/* configure systick */
void systick_config(void);
/* delay a time in milliseconds */
void delay_1ms(uint32_t count);
/* delay decrement */
void delay_decrement(void);void delay_1us(uint32_t count);#endif /* SYS_TICK_H */
/*!\file    systick.c\brief   the systick configuration file\version 2024-01-15, V3.2.0, firmware for GD32F4xx
*//*Copyright (c) 2024, GigaDevice Semiconductor Inc.Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:1. Redistributions of source code must retain the above copyright notice, thislist of conditions and the following disclaimer.2. Redistributions in binary form must reproduce the above copyright notice,this list of conditions and the following disclaimer in the documentationand/or other materials provided with the distribution.3. Neither the name of the copyright holder nor the names of its contributorsmay be used to endorse or promote products derived from this software withoutspecific prior written permission.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/#include "stm32f10x.h"
#include "systick.h"volatile static uint32_t delay;/*!\brief    configure systick\param[in]  none\param[out] none\retval     none
*/
void systick_config(void)
{/* setup systick timer for 1000000Hz interrupts */if(SysTick_Config(SystemCoreClock / 1000000U)) {/* capture error */while(1) {}}/* configure the systick handler priority */NVIC_SetPriority(SysTick_IRQn, 0x00U);
}/*!\brief    delay a time in milliseconds\param[in]  count: count in milliseconds\param[out] none\retval     none
*/
void delay_1ms(uint32_t count)
{delay = count*1000;while(0U != delay) {}
}//睡眠1us=1/1000ms
void delay_1us(uint32_t count)
{delay = count;while(0U != delay) {}
}/*!\brief    delay decrement\param[in]  none\param[out] none\retval     none
*/
void delay_decrement(void)
{if(0U != delay) {delay--;}
}

打开"stm32f10x_it.c"拉到最后,然后删除

2.6、程序代码修改

打开 main.c 文件,删除一些不必要的代码,加上系统时钟,剩余部分如下:

#include "stm32f10x.h"
#include <stdio.h>
#include "systick.h"int main(void)
{
//系统滴答时钟初始化
systick_config();while (1){}
}

在stm32f10x_it.h中添加头文件systick.h

3、测试程序

点亮PC13,每秒进行亮灭闪烁。

#include "stm32f10x.h"
#include <stdio.h>
#include "systick.h"//PC13 GPIO初始化void gpio_config() {//开启时钟RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC,ENABLE); //开启GPIOC的时钟//使用各个外设前必须开启时钟,否则对外设的操作无效/*GPIO初始化*///定义结构体变量GPIO_InitTypeDef 	GPIO_InitStruct;//GPIO引脚,赋值为第13号引脚GPIO_InitStruct.GPIO_Pin  = GPIO_Pin_13;//GPIO速度,赋值为50MHzGPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;//GPIO模式,赋值为推挽输出模式GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;//将赋值后的构体变量传递给GPIO_Init函数GPIO_Init(GPIOC,&GPIO_InitStruct);}int main(void)
{//系统滴答时钟初始化systick_config();//GPIO初始化gpio_config();while (1){//引脚设置为低电平GPIO_ResetBits(GPIOC,GPIO_Pin_13);//延时1000msdelay_1ms(1000);//引脚设置为高电平GPIO_SetBits(GPIOC,GPIO_Pin_13);//延时1000msdelay_1ms(1000);}
}

4、问题与解决

1、STM32报错Error: L6218E: Undefined symbol assert_param

.\Objects\STMF103FC6T6.axf: Error: L6218E: Undefined symbol assert_param (referred from stm32f10x_gpio.o).

在C\C++设置一栏中输入USE_STDPERIPH_DRIVER使宏生效即可解决问题

2、../User/stm32f10x_it.c(136): error: call to undeclared function 'delay_decreme'

delay_decreme未定义,需要在stm32f10x_it.h中添加头文件systick.h

../User/stm32f10x_it.c(136): error: call to undeclared function 'delay_decrement'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]136 |         delay_decrement();

#ifndef __STM32F10x_IT_H
#define __STM32F10x_IT_H#ifdef __cplusplusextern "C" {
#endif /* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
#include "systick.h"
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */void NMI_Handler(void);
void HardFault_Handler(void);
void MemManage_Handler(void);
void BusFault_Handler(void);
void UsageFault_Handler(void);
void SVC_Handler(void);
void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);#ifdef __cplusplus
}
#endif#endif /* __STM32F10x_IT_H */

http://www.mmbaike.com/news/48566.html

相关文章:

  • 做好档案整理及网站建设百度推荐现在为什么不能用了
  • wordpress 随机广告粤语seo是什么意思
  • 竞价网站策划百度联盟是什么
  • 服装如何做微商城网站建设市场调研方法
  • 海淀网站建设电话购物网站页面设计
  • 做网站办什么类型营业执照网站优化公司收费
  • 品辰设计的网站谁做的seo竞争对手分析
  • 北京代理记账财务公司安卓优化大师新版
  • 密云重庆网站建设电脑培训机构哪个好
  • 潍坊网站设计公司搜索排名怎么做
  • 发帖子的网站郑州seo公司
  • wix网页制作seo快速排名软件首页
  • 自己做网站可以吗百度提交网址多久才会收录
  • 安阳做网站公司学网络与新媒体后悔死了
  • 嘉兴网站制作套餐网络软文是什么
  • 网站服务器的搭建杭州seo营销公司
  • 软件开发流程五个步骤sem和seo
  • 有什么网站可以做家教google搜索排名优化
  • 17网站一起做网店档口出租新华传媒b2b商务平台
  • 企业网站seo平台郑州网站seo外包
  • 做简单网站需要学什么软件有哪些内容个人博客搭建
  • jsp做的网站代码sem账户托管
  • 电子商务网站建设外包服务的企业网络销售哪个平台最好
  • 上饶建设网站搜索引擎优化关键字
  • 网站背景音乐怎么做优化大师卸载不了
  • 绵阳市 网站建设南宁推广公司
  • 郑州微信小程序定制公司郑州seo管理
  • 济南高端网站建设公司石家庄谷歌seo
  • 中山精品网站建设行情有创意的营销案例
  • 如何做医美机构网站观察分析天桥区seo全网宣传