基于单片机无刷电机调速仿真设计-毕设资料
作者:互联网
#include "reg51.h"
#include "stdio.h"
sbit HC = P1 ^ 0;
sbit HB = P1 ^ 1;
sbit HA = P1 ^ 2;
sbit AH = P2 ^ 1;
sbit BH = P2 ^ 3;
sbit CH = P2 ^ 5;
sbit AL = P2 ^ 0;
sbit BL = P2 ^ 2;
sbit CL = P2 ^ 4;
sbit START = P0 ^ 0;
sbit STOP = P0 ^ 1;
sbit ADD = P0 ^ 2;
sbit SUB = P0 ^ 3;
sbit PPWM = P1 ^ 5;
bit star = 0;
unsigned char time; /* 定义占空比的变量 */
int a, b;
unsigned char PWM = 0;
unsigned char count;
HALL[6] = { 0x05, 0x04, 0x06, 0x02, 0x03, 0x01 };
unsigned char N0, N1;
unsigned char Flag;
void delay_ms( int n )
{
for ( a = n; a > 0; a-- )
for ( b = 100; b > 0; b-- )
;
}
void Scanhall( unsigned char hall )
{
unsigned char i;
for ( i = 0; i < 6; i++ )
{
if ( HALL[i] == hall )
{
标签:P2,P0,毕设,unsigned,无刷电机,char,单片机,P1,sbit 来源: https://blog.csdn.net/DIY_lOVER/article/details/113852059