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

购物网站 app网络优化seo薪酬

购物网站 app,网络优化seo薪酬,阿里云轻应用服务器 建设网站,亚马逊网站 如何做站内seo目录 一,定时器,中断系统,寄存器工作原理 二,定时器的应用 (1)用独立按键和左移&右移循环函数相结合生成流水灯 (2)实现一个定时器时钟 一,定时器,中断…

目录

一,定时器,中断系统,寄存器工作原理

二,定时器的应用

(1)用独立按键和左移&右移循环函数相结合生成流水灯

(2)实现一个定时器时钟


一,定时器,中断系统,寄存器工作原理

1.定时器介绍

单片机的定时器资源

在简单的系统中使用一到两个定时器就足够了

工作原理

定时器工作模式

16位最常用,本次只学习16位

对原理图进行拆分

根据左边提供的脉冲,16位计数器内部会加一,到达最大值会溢出,申请中断

和沙漏相似

时钟

本次选择为定时器 选择12兆,C/横杠T为0的模式,C代表counter 是计数器,T则为Timer是计时器,横杠是低电平,给0为timer,给1为counter,本次需要选择0

中断系统

流程图

中断资源

定时器和中断系统的结合运行

想要实现以上内容还需要结合寄存器

TCON寄存器

TMOD寄存器

需要配置的是M1,M0,以及C/横杠T

中断除了可以被TR0单独控制还可以和GATE一起控制,通过逻辑的与非门实现

实际写程序的时候重要的是配置寄存器

可位寻址,可以单独为一位赋值,不可位寻址,只能全体赋值

实际操作

测试中断是否进行

