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
      MOVE.ABORT     

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

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

PinCheng | Wed, 12/14/2016 - 00:32
you can have an example code written by JoeParks in this page http://kdn.kollmorgen.com/content/how-i-use-function-block-fbscaleinput-load-analog-input

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

About this Question

JeremyHoward
Taxonomy: