This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] TM4C123GH6PM:测试电机并通过电机获得返回输出、但是...

Guru**** 2482105 points
Other Parts Discussed in Thread: TM4C123GH6PM

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1556374/tm4c123gh6pm-testing-motors-and-getting-return-output-via-motors-but

器件型号:TM4C123GH6PM


工具/软件:

您好!

又来了一次。 我一直在努力让电机在 Tiva 系列 T4C23GXL 上使用、其中 TM4C123GH6PM 位于电机 (M4F) 上。

与我上一篇文章不同、我通过几本专门介绍该 Tiva 系列 Launchpad 的书进行了一些学习、 我构建它、下载它、看它是否正常工作。 有一件事对我来说不太好、那就是电机转速的实际值。  

对于此源代码、16MHz 的计时方案似乎太慢了。 我有大约八个文件,似乎他们都想工作,并得到注意在最终的二进制文件,但我似乎还不理解 RPM 和时间之间的差异.

Seth

P.S.以下是库中不含其他附加器件的测试源:

// StepperTestMain.c
// Runs on LM4F120/TM4C123
// Test the functions provided by Stepper.c,
// 
// Before connecting a real stepper motor, remember to put the
// proper amount of delay between each CW() or CCW() step.
// Daniel Valvano
// September 12, 2013

/* This example accompanies the book
   "Embedded Systems: Real Time Interfacing to Arm Cortex M Microcontrollers",
   ISBN: 978-1463590154, Jonathan Valvano, copyright (c) 2015
   Example 4.1, Programs 4.4, 4.5, and 4.6
   Hardware circuit diagram Figure 4.27

 Copyright 2015 by Jonathan W. Valvano, valvano@mail.utexas.edu
    You may use, edit, run or distribute this file
    as long as the above copyright notice remains
 THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
 OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
 VALVANO SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL,
 OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
 For more information about my classes, my research, and my books, see
 users.ece.utexas.edu/.../
 */

// PD3 connected to driver for stepper motor coil A
// PD2 connected to driver for stepper motor coil A'
// PD1 connected to driver for stepper motor coil B
// PD0 connected to driver for stepper motor coil B'
#include <stdint.h>
#include "stepper.h"
#define T1ms 16000    // assumes using 16 MHz PIOSC (default setting for clock source)
int main(void){
  Stepper_Init();
  Stepper_CW(T1ms);   // Pos=1; GPIO_PORTD_DATA_R=9
  Stepper_CW(T1ms);   // Pos=2; GPIO_PORTD_DATA_R=5
  Stepper_CW(T1ms);   // Pos=3; GPIO_PORTD_DATA_R=6
  Stepper_CW(T1ms);   // Pos=4; GPIO_PORTD_DATA_R=10
  Stepper_CW(T1ms);   // Pos=5; GPIO_PORTD_DATA_R=9
  Stepper_CW(T1ms);   // Pos=6; GPIO_PORTD_DATA_R=5
  Stepper_CW(T1ms);   // Pos=7; GPIO_PORTD_DATA_R=6
  Stepper_CW(T1ms);   // Pos=8; GPIO_PORTD_DATA_R=10
  Stepper_CW(T1ms);   // Pos=9; GPIO_PORTD_DATA_R=9
  Stepper_CCW(T1ms);  // Pos=8; GPIO_PORTD_DATA_R=10
  Stepper_CCW(T1ms);  // Pos=7; GPIO_PORTD_DATA_R=6
  Stepper_CCW(T1ms);  // Pos=6; GPIO_PORTD_DATA_R=5
  Stepper_CCW(T1ms);  // Pos=5; GPIO_PORTD_DATA_R=9
  Stepper_CCW(T1ms);  // Pos=4; GPIO_PORTD_DATA_R=10
  Stepper_Seek(8,T1ms);// Pos=8; GPIO_PORTD_DATA_R=10
  Stepper_Seek(0,T1ms);// Pos=0; GPIO_PORTD_DATA_R=10
  while(1){
    Stepper_CW(4*T1ms);   // output every 10ms
  }
}

我认为当我调用带有一个函数的 while 循环时,源代码的后一部分可能是这里的独裁者。 我根据我的读数和看到的内容来更改值、并获得输出以证明我正在读取/看到的内容是正确的、但我无法使电机更快地移动。 除了“双 GPIO“驱动器和“光耦“(驱动器电源为 5V)之外、是否应该在此 M4F 中使用其他器件来实现速度和精度?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、

     我不知道您的代码片段正在做什么。 什么是 STEPPER_CW、STEPPER_CCW 和 Stepper_Seek? 它们的作用是什么? 似乎每 1ms 进行时钟和逆时针旋转一次电机。 对于每次对 Stepper _CW (T1ms) 的调用、您会有不同的注释 、例如 GPIO_PORTD_DATA_R=9 、GPIO_PORTD_DATA_R=5、GPIO_PORTD_DATA_R=6。  如何通过调用相同的函数在不同引脚上操作、而不指定哪个引脚作为函数的参数。  

     在任何情况下、您都要运行 UT 课程中的一些代码、而无需使用 TivaWare SDK。 这不是我能支持的、抱歉。