Skip to main content

Kollmorgen Support Network

To better serve our Kollmorgen users with questions too complex to be addressed in this space, we made the painful decision to close this Community forum.

Please submit your question using the contact us form to reach our application engineering team.

For the immediate future, you can still access and read past posts.

Thank you for understanding and for participating in the community over the years.

AKD Basic Analogue Velocity Control | 07 Dec 2016 | |

AKD Basic Analogue Velocity Control

Does anyone have a sample program or a snipet of code for the AKD Basic to control the velocity with the analogue input?  Thanks for the help.

Comments & Answers

Joerg Muslewski | Wed, 12/07/2016 - 16:09
Below two snippets out of a program with a state machine:
I didn't copy the whole declarations and all the other stuff because it would be to complex.
The AKD BASIC operate in position mode and the move function is used.
I compared the current analog input value with a buffered old one.
If the value is bigger than a constant (dead zone, in order to avoid oscillating) I calculate a new velocity value and determine the direction in a subroutine.
Afterwards the move parameters will be updated with new velocity value and direction.
Of course the other move parameters needs to be initialized or updated each time as well.

   Case 30 'velocity mode
     If (DIN1.STATE = 0) Then                                                                      'disable velocity mode

      State = 39
                                                                                                                     'new velocity value
     Elseif (ABS(AIN.VALUE-AINValueOld) > c_AINSTEP) Then
      Call VelocityParameter

      MOVE.DIR = AINDir
     End If
Sub VelocityParameter
 If (ABS(AIN.VALUE) > c_AINSTEP) Then                                                 'calculate speed depending on analog input value
 Else                                                                                                             'Deadzone
  AINSpeed = 0.0
 End If
 If (AINSpeed < 0) Then                                                                               'check for direction
  AINDir = 1
  AINDir = 0
 end if
End Sub

PinCheng | Wed, 12/14/2016 - 00:32
you can have an example code written by JoeParks in this page

I have take it run successfully in the pdmm, you can try it

About this Question