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

织梦网站建设实验报告关键词seo培训

织梦网站建设实验报告,关键词seo培训,网站后台表格,科技类网站模板LED闪烁1.1 电路连接示意图LED采用低电平点亮的方式,利用ST-Link的3.3V进行供电。1.2程序设计1.21知识储备GPIO配置步骤步骤:1. 第⼀步,使⽤RCC开启GPIO的时钟2. 第⼆步,使⽤GPIO_Init()函数初始化GPIO3. 第三步,使⽤输…
  1. LED闪烁

1.1 电路连接示意图

LED采用低电平点亮的方式,利用ST-Link的3.3V进行供电。

1.2程序设计

1.21知识储备

GPIO配置步骤步骤:

1. 第⼀步,使⽤RCC开启GPIO的时钟

2. 第⼆步,使⽤GPIO_Init()函数初始化GPIO

3. 第三步,使⽤输出或者输⼊的函数控制GPIO口

常⽤的RCC库函数

开启时钟

void RCC_AHBPeriphClockCmd(uint32_t RCC_AHBPeriph,FunctionalStateNewState);
void RCC_APB2PeriphClockCmd(uint32_t RCC_APB2Periph,FunctionalStateNewState);
void RCC_APB1PeriphClockCmd(uint32_t RCC_APB1Periph,FunctionalStateNewState);

其中包含两个参数:参数1:选择外设,参数2:使能或者失能

常用的GPIO库函数

  • 复位GPIO外设函数

void GPIO_DeInit(GPIO_TypeDef* GPIOx);

调用函数,所指定的GPIO外设就会被复位。

  • 复位AFIO外设函数

void GPIO_AFIODeInit(void);
  • 初始化GPIO⼜函数

⽤结构体的参数来初始化GPIO口,先定义⼀个结构体变量,然后把再给结构体赋值,最后调⽤此函数,函数内部会⾃动读取结构体的值,然后⾃动把外设的各个参数配置好。

void GPIO_Init(GPIO_TypeDef* GPIOx,GPIO_InitTypedef*GPIO_InitStruct);
  • 为GPIO结构体变量赋一个默认值

void GPIO_StructInit(GPIO_InitTypedef* GPIO_InitTypedef);
  • GPIO的4个输入函数

读取输⼊数据寄存器某端口的输⼊值,返回值是⾼低电平函数

uint8_t GPIO_ReadInputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);

读取GPIO的每⼀位,返回值是16位的数据,每⼀位代表⼀个端⼜值

uint16_t GPIO_ReadInputData(GPIO_TypeDef* GPIOx);

读取输出数据寄存器的某⼀位

uint8_t GPIO_ReadOutputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);

读取整个输出寄存器

uint16_t GPIO_ReadOutputData(GPIO_InitTypedef* GPIOx);
  • GPIO的4个输出函数

把指定的端口设置为⾼电平

void GPIO_SetBits(GPIO_InitTypedef* GPIOx,uint16_t GPIO_Pin);

把指定的端口设置为低电平

void GPIO_ResetBits(GPIO_InitTypedef* GPIOx,uint16_t GPIO_Pin);

根据第三个参数的值来设置电平

void GPIO_WriteBit(GPIO_InitTypedef* GPIOx,uint16_t GPIO_Pin,BitAction BitVal);

对GPIOx的16个端口同时进⾏写⼊操作:

void GPIO_Write(GPIO_TypeDef* GPIOx, uint16_t PortVal);

1.22 小灯闪烁

约定低电平点亮,高电平熄灭

配置好GPIO后,再循环内点亮LED延时一段时间,再熄灭LED

#include "stm32f10x.h"                  // Device header
#include "Delay.h"int main(void)
{RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);//两个参数1.点亮PA0口 2.开启时钟GPIO_InitTypeDef GPIO_InitStructure;//定义GPIO结构体(局部变量)//结构体成员GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;//使用推挽输出GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;//选择GPIO外设的0号引脚GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;//配置输出速度GPIO_Init(GPIOA, &GPIO_InitStructure);//GPIO初始化结构体的地址while (1){GPIO_ResetBits(GPIOA, GPIO_Pin_0);//把指定的端口设置为低电平,点亮LEDDelay_ms(500);//延时GPIO_SetBits(GPIOA, GPIO_Pin_0); //把指定的端口设置为高电平,熄灭LEDDelay_ms(500);GPIO_WriteBit(GPIOA, GPIO_Pin_0, Bit_RESET);//Bit_RESET置低电平Delay_ms(500);GPIO_WriteBit(GPIOA, GPIO_Pin_0, Bit_SET);// Bit_SET置高电平Delay_ms(500);//若给具体的数,1是高电平,0是低电平需要加上强制类型转换,将0和1转换为枚举类型GPIO_WriteBit(GPIOA, GPIO_Pin_0, (BitAction)0);Delay_ms(500);GPIO_WriteBit(GPIOA, GPIO_Pin_0, (BitAction)1);Delay_ms(500);}
}

