TMC7300示例脚本

Trinamic最近推出了一系列新的电池供电的电机驱动芯片,其中包括TMC7300,TMC7300能够驱动1个高达2A的直流电动机或2个高达2.4A(峰值)的直流电动机。在本文中,将向您展示一个小的示例脚本,使用TMC7300-EVAL-KIT驱动直流电动机。
首先,通过使用Eselsbrücke连接器板将TMC7300-EVAL板与Landungsbrücke接口板连接来组装评估套件。其次,将电机连接到评估板上。最后,插入USB-C电缆连接电脑,以使用TMCL-IDE直接访问计算机。
设置完成后,可以调整TMC7300直流驱动器IC,并立即在图形用户界面中实时查看电动机运行状态。

使用TMCL-IDE,创建了一个简短的示例脚本,该脚本可移动直流电动机,如图所示。电动机PWM的占空比从0%变为30%,再到50%,然后又回到零。之后,它在负方向上显示相同的值。
以下是使用的脚本:
#module 1 COM16/USB/id1/Landungsbruecke [Landungsbruecke]
CALC ADD, 1 // Add 1 to accu
STOA 0, 0 // Store local variable to accumulator
SAP 7, 0, 0, 1 // Deactivate Standby of TMC7300
Loop:
SAP 0, 0, 30, 1 // Set duty cycle for Motor 1 to 30%
WAIT TICKS, 0, 1000 // Wait 1 second
SAP 0, 0, 50, 1 // Set duty cycle for Motor 1 to 50%
WAIT TICKS, 0, 1000 // Wait 1 second
SAP 0, 0, 30, 1 // Set duty cycle for Motor 1 to 30%
WAIT TICKS, 0, 1000 // Wait 1 second
SAP 0, 0, 0, 1 // Set duty cycle for Motor 1 to 0%
WAIT TICKS, 0, 1000 // Wait 1 second
SAP 0, 0, -30, 1 // Set duty cycle for Motor 1 to -30%
WAIT TICKS, 0, 1000 // Wait 1 second
SAP 0, 0, -50, 1 // Set duty cycle for Motor 1 to -50%
WAIT TICKS, 0, 1000 // Wait 1 second
SAP 0, 0, -30, 1 // Set duty cycle for Motor 1 to -30%
WAIT TICKS, 0, 1000 // Wait 1 second
SAP 0, 0, 0, 1 // Set duty cycle for Motor 1 to 0%
WAIT TICKS, 0, 1000 // Wait 1 second
CALC ADD, 1 // Add 1 to accu
STOA 0, 0 // Store value to accumulator
COMP 100 // <----- Amount of loops set here
JC LE, Loop // Jump to label Loop
SAP 7, 0, 1, 1 // Activate Standby of TMC7300
STOP
评论前必须登录!
注册