#include "STC15W4K56S2.h"
#include "Counter1.h"
#include "USART.h"
#include "TIMER.h"
#include "PWM_CONTR.h"
#define u8 unsigned char
#define u16 unsigned int
u16 Speed_Temp=0;
sbit Led=P5^5;
struct _Pid{
u8 SetSpeed; //设置值
u8 ActualSpeed; //实际值
int err;
int err_next;
int err_last;
float Kp,Kd,Ki;
}pid;
void Seial_Creat(void);
void Timer_Creat(void);
void PID_Init(void);
u8 PID_Motor(u8 speed, u8 Aurespeed);
void main()
{
Counter1_config();
Seial_Creat();
Timer_Creat();
pwm_Init();
PID_Init();
Led=1;
EA=1;
while(1);
}
void Seial_Creat(void)
{
COMx_