La position actuelle:Accueil du site>【 stm32 learning】 (21) stm32 Implementing Stepper Motor

【 stm32 learning】 (21) stm32 Implementing Stepper Motor

2022-07-23 01:29:56Les petits matériaux sont très utiles

Carte physique:

 

Schéma de réalisation:En fait, en regardant le schéma, on peut faire tourner le moteur pas à pas..

 

Moteur stepper à quatre phases et à cinq fils .

4La ligne est:A B C D

Le moteur stepper est divisé en 4Shot and8Filme.

4Filme.: Il est divisé en quatre temps simples et deux temps

Un seul quatre:A-B-C-D-A-

Double quadruple:AB-BC-CD-DA-AB-

8Filme.:

A-AB-B-BC-C-CD-D-DA-A-

Pour faire marche arrière du moteur , Il suffit d'inverser l'ordre .

Les principaux codes sont::

int main(void)
{
  /* USER CODE BEGIN 1 */
  /* USER CODE END 1 */

  /* MCU Configuration--------------------------------------------------------*/

  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();

  /* USER CODE BEGIN Init */

  /* USER CODE END Init */

  /* Configure the system clock */
  SystemClock_Config();

  /* USER CODE BEGIN SysInit */

  /* USER CODE END SysInit */

  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  /* USER CODE BEGIN 2 */

  /* USER CODE END 2 */

  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
    /* USER CODE END WHILE */

    /* USER CODE BEGIN 3 */
		/* En avant.  8Filme. */
//	  _74HC595_Send595OneByte(0X8F);
//	  _74HC595_OUT();
//	  HAL_Delay(1);
//	  _74HC595_Send595OneByte(0XCF);
//	  _74HC595_OUT();
//	  HAL_Delay(1);
//	  _74HC595_Send595OneByte(0X4F);
//	  _74HC595_OUT();
//	  HAL_Delay(1);
//	  _74HC595_Send595OneByte(0X6F);
//	  _74HC595_OUT();
//	  HAL_Delay(1);
//	  _74HC595_Send595OneByte(0X2F);
//	  _74HC595_OUT();
//	  HAL_Delay(1);
//	  _74HC595_Send595OneByte(0X3F);
//	  _74HC595_OUT();
//	  HAL_Delay(1);
//	  _74HC595_Send595OneByte(0X1F);
//	  _74HC595_OUT();
//	  HAL_Delay(1);
//	  _74HC595_Send595OneByte(0X9F);
//	  _74HC595_OUT();
//	  HAL_Delay(1);

		/* Inversion 8Filme. */
	  _74HC595_Send595OneByte(0X1F);
	  _74HC595_OUT();
	  HAL_Delay(1);
	  _74HC595_Send595OneByte(0X3F);
	  _74HC595_OUT();
	  HAL_Delay(1);
	  _74HC595_Send595OneByte(0X2F);
	  _74HC595_OUT();
	  HAL_Delay(1);
	  _74HC595_Send595OneByte(0X6F);
	  _74HC595_OUT();
	  HAL_Delay(1);
	  _74HC595_Send595OneByte(0X4F);
	  _74HC595_OUT();
	  HAL_Delay(1);
	  _74HC595_Send595OneByte(0XCF);
	  _74HC595_OUT();
	  HAL_Delay(1);
	  _74HC595_Send595OneByte(0X8F);
	  _74HC595_OUT();
	  HAL_Delay(1);
	  _74HC595_Send595OneByte(0X9F);
	  _74HC595_OUT();
	  HAL_Delay(1);


		/* En avant. 4Filme. Un seul quatre */
//	  _74HC595_Send595OneByte(0X8F);
//	  _74HC595_OUT();
//	  HAL_Delay(1);
//	  _74HC595_Send595OneByte(0X4F);
//	  _74HC595_OUT();
//	  HAL_Delay(1);
//	  _74HC595_Send595OneByte(0X2F);
//	  _74HC595_OUT();
//	  HAL_Delay(1);
//	  _74HC595_Send595OneByte(0X1F);
//	  _74HC595_OUT();
//	  HAL_Delay(1);
  
		/* En avant. 4Filme. Double quadruple */
//	  _74HC595_Send595OneByte(0XCF);
//	  _74HC595_OUT();
//	  HAL_Delay(1);
//	  _74HC595_Send595OneByte(0X6F);
//	  _74HC595_OUT();
//	  HAL_Delay(1);
//	  _74HC595_Send595OneByte(0X3F);
//	  _74HC595_OUT();
//	  HAL_Delay(1);
//	  _74HC595_Send595OneByte(0X9F);
//	  _74HC595_OUT();
//	  HAL_Delay(1);
	  
	  /* Inversion 4Filme. Un seul quatre */
//	  _74HC595_Send595OneByte(0X8F);
//	  _74HC595_OUT();
//	  HAL_Delay(1);
//	  _74HC595_Send595OneByte(0X4F);
//	  _74HC595_OUT();
//	  HAL_Delay(1);
//	  _74HC595_Send595OneByte(0X2F);
//	  _74HC595_OUT();
//	  HAL_Delay(1);
//	  _74HC595_Send595OneByte(0X1F);
//	  _74HC595_OUT();
//	  HAL_Delay(1);

	  
	  
	  
  }
  /* USER CODE END 3 */
}

Les effets sont les suivants:

Le lien de code est:

 


 

Mentions de copyright
Auteur de cet article [Les petits matériaux sont très utiles],Réimpression s’il vous plaît apporter le lien vers l’original, merci
https://fra.chowdera.com/2022/204/202207221455246287.html

Recommandé au hasard