Back to top

Using Torque Mode in an AKD Basic Program

When using torque mode in an AKD Basic program, you must set DRV.CMDSOURCE=0 (Service) in the program.

If the program executes an IL.CMDU command while DRV.CMDSOURCE=5, it will throw an F825 Runtime error.  The runtime error message says that DRV.CMDSOURCE must be set to 5.  This is normal for position control, but for torque control it must be set to zero.  The Basic program will continue to run even after the command source changes to Service mode.

If the program uses both position mode and torque mode, remember to change the command source and operation mode together each time the control is changed.

This was tested in firmware 1-16-00-002 and 1-17-00-000.

Here is a simple program using torque mode:

Main
DRV.SWENABLE=1

While 1=1
If DIN1.STATE=0 Then
    DRV.OPMODE = 2
    DRV.CMDSOURCE = 5
Else
    DRV.OPMODE = 0
    DRV.CMDSOURCE = 0
End If

If DRV.OPMODE = 0 AND DIN2.STATE=1 Then
    IL.CMDU = 0.2
End If
If DRV.OPMODE = 0 AND DIN2.STATE=0 Then
    IL.CMDU = 0
End If

Wend
End Main