add config.h ; try to OpenLoop control, not passed
This commit is contained in:
44
empty.c
44
empty.c
@@ -31,18 +31,23 @@
|
||||
*/
|
||||
|
||||
#include "ti_msp_dl_config.h"
|
||||
#include "Delay.h"
|
||||
#include "MT6701.h"
|
||||
|
||||
#include "delay.h"
|
||||
#include "mt6701.h"
|
||||
#include "dfoc.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <pwm.h>
|
||||
#include "config.h"
|
||||
|
||||
|
||||
extern float angle_f;
|
||||
|
||||
extern bool gIsI2cError;
|
||||
|
||||
const float num_f = 0.123456f;
|
||||
|
||||
volatile uint16_t count = 0 ;
|
||||
const float Target = 10.0; //串口目标值
|
||||
|
||||
|
||||
int pp = 7; //电机极对数
|
||||
@@ -53,20 +58,25 @@ int main(void)
|
||||
SYSCFG_DL_init();
|
||||
NVIC_EnableIRQ(UART_0_INST_INT_IRQN);
|
||||
DL_TimerA_startCounter(PWM_0_INST);
|
||||
while (1) {
|
||||
DL_GPIO_togglePins(LED_PORT,LED_PA0_PIN);
|
||||
//MT6701_get_angle_degree();
|
||||
delay_ms(50);
|
||||
volatile float angle_rad = GetAngle();
|
||||
//printf("test \n");
|
||||
printf("angle %.5f \n" , angle_rad);
|
||||
volatile uint32_t tick = DL_SYSTICK_getValue();
|
||||
printf("systick is %x \n",tick);
|
||||
|
||||
PWM_Channel1(count ++);
|
||||
if(count == 750)
|
||||
count = 0;
|
||||
|
||||
FOC_Init(12);
|
||||
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);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user