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

荆门哪里做网站关键的近义词

荆门哪里做网站,关键的近义词,顶呱呱做网站,栾川有做网站的吗学会电机调速&#xff0c;掌握中国速度 PWM的生成方法 先用户设定一个比较值&#xff0c;然后计数器定时自增。 当计数器<比较值&#xff0c;输出0 当计数器>比较值&#xff0c;输出1 main.c #include <REGX52.H> #include"delay.h" #include"…

学会电机调速,掌握中国速度

PWM的生成方法

先用户设定一个比较值,然后计数器定时自增。
当计数器<比较值,输出0
当计数器>比较值,输出1
在这里插入图片描述
在这里插入图片描述

main.c

#include <REGX52.H>
#include"delay.h"
#include"key.h"
#include"Nixie.h"
#include"Timer0.h"unsigned char Counter,Compare;
unsigned char KeyNum,Speed;
sbit Motor=P1^0;void main()
{Timer0_Init();while(1){KeyNum=Key();if(KeyNum==1){Speed++;Speed%=4;if(Speed==0){Compare=0;}if(Speed==1){Compare=50;}if(Speed==2){Compare=75;}if(Speed==3){Compare=100;}}Nixie(1,Speed);}	}void Timer0_Routine() interrupt 1
{TL0 = 0x9C;		//设置定时初值TH0 = 0xFF;		//设置定时初值Counter++;Counter%=100;if(Counter<Compare){Motor=1;}else{Motor=0;}
}

delay.c

void Delay(unsigned int xms)		//@12.000MHz
{while(xms){unsigned char i, j;i = 2;j = 239;do{while (--j);} while (--i);xms--;
}
}

delay.h

#ifndef _DELAY_H__
#define _DELAY_H__
void Delay(unsigned int xms);#endif

key.c

#include <REGX52.H>
#include "Delay.h"/*** @brief  获取独立按键键码* @param  无* @retval 按下按键的键码,范围:0~4,无按键按下时返回值为0*/
unsigned char Key()
{unsigned char KeyNumber=0;if(P3_1==0){Delay(20);while(P3_1==0);Delay(20);KeyNumber=1;}if(P3_0==0){Delay(20);while(P3_0==0);Delay(20);KeyNumber=2;}if(P3_2==0){Delay(20);while(P3_2==0);Delay(20);KeyNumber=3;}if(P3_3==0){Delay(20);while(P3_3==0);Delay(20);KeyNumber=4;}return KeyNumber;
}

key.h

#ifndef __KEY_H__
#define __KEY_H__unsigned char Key();#endif

Nixie.c

#include <REGX52.H>
#include "Delay.h"	//包含Delay头文件//数码管段码表
unsigned char NixieTable[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};//数码管显示子函数
void Nixie(unsigned char Location,Number)
{switch(Location)		//位码输出{case 1:P2_4=1;P2_3=1;P2_2=1;break;case 2:P2_4=1;P2_3=1;P2_2=0;break;case 3:P2_4=1;P2_3=0;P2_2=1;break;case 4:P2_4=1;P2_3=0;P2_2=0;break;case 5:P2_4=0;P2_3=1;P2_2=1;break;case 6:P2_4=0;P2_3=1;P2_2=0;break;case 7:P2_4=0;P2_3=0;P2_2=1;break;case 8:P2_4=0;P2_3=0;P2_2=0;break;}P0=NixieTable[Number];	//段码输出//Delay(1);				//显示一段时间//P0=0x00;				//段码清0,消影
}

Nixie.h

#ifndef __NIXIE_H__
#define __NIXIE_H__void Nixie(unsigned char Location,Number);#endif

Timer0.c

#include <REGX52.H>/*** @brief  定时器0初始化,100us@12.000MHz* @param  无* @retval 无*/
void Timer0_Init(void)
{TMOD &= 0xF0;		//设置定时器模式TMOD |= 0x01;		//设置定时器模式TL0 = 0x9C;		//设置定时初值TH0 = 0xFF;		//设置定时初值TF0 = 0;		//清除TF0标志TR0 = 1;		//定时器0开始计时ET0=1;EA=1;PT0=0;
}

Timer0.h

#ifndef __TIMER0_H__
#define __TIMER0_H__void Timer0_Init(void);#endif
http://www.yidumall.com/news/49328.html

相关文章:

  • 做黄色网站赚钱么独立站谷歌seo
  • 中国建筑设计作品网站长沙seo网站管理
  • 一个人完成网站建设seo自动推广软件
  • 网站建设营销推广实训总结小红书笔记关键词排名优化
  • 瑞金建设局网站关键词排名是由什么决定的
  • 淄博网站建设优化seo软文网站平台
  • 网站开发 免代码百度推广介绍
  • 男女做那个能看的视频网站高权重友情链接
  • 学做网站可以赚钱吗英雄联盟最新赛事
  • 有服务器可以做网站吗市场营销策划方案案例
  • wordpress 首页跳转网络seo软件
  • 专业做国外网站宁波怎么优化seo关键词
  • 商城网站制作公司地址德州seo整站优化
  • 做网站首页的尺寸广州seo报价
  • 怎么做cc网站百度大盘指数
  • 衢州高端网站建设完善的seo网站
  • 做网站能挣钱吗谷歌竞价广告
  • ajax+jsp网站开发从入门到精通中国十大互联网公司
  • 电子商务平台内的自然人东莞seo建站
  • 襄阳地区网站做的好的网站推广优化的方法
  • 可以在网上接网站做的网址网络推广运营途径
  • 做外贸网站需要注意哪些电脑培训中心
  • 如何给网站做优化代码希爱力双效片副作用
  • 如何提升网站的流量站长之家域名查询官网
  • 如何做网站流量报告seo网站排名助手
  • 视频号视频怎么看下载链接seo标签优化
  • 做网站每天任务及实训过程搜狗官方网站
  • 网站靠什么挣钱西安关键词推广
  • 做暖暖欧美网站网络seo哈尔滨
  • 中国最早做网站是谁win7系统优化大师