User Limit Digital Input E-Stop Store Position sample application.
This sample code shows how to configure a RMP controller's User Limit to compare an input bit to a specific signal (high signal (1) OR low signal (0)).
If the (1 condition) pattern matches, then the specified input bit has been activated (turned high) and a User limit Event will trigger.
In this example we configure a user limit to trigger when our INPUT turns high(1). Once the INPUT turns high(1) then our user limit will command an E-Stop action on the Axis and store the Axis Command Position.
The INPUT is specified in UserLimitConditionSet()
The User Limit configuration is done on UserLimitConfigSet()
The specified address to record on User Limit Event is specified in UserLimitInterruptUserDataAddressSet()
The Data from the speficified addres is retrieved by calling InterruptUserDataGet()
In this example Beckhoff IO Terminals (Model EL1088 for Inputs) were used to control the Digital IO signals.
Make sure to check the correct digital IO signal indexes of your system in: RapidSetup -. Tools -. NetworkIO
- Precondition
- This sample code presumes that the user has set the tuning paramters(PID, PIV, etc.) prior to running this program so that the motor can rotate in a stable manner.
- Warning
- This is a sample program to assist in the integration of your motion controller with your application. It may not contain all of the logic and safety features that your application requires.
- Copyright
- Copyright © 1998-2017 by Robotic Systems Integration, Inc. All rights reserved. This software contains proprietary and confidential information of Robotic Systems Integration, Inc. (RSI) and its suppliers. Except as may be set forth in the license agreement under which this software is supplied, disclosure, reproduction, or use with controls other than those provided by RSI or suppliers for RSI is strictly prohibited without the prior express written consent of Robotic Systems Integration.
using RSI.RapidCode.dotNET;
using RSI.RapidCode.dotNET.Enums;
using System;
{
class UserLimitDigitalInputEStopStorePosition
{
static void Main(string[] args)
{
const int INPUT_INDEX = 10;
const int AXIS_INDEX = 0;
const int AXIS_COUNT = 1;
const int USER_UNITS = 1048576;
const int USER_LIMIT = 1;
const int CONDITION = 0;
const int INPUT_MASK = 1;
const int LIMIT_VALUE = 1;
const int DURATION = 0;
const int USER_DATA_INDEX = 0;
ulong inputAddress;
axis = controller.
AxisGet(AXIS_INDEX);
try
{
USER_DATA_INDEX,
Console.WriteLine("Waiting for the input bit to go high...\n");
{
}
double interruptPosition = BitConverter.ToDouble(BitConverter.GetBytes(data), 0);
Console.WriteLine("Input bit went HIGH and User Limit {0} triggered!", triggeredUserLimit);
Console.WriteLine("User Limit Interrupt Position = "+ interruptPosition/USER_UNITS);
Console.WriteLine("\nDoes InterruptSourceNumberGet() - AxisCountGet() == userLimit: " + triggeredUserLimit.Equals(USER_LIMIT));
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
}
}