资源简介

STM32F413ZH 7路串口收发 +IIC +freertos+步进电机驱动,实现急加速急减速功能,不懂可以咨询

资源截图

代码片段和文件信息

#include “user_task.h“
#include “sys.h“
#include “cmsis_os.h“
#include “stm32f4xx_hal.h“
#include “usart.h“
#include “adc.h“
#include “key.h“
#include “exti.h“

osThreadId initTask_Handler;
osThreadId Task1Task_Handler;
osThreadId Task2Task_Handler;
osThreadId Task3Task_Handler;
osThreadId Task4Task_Handler;
TimerHandle_t OneShotTimer_Handle; //单次定时器句柄
TaskHandle_t TimerControlTask_Handler;

extern u8  TIM5CH1_CAPTURE_STA; //输入捕获状态     
extern u32 TIM5CH1_CAPTURE_VAL;
//uart debug info
void task1_task(void *pvParameters)
{
u16 task1_num=0;
  u16 temp;
u8 len;
while(1)
{
task1_num++;

//printf(“任务1已经执行:%d次\r\n“task1_num);






    if(USART_RX_STA[1]&0x8000)
{    
len=USART_RX_STA[1]&0x3fff;
printf(“uart 1 :\r\n“);
HAL_UART_Transmit(&huart1(uint8_t*)USART1_RX_BUFlen1000);
while(__HAL_UART_GET_FLAG(&huart1UART_FLAG_TC)!=SET);
USART_RX_STA[1]=0;
}
else if(USART_RX_STA[2]&0x8000)
{    
len=USART_RX_STA[2]&0x3fff;
printf(“uart 2 :\r\n“);
HAL_UART_Transmit(&huart1(uint8_t*)USART2_RX_BUFlen1000);
while(__HAL_UART_GET_FLAG(&huart1UART_FLAG_TC)!=SET);
USART_RX_STA[2]=0;
}
else if(USART_RX_STA[3]&0x8000)
{    
len=USART_RX_STA[3]&0x3fff;
printf(“uart 3 :\r\n“);
HAL_UART_Transmit(&huart1(uint8_t*)USART3_RX_BUFlen1000);
while(__HAL_UART_GET_FLAG(&huart1UART_FLAG_TC)!=SET);
USART_RX_STA[3]=0;
}
else if(USART_RX_STA[4]&0x8000)
{    
len=USART_RX_STA[4]&0x3fff;
printf(“uart 4 :\r\n“);
HAL_UART_Transmit(&huart1(uint8_t*)USART4_RX_BUFlen1000);
while(__HAL_UART_GET_FLAG(&huart1UART_FLAG_TC)!=SET);
USART_RX_STA[4]=0;
}
else if(USART_RX_STA[5]&0x8000)
{    
len=USART_RX_STA[5]&0x3fff;
printf(“uart 5 :\r\n“);
HAL_UART_Transmit(&huart1(uint8_t*)USART5_RX_BUFlen1000);
while(__HAL_UART_GET_FLAG(&huart1UART_FLAG_TC)!=SET);
USART_RX_STA[5]=0;
}
else if(USART_RX_STA[6]&0x8000)
{    
len=USART_RX_STA[6]&0x3fff;
printf(“uart 6 \r\n“);
HAL_UART_Transmit(&huart1(uint8_t*)USART6_RX_BUFlen1000);
while(__HAL_UART_GET_FLAG(&huart1UART_FLAG_TC)!=SET);
USART_RX_STA[6]=0;
}
else if(USART_RX_STA[7]&0x8000)
{    
len=USART_RX_STA[7]&0x3fff;
printf(“uart 7 :\r\n“);
HAL_UART_Transmit(&huart1(uint8_t*)USART7_RX_BUFlen1000);
while(__HAL_UART_GET_FLAG(&huart1UART_FLAG_TC)!=SET);
USART_RX_STA[7]=0;
}
else
{
  ;  
}
vTaskDelay(1000);                           //延时1s,也就是1000个时钟节拍
}
}