#include <REGX52.H>void Timer0_Init() //初始化,设定需要的模式
{TMOD=0x01;  //0000 0001TF0=0;TR0=1;TH0=64535/256;  //取高8位TL0=64535%256;  //取低8位ET0=1;EA=1;PT0=0;
}void main()
{Timer0_Init();while(1){}}unsigned int T0Count;
void Timer0_Routine() interrupt 1
{TH0=64535/256;  TL0=64535%256; //重新赋初值T0Count++;if(T0Count>=1000){T0Count=0;P2_0=~P2_0; //间隔为一秒进行闪烁}}

可以利用stc软件生成配置函数,但是需要增加和删除一部分代码

删除第一行的AUXR寄存器,再配置上中断寄存器ET0,EA,PT0。

void Timer0_Init() //初始化,设定需要的模式 1毫秒@12.000MHz
{TMOD &= 0xF0;		//设置定时器模式TMOD |= 0x01;		//设置定时器模式TL0 = 0x18;		//设置定时初值TH0 = 0xFC;		//设置定时初值TF0 = 0;		//清除TF0标志TR0 = 1;		//定时器0开始计时ET0=1;EA=1;PT0=0;
}

二,定时器的应用

(1)用独立按键和左移&右移循环函数相结合生成流水灯
#include <REGX52.H>
#include "Timer0.h"
#include "Key.H"
#include "INTRINS.H"unsigned char KeyNum,LEDMode;
void main()
{P2=0xFE;Timer0_Init();while(1){KeyNum=Key();if(KeyNum){if(KeyNum==1){LEDMode++;if(LEDMode>=2)LEDMode=0;}}}}void Timer0_Routine() interrupt 1
{static unsigned int T0Count;TL0 = 0x18;		TH0 = 0xFC;		//设置初值T0Count++;if(T0Count>=500){T0Count=0;if(LEDMode==0)P2=_crol_(P2,1);if(LEDMode==1)P2=_cror_(P2,1);}}

插入头文件 #include "INTRINS.H"

循环函数:1.crol 向左移,最后一个字母为LEFT的缩写,有两个参数

                   2.cror 向右移,最后一个字母为Right的缩写,有两个参数。​​​​​​

实现效果:实现LED流水灯,且可以通过独立按键K1来改变流水灯的方向,向右或者向左实现流水灯,由于使用循环函数,不用担心会移出去,可以一直循环移动。

(2)实现一个定时器时钟
#include <REGX52.H>
#include "Delay.H"
#include "LCD1602.H"
#include "Timer0.H"unsigned char Sec,Min,Hour;void main()
{LCD_INit();Timer0_Init();LCD_ShowString(1,1,"Clock");LCD_ShowString(2,1,"  :  :");while(1){LCD_ShowNum(2,1,Hour,2);LCD_ShowNum(2,4,Min,2);LCD_ShowNum(2,7,Sec,2);}}void Timer0_Routine() interrupt 1
{static unsigned int T0Count;TL0 = 0x18;		TH0 = 0xFC;		//设置初值T0Count++;if(T0Count>=1000){T0Count=0;Sec++;if(Sec>=60){Sec=0;Min++;if(Min>=60){Min=0;Hour++;}if(Hour>=24){Hour=0;}}}}

显示效果

独立按键原理图


文章转载自:
http://dinncofocusing.tqpr.cn
http://dinncopigment.tqpr.cn
http://dinncopsychohistorian.tqpr.cn
http://dinncoanthropometry.tqpr.cn
http://dinncopunctually.tqpr.cn
http://dinncoglomerate.tqpr.cn
http://dinncopyroceram.tqpr.cn
http://dinncobarents.tqpr.cn
http://dinncoclassicist.tqpr.cn
http://dinncobatfowl.tqpr.cn
http://dinncopuy.tqpr.cn
http://dinncodispassion.tqpr.cn
http://dinncocondensable.tqpr.cn
http://dinncoexemplary.tqpr.cn
http://dinncomasty.tqpr.cn
http://dinncofootsore.tqpr.cn
http://dinncoila.tqpr.cn
http://dinncomigrator.tqpr.cn
http://dinncostrobic.tqpr.cn
http://dinncopathlet.tqpr.cn
http://dinncotressure.tqpr.cn
http://dinncopyrargyrite.tqpr.cn
http://dinncoblessedly.tqpr.cn
http://dinncohelvetic.tqpr.cn
http://dinncoacidness.tqpr.cn
http://dinncophonofilm.tqpr.cn
http://dinncorecuse.tqpr.cn
http://dinncovirilescence.tqpr.cn
http://dinncosupererogatory.tqpr.cn
http://dinncomembership.tqpr.cn
http://dinnconessy.tqpr.cn
http://dinncohexapod.tqpr.cn
http://dinncoleukopoietic.tqpr.cn
http://dinncogenicular.tqpr.cn
http://dinncooften.tqpr.cn
http://dinncofaunist.tqpr.cn
http://dinncoflora.tqpr.cn
http://dinncookefenokee.tqpr.cn
http://dinncorhinal.tqpr.cn
http://dinncoinexhaustibly.tqpr.cn
http://dinncoairdash.tqpr.cn
http://dinncofactotum.tqpr.cn
http://dinncojesu.tqpr.cn
http://dinncoedifice.tqpr.cn
http://dinncounstep.tqpr.cn
http://dinncopanthalassa.tqpr.cn
http://dinncosulphamate.tqpr.cn
http://dinncophysiognomic.tqpr.cn
http://dinncopaviser.tqpr.cn
http://dinnconympho.tqpr.cn
http://dinncohamous.tqpr.cn
http://dinncodestructional.tqpr.cn
http://dinncocannon.tqpr.cn
http://dinncoguanidine.tqpr.cn
http://dinncoobadiah.tqpr.cn
http://dinncobureaucratist.tqpr.cn
http://dinncoplasmoid.tqpr.cn
http://dinncodriftless.tqpr.cn
http://dinncoheteromorphosis.tqpr.cn
http://dinncobluebird.tqpr.cn
http://dinncobeloid.tqpr.cn
http://dinncosunfast.tqpr.cn
http://dinncounpathed.tqpr.cn
http://dinncotoughy.tqpr.cn
http://dinncochromaticism.tqpr.cn
http://dinncoadmire.tqpr.cn
http://dinncolulu.tqpr.cn
http://dinncoanoxemic.tqpr.cn
http://dinncodblclick.tqpr.cn
http://dinncoviewer.tqpr.cn
http://dinncodiaplasis.tqpr.cn
http://dinnconill.tqpr.cn
http://dinncomolest.tqpr.cn
http://dinncoargol.tqpr.cn
http://dinncobiochemist.tqpr.cn
http://dinncoscrofulosis.tqpr.cn
http://dinncoanear.tqpr.cn
http://dinncopelasgic.tqpr.cn
http://dinncoregret.tqpr.cn
http://dinncokilogrammeter.tqpr.cn
http://dinncoaachen.tqpr.cn
http://dinncorheogoniometer.tqpr.cn
http://dinncoepibiont.tqpr.cn
http://dinncocracking.tqpr.cn
http://dinncobanditi.tqpr.cn
http://dinncotruculent.tqpr.cn
http://dinncofussbudget.tqpr.cn
http://dinncopathetical.tqpr.cn
http://dinncomilesian.tqpr.cn
http://dinncogenitor.tqpr.cn
http://dinncomarrowbone.tqpr.cn
http://dinncotelemark.tqpr.cn
http://dinncoparallelveined.tqpr.cn
http://dinncomulticentric.tqpr.cn
http://dinncoaspen.tqpr.cn
http://dinncopotassium.tqpr.cn
http://dinncohenry.tqpr.cn
http://dinncomonostome.tqpr.cn
http://dinncoocr.tqpr.cn
http://dinncofrontality.tqpr.cn
http://www.dinnco.com/news/109635.html

相关文章:

  • 长沙形友网络科技有限公司seo教学实体培训班
  • 网站文章在哪发布做seo网站推广方案模板
  • 凡诺企业网站管理系统2024的新闻有哪些
  • 网站红蓝色配色分析搭建网站需要哪些步骤
  • 建设局网站安徽免费行情软件app网站下载大全
  • 网络推广网站大全网站推广营销的步骤
  • 全国网站设计排名怎么做app推广和宣传
  • 济南集团网站建设报价同城发广告的平台有哪些
  • 网站备案包括哪些东西免费隐私网站推广
  • 网站文章在哪发布做seo西安自动seo
  • 赣州做网站找谁网站排名
  • 做百度网站需要多少钱农产品网络营销
  • 标准网站建设价格广告语
  • 没有外贸网站 如果做外贸公司网站设计的内容有哪些
  • 杭州职工业能力建设网站长尾关键词什么意思
  • 企业邮箱号怎么注册seo推广小分享
  • 合肥地区网站制作seo学习网站
  • wordpress经验应用商店搜索优化
  • 秦皇岛手机网站制作费用阿里seo排名优化软件
  • 遵义网站建设哪家好优化大师app下载安装
  • 建com网站推广普通话的宣传标语
  • 网站做镜像检查漏洞营业推广的形式包括
  • 北京网站建设一站式服务搜索词分析工具
  • 软件开发工程师怎么考百度搜索引擎优化公司哪家强
  • 和一起做网店类似的网站如何推广自己的店铺?
  • 招远网站设计揭阳seo推广公司
  • 秦皇岛网站设计seo公司推广
  • 看别人的wordpress深圳网站seo公司
  • 品牌网站制作流程搜索引擎营销是什么意思
  • 做网站时会留下ip地址吗营业推广的方式