closed loop test passed
This commit is contained in:
33
empty.c
33
empty.c
@@ -47,32 +47,39 @@ extern bool gIsI2cError;
|
||||
const float num_f = 0.123456f;
|
||||
|
||||
volatile uint16_t count = 0 ;
|
||||
const float Target = 10.0; //串口目标值
|
||||
const float Target = 10; //串口目标值
|
||||
|
||||
|
||||
int pp = 7; //电机极对数
|
||||
int Dir = 1; //电机编码器方向
|
||||
const int pp = 7; //电机极对数
|
||||
const int Dir = -1; //电机编码器方向
|
||||
|
||||
int main(void)
|
||||
{
|
||||
SYSCFG_DL_init();
|
||||
NVIC_EnableIRQ(UART_0_INST_INT_IRQN);
|
||||
DL_TimerA_startCounter(PWM_0_INST);
|
||||
FOC_Init(12);
|
||||
FOC_Init(12.6);
|
||||
DL_SYSTICK_resetValue();
|
||||
|
||||
while(1)
|
||||
{
|
||||
DL_GPIO_togglePins(LED_PORT, LED_PA0_PIN);
|
||||
//delay_ms(10);
|
||||
volatile float angle_rad = GetAngle();
|
||||
if(DEBUG_ENABLED)
|
||||
{
|
||||
printf("angle %.5f \n", angle_rad);
|
||||
}
|
||||
|
||||
// volatile uint32_t tick = DL_SYSTICK_getValue();
|
||||
// printf("systick is %x \n",tick);
|
||||
velocityopenloop(Target);
|
||||
|
||||
if(DEBUG_ENABLED)
|
||||
{
|
||||
//volatile float angle_rad = GetAngle();
|
||||
//printf("angle %.5f \n", angle_rad);
|
||||
}
|
||||
if(DEBUG_ENABLED)
|
||||
{
|
||||
volatile uint32_t tick = DL_SYSTICK_getValue();
|
||||
//printf("systick is %x \n",tick);
|
||||
}
|
||||
//开环
|
||||
//velocityopenloop(Target);
|
||||
//闭环
|
||||
Set_Angle(Target);
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user