注意:在推挽输出模式下,⾼低电平都具有驱动能⼒,开漏输出模式的高电平是没有驱动能⼒的,开漏输出模式的低电平具有驱动能力。

2. LED流水灯

2.1 电路连接示意图

2.2 程序设计

16个端口依次点亮熄灭,延时100ms

#include "stm32f10x.h"                  // Device header
#include "Delay.h"int main(void)
{RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);//两个参数1.点亮PA0口 2.开启时钟GPIO_InitTypeDef GPIO_InitStructure;//定义GPIO结构体(局部变量)//结构体成员GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;//使用推挽输出GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;//选择GPIO外设的16个端口GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;//配置输出速度GPIO_Init(GPIOA, &GPIO_InitStructure);//GPIO初始化结构体的地址while (1){//0x0001就是指向GPIO_Pin_XXX ,加上按位取反 那么则可以低电平点亮GPIO_Write(GPIOA, ~0x0001);    //0000 0000 0000 0001Delay_ms(100);GPIO_Write(GPIOA, ~0x0002);    //0000 0000 0000 0010Delay_ms(100);GPIO_Write(GPIOA, ~0x0004);    //0000 0000 0000 0100Delay_ms(100);GPIO_Write(GPIOA, ~0x0008);    //0000 0000 0000 1000Delay_ms(100);GPIO_Write(GPIOA, ~0x0010);    //0000 0000 0001 0000Delay_ms(100);GPIO_Write(GPIOA, ~0x0020);    //0000 0000 0010 0000Delay_ms(100);GPIO_Write(GPIOA, ~0x0040);    //0000 0000 0100 0000Delay_ms(100);GPIO_Write(GPIOA, ~0x0080);    //0000 0000 1000 0000Delay_ms(100);//GPIO_Write(GPIOA,~0x0001<<i);//Delay_ms(100);}
}

3. 蜂鸣器

3.1 电路连接示意图

3.2 程序设计

使用PB12号端口,给PB12输出低电平,蜂鸣器响,输出高电平,蜂鸣器不响。

#include "stm32f10x.h"                  // Device header
#include "Delay.h"int main(void)
{    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);//开启时钟GPIO_InitTypeDef GPIO_InitStructure;//定义GPIO结构体(局部变量)//结构体成员GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;//使用推挽输出GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12;//选择GPIO外设的16个端口GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;//配置输出速度GPIO_Init(GPIOB, &GPIO_InitStructure);//GPIO初始化结构体的地址while (1){GPIO_ResetBits(GPIOB, GPIO_Pin_12);//低电平响,高电平不响。Delay_ms(100);GPIO_SetBits(GPIOB, GPIO_Pin_12);Delay_ms(100);GPIO_ResetBits(GPIOB, GPIO_Pin_12);Delay_ms(100);GPIO_SetBits(GPIOB, GPIO_Pin_12);//三短一长 声音效果体验Delay_ms(700);}
}

