51单片机直流电机PWM调速回复https://bbs.csdn.net/topics/392742676

实现直流电机的1-7级pwm调速以及停止功能,同时将级数在数码管上显示

#include "reg52.h"
#include<intrins.h>	
//#include "math.h"
sbit QiTin = P3^0;//启停按键
sbit duan = P2^6;//数码段
sbit wei = P2^7;//数码位
sbit NanBeiHong = P1^0;
sbit NanBeiHuan = P1^1;
sbit NanBeiLu = P1^2;
//sbit DongXiHong = P1^5;
//sbit DongXiHuan = P1^6;
//sbit DongXiLu = P1^7;
bit k=0, d=0;//中断标记//红绿灯倒换标记
unsigned char code ShuMaGuan[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F,0x00,0X80};//0~9隐.小数点
unsigned char code WeiXuanBiao[] = { 0x00,0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f };
unsigned char code ShaoMiaoZhi[]={238,237,235,231,222,221,219,215,190,189,187,183,126,125,123,119};
unsigned char Js=0;//中断计时
unsigned char Hm=0;//毫秒
unsigned char Mo=0;//秒
//unsigned char Dj=0;//倒计时
void ShuMaXianShi(unsigned char s,unsigned char w,unsigned char d)
{
	unsigned char YanShi=255;
	P0=WeiXuanBi
上一篇:基于单片机室内温湿度监测系统仿真设计-设计资料


下一篇:单片机2