久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费
標題:
STM32F103xx微控制器驅動步進電機源碼
[打印本頁]
作者:
上帝不吭聲
時間:
2018-5-8 10:56
標題:
STM32F103xx微控制器驅動步進電機源碼
官方庫文件--使用中容量STM32F103xx微控制器驅動步進電機
0.jpg
(25.08 KB, 下載次數: 44)
下載附件
2018-5-8 17:12 上傳
單片機源程序如下:
/**
******************************************************************************
* @file FullHalfStepMode/src/main.c
* @author MCD Application Team
* @version V2.0.0
* @date 04/27/2009
* @brief Main program body
******************************************************************************
* @copy
*
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*
* <h2><center>© COPYRIGHT 2009 STMicroelectronics</center></h2>
*/
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"
#include "StepperMotor.h"
#include <stdio.h>
/** @addtogroup FullHalfStepMode
* @{
*/
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* -------------------- Stepper modes entering function ---------------- */
/******* Define the Rotation Direction *******/
#define RotationDirection_CW
//#define RotationDirection_CCW
/******* Define the Step Mode *********/
#define Half_Step
//#define Full_Step
/******* Define the Decay Mode ********/
//#define ControlSlow_Current
#define ControlFast_Current
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
ErrorStatus HSEStartUpStatus;
/* Private function prototypes -----------------------------------------------*/
void RCC_Configuration(void);
void NVIC_Configuration(void);
/* Private functions ---------------------------------------------------------*/
/**
* @brief Main program
* @param None
* @retval : None
*/
int main(void)
{
/* System Clocks Configuration */
RCC_Configuration();
/* NVIC Configuration */
NVIC_Configuration();
/* Activate the driver */
Stepper_Cmd(ENABLE);
/* Driver control pin configuration */
Stepper_PinControlConfig();
/* Disable the initialization of the driver */
Stepper_ResetDisable();
/* -----------Modes selection: Rotation direction, Step mode, Decay mode---------------*/
#ifdef RotationDirection_CW
Stepper_SetRotationDirection(Stepper_RotationDirection_CW);
#endif /* RotationDirection_CW */
#ifdef RotationDirection_CCW
Stepper_SetRotationDirection(Stepper_RotationDirection_CCW);
#endif /* RotationDirection_CCW */
#ifdef Half_Step
Stepper_SelectMode(Stepper_Half);
#endif /* Half_Step */
#ifdef Full_Step
Stepper_SelectMode(Stepper_Full);
#endif /* Full_Step */
#ifdef ControlSlow_Current
Stepper_SetControlMode(Stepper_ControlSlow);
#endif /* ControlSlow_Current */
#ifdef ControlFast_Current
Stepper_SetControlMode(Stepper_ControlFast);
#endif /* ControlFast_Current */
/* Start the stepper motor */
Stepper_Start(ENABLE);
/* Peripherals configuration */
Stepper_Init();
while (1)
{
}
}
/**
* @brief Configures the different system clocks.
* @param None
* @retval : None
*/
void RCC_Configuration(void)
{
/* RCC system reset(for debug purpose) */
RCC_DeInit();
/* Enable HSE */
RCC_HSEConfig(RCC_HSE_ON);
/* Wait till HSE is ready */
HSEStartUpStatus = RCC_WaitForHSEStartUp();
if(HSEStartUpStatus == SUCCESS)
{
/* Enable Prefetch Buffer */
FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
/* Flash 2 wait state */
FLASH_SetLatency(FLASH_Latency_2);
/* HCLK = SYSCLK */
RCC_HCLKConfig(RCC_SYSCLK_Div1);
/* PCLK2 = HCLK */
RCC_PCLK2Config(RCC_HCLK_Div1);
/* PCLK1 = HCLK/2 */
RCC_PCLK1Config(RCC_HCLK_Div2);
/* PLLCLK = 8MHz * 9 = 72 MHz */
RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);
/* Enable PLL */
RCC_PLLCmd(ENABLE);
/* Wait till PLL is ready */
while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET)
{
}
/* Select PLL as system clock source */
RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
/* Wait till PLL is used as system clock source */
while(RCC_GetSYSCLKSource() != 0x08)
{
}
}
}
/**
* @brief Configure the nested vectored interrupt controller.
* @param None
* @retval : None
*/
void NVIC_Configuration(void)
{
NVIC_SetPriorityGrouping(7); /* 0 bits for pre-emption priority 4 bits for
subpriority*/
NVIC_SetPriority(DMA1_Channel2_IRQn, 0x01); /* 0x01 = 0x0 << 3 | (0x1 & 0x7), prority
is 0x01 << 4 */
NVIC_EnableIRQ(DMA1_Channel2_IRQn);
}
#ifdef USE_FULL_ASSERT
……………………
…………限于本文篇幅 余下代碼請從51黑下載附件…………
復制代碼
所有資料51hei提供下載:
官方庫文件--使用中容量STM32F103xx微控制器驅動步進電機.zip
(1.21 MB, 下載次數: 66)
2018-5-8 10:56 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
作者:
wangdunyuan1
時間:
2018-12-3 14:41
收藏
作者:
byoo
時間:
2018-12-3 21:02
好,不錯收藏了!
歡迎光臨 (http://www.zg4o1577.cn/bbs/)
Powered by Discuz! X3.1
主站蜘蛛池模板:
91免费版在线观看
|
日韩一区在线播放
|
精品欧美乱码久久久久久
|
国产精品毛片av一区
|
国产精品日韩一区二区
|
国产精品毛片一区二区三区
|
欧美精品一区二区三区蜜桃视频
|
国产精品久久久久久久久久久久
|
亚洲精品自在在线观看
|
欧美中文
|
99在线播放
|
久久国产精品免费
|
久久成人国产精品
|
性色av一区二区三区
|
五月天天丁香婷婷在线中
|
色综合天天天天做夜夜夜夜做
|
国产成人一区二区三区电影
|
91视视频在线观看入口直接观看
|
欧美一区二区在线观看
|
999精品视频
|
国产精品成人国产乱
|
日本超碰在线
|
午夜视频网站
|
国产一区二区三区在线
|
日本欧美黄色片
|
www.中文字幕.com
|
射欧美
|
国产成人在线视频播放
|
亚洲 欧美 激情 另类 校园
|
日韩精品成人av
|
日韩欧美亚洲
|
黑人巨大精品欧美一区二区一视频
|
国产91在线 | 欧美
|
国产一区欧美
|
国产午夜精品久久久久免费视高清
|
黄色av网站在线观看
|
亚洲成人自拍
|
综合色导航
|
一区二区三区免费
|
91看片在线观看
|
国产精品成人久久久久a级 久久蜜桃av一区二区天堂
|