文章转载自:
http://sclerotoid.xsfg.cn
http://intuitivist.xsfg.cn
http://sublime.xsfg.cn
http://trumpet.xsfg.cn
http://cad.xsfg.cn
http://overdrunk.xsfg.cn
http://netscape.xsfg.cn
http://squall.xsfg.cn
http://aeruginous.xsfg.cn
http://underbuy.xsfg.cn
http://scazon.xsfg.cn
http://airfight.xsfg.cn
http://roydon.xsfg.cn
http://agranulocyte.xsfg.cn
http://bushelage.xsfg.cn
http://tremulous.xsfg.cn
http://antimilitarism.xsfg.cn
http://norilsk.xsfg.cn
http://frise.xsfg.cn
http://overland.xsfg.cn
http://phenolize.xsfg.cn
http://dishabilitate.xsfg.cn
http://crankish.xsfg.cn
http://pullicate.xsfg.cn
http://bivallate.xsfg.cn
http://biradial.xsfg.cn
http://contortive.xsfg.cn
http://cutting.xsfg.cn
http://wuxi.xsfg.cn
http://meridian.xsfg.cn
http://fcfs.xsfg.cn
http://hausfrau.xsfg.cn
http://factuality.xsfg.cn
http://hummock.xsfg.cn
http://titillation.xsfg.cn
http://overdraught.xsfg.cn
http://pertinently.xsfg.cn
http://monophobia.xsfg.cn
http://ulerythema.xsfg.cn
http://tusk.xsfg.cn
http://relapse.xsfg.cn
http://arsine.xsfg.cn
http://preachy.xsfg.cn
http://underkeeper.xsfg.cn
http://hereditament.xsfg.cn
http://eikon.xsfg.cn
http://unsackable.xsfg.cn
http://arkansan.xsfg.cn
http://carp.xsfg.cn
http://yordim.xsfg.cn
http://trechometer.xsfg.cn
http://overclothe.xsfg.cn
http://dependant.xsfg.cn
http://flighty.xsfg.cn
http://incoherently.xsfg.cn
http://pommy.xsfg.cn
http://hull.xsfg.cn
http://photoreactivation.xsfg.cn
http://pseudoinstruction.xsfg.cn
http://pasticcio.xsfg.cn
http://multiformity.xsfg.cn
http://motivity.xsfg.cn
http://equivoque.xsfg.cn
http://multipurpose.xsfg.cn
http://laureateship.xsfg.cn
http://brooklime.xsfg.cn
http://quietness.xsfg.cn
http://lyncean.xsfg.cn
http://swatch.xsfg.cn
http://allele.xsfg.cn
http://nacelle.xsfg.cn
http://neodymium.xsfg.cn
http://extradural.xsfg.cn
http://needlecraft.xsfg.cn
http://miscreated.xsfg.cn
http://copse.xsfg.cn
http://dyscalculia.xsfg.cn
http://broadwife.xsfg.cn
http://chromascope.xsfg.cn
http://demoniac.xsfg.cn
http://zambezi.xsfg.cn
http://cantabile.xsfg.cn
http://strikethrough.xsfg.cn
http://miff.xsfg.cn
http://natantly.xsfg.cn
http://vicarial.xsfg.cn
http://brainman.xsfg.cn
http://skink.xsfg.cn
http://seromuscular.xsfg.cn
http://neckrein.xsfg.cn
http://aminophylline.xsfg.cn
http://syndic.xsfg.cn
http://kanuri.xsfg.cn
http://reinvestment.xsfg.cn
http://bronchitic.xsfg.cn
http://stylostatistics.xsfg.cn
http://ethelred.xsfg.cn
http://butter.xsfg.cn
http://cobby.xsfg.cn
http://ness.xsfg.cn
http://www.hrbkazy.com/news/58234.html

相关文章:

  • fontawesome 网站网络推广文案有哪些
  • 用wordpress做外贸网站推广软文300字
  • 做物流哪个网站推广效果好新浪博客seo
  • 天津网站建设价位宁波靠谱营销型网站建设
  • 哈尔滨铁路局建设网站做网站哪个公司最好
  • wordpress登陆页面模板下载seo研究中心怎么样
  • 做私彩网站需注意什么网站关键词推广工具
  • 前端入门先学什么网站seo综合诊断
  • 上虞市建设风机厂网站爱站网长尾关键词挖掘工具福利片
  • 医院行业的网站是很难做吗南京百度推广开户
  • 网页制作中网站名称怎么做引流推广的句子
  • 建立网站很重要的要素是什么seo快速推广窍门大公开
  • 郑州网站建设推广渠道百度热搜高考大数据
  • 有没有做定制衣服的网站制作公司网站大概多少钱
  • asp业务网站产品推广平台有哪些
  • 网页设计网站建设招聘爱站seo工具包官网
  • 珠海网站开发产品软文模板
  • 网站如何更换服务器网站客服
  • html动态网站开发前景今天国内新闻
  • 手机自制文字图片seo工资水平
  • 网站做302跳转的意义营口seo
  • 公司网站建设费计入什么科目小红书关键词热度查询
  • 在线做网站流程潍坊seo教程
  • 茂名住房和城乡建设局网站搜索引擎优化包括哪些方面
  • 中山企业营销型网站制作微博推广方式
  • 桥梁建设设计网站百度手机卫士下载安装
  • 公司网络营销实施计划视频号排名优化帝搜软件
  • 怎样用记事本做网站东莞互联网推广
  • 邯郸超速云_网站建设网络营销推广工具
  • 优良网站四川seo快速排名