//task2_adc
void task2_task(void *pvParameters)
{
u8  task2_num = 0;
u16 adcx = 0;
float vol;
while(1)
{
task2_num++;
    adcx=Get_Adc_Average(ADC_CHANNEL_520);
vol=(float)adcx*(3.3/4096);  
//printf(“\r\n任务2已经执行:%d次\r\n“task2_num);
  //printf(“AD_value =  %.3f\r\n\r\n“vol);
    vTaskDelay(1000);                           
}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       7486  2019-02-27 10:34  stm32f4xx_freertos_project--0325\.mxproject

     文件       3938  2019-03-26 17:44  stm32f4xx_freertos_project--0325\App\user_task.c

     文件        745  2019-03-01 15:22  stm32f4xx_freertos_project--0325\App\user_task.h

     文件        495  2019-03-01 17:23  stm32f4xx_freertos_project--0325\debug.ini

     文件       2915  2019-03-26 19:07  stm32f4xx_freertos_project--0325\debug_log.txt

     文件      19342  2012-12-14 11:16  stm32f4xx_freertos_project--0325\DMP\eMPL\dmpKey.h

     文件       6765  2012-12-14 11:16  stm32f4xx_freertos_project--0325\DMP\eMPL\dmpmap.h

     文件      89370  2014-10-05 11:44  stm32f4xx_freertos_project--0325\DMP\eMPL\inv_mpu.c

     文件       4883  2019-03-11 09:02  stm32f4xx_freertos_project--0325\DMP\eMPL\inv_mpu.h

     文件      58387  2019-03-11 10:14  stm32f4xx_freertos_project--0325\DMP\eMPL\inv_mpu_dmp_motion_driver.c

     文件       3538  2014-10-05 11:44  stm32f4xx_freertos_project--0325\DMP\eMPL\inv_mpu_dmp_motion_driver.h

     文件       5298  2019-03-11 10:14  stm32f4xx_freertos_project--0325\DMP\mpu6050.c

     文件       4513  2019-03-11 09:48  stm32f4xx_freertos_project--0325\DMP\mpu6050.h

     文件     719923  2019-02-22 09:11  stm32f4xx_freertos_project--0325\Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f401xc.h

     文件     719923  2019-02-22 09:11  stm32f4xx_freertos_project--0325\Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f401xe.h

     文件    1228777  2019-02-22 09:11  stm32f4xx_freertos_project--0325\Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f405xx.h

     文件    1344524  2019-02-22 09:11  stm32f4xx_freertos_project--0325\Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f407xx.h

     文件     606160  2019-02-22 09:11  stm32f4xx_freertos_project--0325\Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f410cx.h

     文件     606469  2019-02-22 09:11  stm32f4xx_freertos_project--0325\Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f410rx.h

     文件     601407  2019-02-22 09:11  stm32f4xx_freertos_project--0325\Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f410tx.h

     文件     723418  2019-02-22 09:11  stm32f4xx_freertos_project--0325\Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f411xe.h

     文件    1167059  2019-02-22 09:11  stm32f4xx_freertos_project--0325\Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f412cx.h

     文件    1253447  2019-02-22 09:11  stm32f4xx_freertos_project--0325\Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f412rx.h

     文件    1253447  2019-02-22 09:11  stm32f4xx_freertos_project--0325\Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f412vx.h

     文件    1253519  2019-02-22 09:11  stm32f4xx_freertos_project--0325\Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f412zx.h

     文件    1307927  2019-02-22 09:11  stm32f4xx_freertos_project--0325\Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f413xx.h

     文件    1252263  2019-02-22 09:11  stm32f4xx_freertos_project--0325\Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f415xx.h

     文件    1367610  2019-02-22 09:11  stm32f4xx_freertos_project--0325\Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f417xx.h

     文件    1319090  2019-02-22 09:11  stm32f4xx_freertos_project--0325\Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f423xx.h

     文件    1446739  2019-02-22 09:11  stm32f4xx_freertos_project--0325\Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f427xx.h

............此处省略980个文件信息

评论

共有 条评论