资源简介
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个文件信息
相关资源
- DGUS 迪文串口屏开发工具
- STM32F1开发指南(精英版)-寄存器版本
- STM32F401 驱动LPS25HB气压传感器 HTS2
-
ST-li
nk V2.1,带串口,可自动更新固 - STM32F407驱动2.4寸的SPI接口LCD程序.zip
- STM32F070使用内部晶振与PC间实现USB双向
- STM32F407 例程.zip
- 基于STM32F4+SSD1963+XPT2046方案的LCD显示
- 步进电动机及其驱动控制
- STM32F1 GPS模块NEO-7M
- STM32-US-100超声波程序
- STM32与ZigBee串口通信LCD显示程序
- STM32F4小四轴代码
- 基于stm32F407的i2c双机通讯
- stm32F407 SPI1/SPI2 DMA 方式读写 CH376S
- STM32F407 W8782模块驱动代码
- STM32F427 ,429中文参考手册
- 使用vs1063在STM32F103平台上实现WAV录音
- stm32f107 lan8720
- STM32F10x_StdPeriph_Lib_V3.5.0 STM32F10x固件库
- OV7670摄像头多块颜色识别追踪并串口
- STM32F103 uCOS-II移植源码
- 基于stm32f103 usb 的Win7系统触摸屏程序
- 基于IAR的STM32F407程序模板
- VC串口通信modbus协议源代码教程
- STM32F4+USB bulk FS
- STM32F10X+ENC28J60 TCP以太网连接
- QT5.9 serialport串口通信模块,编写一个
- 2019年电赛h题电磁曲线炮,stm32f407控制
-
《玩转.NET Micro fr
amework 移植-基于
评论
共有 条评论