DISCLAIMER:
This script is provided as a sample and has not been validated for any specific use.
It is the customer's responsibility to thoroughly test and evaluate the script before using it in any application. Roboteq does not assume any liability for errors or issues that may arise from its use. Use at your own risk.
OPERATION:
This script reads a digital input and sets a digital output if there is any Motor or Fault flag. The fault is cleared by reading another digital input. To clear the fault, the script sends an idle motor command, based on the operating mode used. The specific inputs and outputs that will be used are user-configurable
CONFIGURATION:
The script can be configured by modifying the defined parameters, NUMBER_OF_CHANNELS, DIGITAL_OUTPUT and DIGITAL_INPUT
'DISCLAIMER:
'This script is provided as a sample and has not been validated for any specific use.
'It is the customer's responsibility to thoroughly test and evaluate the script before using it in any application.
'Roboteq does not assume any liability for errors or issues that may arise from its use. Use at your own risk.
'OPERATION:
'This script reads a digital input and sets a digital output if there is any Motor or Fault flag.
'The fault is cleared by reading another digital input. To clear the fault, the script sends an idle motor command,
'Based on the operating mode used. The specific inputs and outputs that will be used are user-configurable
'CONFIGURATION:
'The script can be configured by modifying the defined parameters, NUMBER_OF_CHANNELS, DIGITAL_OUTPUT and DIGITAL_INPUT
option explicit
' ------ CHANGE THESE VALUES FOR PARAMETRIZATION ------
#define NUMBER_OF_MOTORS 2 '1 for single channel, 2 for dual channel operation
#define DIGITAL_OUTPUT 1 'The output used as a fault indicator
#define DIGITAL_INPUT 1 'The input used to reset the fault
' ------ BASIC SCRIPT. DO NOT MODIFY ------
dim fault as boolean
dim operatingMode as integer
dim i as integer
fault = false
while(1) ' main loop
' Check fault
for i = 0 andwhile i < NUMBER_OF_MOTORS
if (getvalue(_FM,i+1)) 'Check motor flags
fault = true
end if
next
if getvalue(_FF,1) 'Check faultflags
fault = true
end if
'Output Update
if fault
setcommand(_D1,DIGITAL_OUTPUT) 'set digital output
setcommand(_EX,1)'enable emergency stop
else
setcommand(_D0,DIGITAL_OUTPUT) 'reset digital output
end if
'Reset fault
if fault and getvalue(_DI,DIGITAL_INPUT)
wait(3000) 'wait 3 seconds for the motors to stabilize
setcommand(_MG,1) 'Reset emergency stop
fault = false
wait(30)
for i = 1 andwhile i < NUMBER_OF_MOTORS+1
operatingMode = getconfig(_MMOD,i)
if (operatingMode < 3) and (operatingMode > 4) 'Speed, Torque or Open Loop
setcommand(_G,i,0)
else 'Count Position or Position Tracking
setcommand(_P,i,getvalue(_F,i)) 'At position, send a position command equal to the motor feedback
end if
next
end if
wait(1) 'Loop Frequency 1KHz
end while