Up | Python Module - Adam | Advantech API | Advantech Bionic API | OPC | Python Module - Scl

 

  

 
Python Module - Scl

Interface to Allied Motion Products 1240i stepmotor controller

The Scl module requires the following modules to be installed in addition to Scorpion:

  • Python 2.2 or higher
  • Python Windows Extensions
  • PySerial

All the module are located on the Scorpion CD.

Example scripts:

# init stepper motor
from scl import *
try:
  step = Scl()
  print 'Step address : ',step
  InitStepperMotor()
except:
  SetValue('CommunicationError.Value',1)

#a set of useful stepper motor functions
def StepForward():
  step.DI(-5000)
  step.FL()

def StepBack():
  step.DI(5000)
  step.FL()

def InitStepperMotor():
  comOk = StepMotorComOk()
  if comOk:
    # setting default values
    step.PC(1.2)
    print 'Power On Current',step.PC()[1], 'A'
    step.JS(3)
    print 'Jog Speed',step.JS()[1], ' rev/sec'
    step.AC(1500)
    step.DE(1500)
    print 'Acc/Decel Rate',step.AC()[1],'/',step.DE()[1],' rev/sec/sec'
  else:
    print ' Step Motor Communication Error '

def StepMotorComOk():
   revision = step.RV()
   comOk = revision[0] == 1
   if comOk:
     SetValue('CommunicationError.Value',0)
   else :
     SetValue('CommunicationError.Value',1)
     print ' com ok ',comOk
     return comOk

 

Scorpion Vision Version XII : Build 646 - Date: 20170225
Scorpion Vision Software® is a registered trademark of Tordivel AS.
Copyright © 2000 - 2017 Tordivel AS.