STM32F413ZH 7路串口收发 +IIC +freertos+步进电机驱动


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次
“task1_num);






    if(USART_RX_STA[1]&0x8000)
{    
len=USART_RX_STA[1]&0x3fff;
printf(“uart 1 :
“);
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 :
“);
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 :
“);
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 :
“);
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 :
“);
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 
“);
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 :
“);
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(“
任务2已经执行:%d次
“task2_num);
  //printf(“AD_value =  %.3f

“vol);
    vTaskDelay(1000);                           
}
}

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

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

     文件       3938  2019-03-26 17:44  stm32f4xx_freertos_project--0325Appuser_task.c

     文件        745  2019-03-01 15:22  stm32f4xx_freertos_project--0325Appuser_task.h

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

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

     文件      19342  2012-12-14 11:16  stm32f4xx_freertos_project--0325DMPeMPLdmpKey.h

     文件       6765  2012-12-14 11:16  stm32f4xx_freertos_project--0325DMPeMPLdmpmap.h

     文件      89370  2014-10-05 11:44  stm32f4xx_freertos_project--0325DMPeMPLinv_mpu.c

     文件       4883  2019-03-11 09:02  stm32f4xx_freertos_project--0325DMPeMPLinv_mpu.h

     文件      58387  2019-03-11 10:14  stm32f4xx_freertos_project--0325DMPeMPLinv_mpu_dmp_motion_driver.c

     文件       3538  2014-10-05 11:44  stm32f4xx_freertos_project--0325DMPeMPLinv_mpu_dmp_motion_driver.h

     文件       5298  2019-03-11 10:14  stm32f4xx_freertos_project--0325DMPmpu6050.c

     文件       4513  2019-03-11 09:48  stm32f4xx_freertos_project--0325DMPmpu6050.h

     文件     719923  2019-02-22 09:11  stm32f4xx_freertos_project--0325DriversCMSISDeviceSTSTM32F4xxIncludestm32f401xc.h

     文件     719923  2019-02-22 09:11  stm32f4xx_freertos_project--0325DriversCMSISDeviceSTSTM32F4xxIncludestm32f401xe.h

     文件    1228777  2019-02-22 09:11  stm32f4xx_freertos_project--0325DriversCMSISDeviceSTSTM32F4xxIncludestm32f405xx.h

     文件    1344524  2019-02-22 09:11  stm32f4xx_freertos_project--0325DriversCMSISDeviceSTSTM32F4xxIncludestm32f407xx.h

     文件     606160  2019-02-22 09:11  stm32f4xx_freertos_project--0325DriversCMSISDeviceSTSTM32F4xxIncludestm32f410cx.h

     文件     606469  2019-02-22 09:11  stm32f4xx_freertos_project--0325DriversCMSISDeviceSTSTM32F4xxIncludestm32f410rx.h

     文件     601407  2019-02-22 09:11  stm32f4xx_freertos_project--0325DriversCMSISDeviceSTSTM32F4xxIncludestm32f410tx.h

     文件     723418  2019-02-22 09:11  stm32f4xx_freertos_project--0325DriversCMSISDeviceSTSTM32F4xxIncludestm32f411xe.h

     文件    1167059  2019-02-22 09:11  stm32f4xx_freertos_project--0325DriversCMSISDeviceSTSTM32F4xxIncludestm32f412cx.h

     文件    1253447  2019-02-22 09:11  stm32f4xx_freertos_project--0325DriversCMSISDeviceSTSTM32F4xxIncludestm32f412rx.h

     文件    1253447  2019-02-22 09:11  stm32f4xx_freertos_project--0325DriversCMSISDeviceSTSTM32F4xxIncludestm32f412vx.h

     文件    1253519  2019-02-22 09:11  stm32f4xx_freertos_project--0325DriversCMSISDeviceSTSTM32F4xxIncludestm32f412zx.h

     文件    1307927  2019-02-22 09:11  stm32f4xx_freertos_project--0325DriversCMSISDeviceSTSTM32F4xxIncludestm32f413xx.h

     文件    1252263  2019-02-22 09:11  stm32f4xx_freertos_project--0325DriversCMSISDeviceSTSTM32F4xxIncludestm32f415xx.h

     文件    1367610  2019-02-22 09:11  stm32f4xx_freertos_project--0325DriversCMSISDeviceSTSTM32F4xxIncludestm32f417xx.h

     文件    1319090  2019-02-22 09:11  stm32f4xx_freertos_project--0325DriversCMSISDeviceSTSTM32F4xxIncludestm32f423xx.h

     文件    1446739  2019-02-22 09:11  stm32f4xx_freertos_project--0325DriversCMSISDeviceSTSTM32F4xxIncludestm32f427xx.h

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

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)