add config.h ; try to OpenLoop control, not passed

This commit is contained in:
2025-11-13 15:16:24 +08:00
parent c67d13de54
commit ab6d7c0dd9
9 changed files with 133 additions and 35 deletions

44
empty.c
View File

@@ -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);
}
}