#include "globalv.h"

unsigned int TimeCountCompuSpeed = 0, TimeCountTemp = 0, TimeCountkey = 0;
unsigned int TimeCountRealSpd = 0, TimeCountPID = 0, TimeCountAvgSpd = 0, TimeCountVI = 0;

unsigned char MOTORSTATE = STATESTARTCHECK;

const unsigned int PWM_EN_TAB[6] = {0x001, 0x001, 0x010, 0x010, 0x100, 0x100};
const unsigned char STEP_TAB[2][6] = {{1, 3, 2, 5, 0, 4}, {4, 0, 5, 2, 3, 1}};

uint16_t SampleData[4];

unsigned char ErrorCode = 0;
unsigned int Motor_Start_F = 0;
unsigned int Cur_step = 0;
unsigned char Dir = 1;

unsigned int HALLcount = 0, HALLcount1 = 0, HALLcountTemp;
unsigned int TargS1 = 150;
unsigned int RealS1 = 0;
unsigned int RealS = 0;
unsigned int SetSpeed = 0;
float KKN = 0, KPWMN = 0;

unsigned int OutPwmValue = 0;

unsigned int DIin = 0;
unsigned int CanshuV = 0;
unsigned int CanshuI = 0;

unsigned int MPolePairs = 15;
unsigned int MAXSPEED = 680;

unsigned int ISH = 8;
unsigned int VSH = 40;
unsigned int LSH = 9;

unsigned int MINSPEED = 10;
unsigned int SP = 50, SI = 50, SD = 50;

unsigned int STEP_last;

unsigned int startflag = 0, dirflag = 1;
unsigned int LevelSet = 1;
