correct SYSTICK and RELOAD_CYCLES
This commit is contained in:
12
empty.c
12
empty.c
@@ -56,8 +56,8 @@ int M1_PP = 7, M1_DIR = 1;
|
||||
int Motor0 = 0;
|
||||
int Motor1 = 1;
|
||||
|
||||
float M0_Target = 10.0; // 串口目标值
|
||||
float M1_Target = 20.0; // 串口目标值
|
||||
float M0_Target = 50.0; // 串口目标值
|
||||
float M1_Target = 50.0; // 串口目标值
|
||||
|
||||
#define UART_PACKET_SIZE (6)
|
||||
|
||||
@@ -119,10 +119,12 @@ int main(void) {
|
||||
|
||||
while (1) {
|
||||
M0_Set_Velocity(M0_Target); // 速度模式
|
||||
Print_Velocity(0);
|
||||
|
||||
if (gCheckUART) {
|
||||
gCheckUART = false;
|
||||
parse_uart_cmd();
|
||||
M0_Target = Target;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -131,10 +133,8 @@ void TIMER_0_INST_IRQHandler(void) {
|
||||
switch (DL_TimerA_getPendingInterrupt(TIMER_0_INST)) {
|
||||
case DL_TIMERG_INTERRUPT_ZERO_EVENT:
|
||||
|
||||
printf("Target is %f \n", Target);
|
||||
M0_Target = Target;
|
||||
// printf("%s",gUartRxPacket);
|
||||
Print_Velocity(0);
|
||||
// printf("Target is %f \n", Target);
|
||||
// printf("%s",gUartRxPacket);
|
||||
DL_GPIO_togglePins(LED_PORT, LED_PA0_PIN);
|
||||
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user