static void Main(string[] args)
        {
            // Initialize RapidCode Objects
            controller = MotionController.CreateFromSoftware();                                                                 // Insert the path location of the RMP.rta (usually the RapidSetup folder)
            SampleAppsCS.HelperFunctions.CheckErrors(controller);                                                               // [Helper Function] Check that the controller has been initialize correctly.

            // Some Necessary Pre User Limit Configuration
            controller.UserLimitCountSet(USER_LIMIT_COUNT);                                                                     // Set the amount of UserLimits that you want to use.

            SampleAppsCS.HelperFunctions.StartTheNetwork(controller);                                                           // [Helper Function] Initialize the network.

            axis = controller.AxisGet(AXIS_INDEX);                                                                              // Initialize your axis object.
            SampleAppsCS.HelperFunctions.CheckErrors(axis);


            try
            {
                // set the triggered modify values to stop very quickly
                axis.TriggeredModifyDecelerationSet(DECEL);
                axis.TriggeredModifyJerkPercentSet(JERK_PCT);

                //////////// FIRST USER LIMIT ////////////
                // USER LIMIT CONDITION 0 (trigger on digital input)
                controller.UserLimitConditionSet(USER_LIMIT_FIRST, 0, LOGIC, axis.AddressGet(RSIAxisAddressType.RSIAxisAddressTypeDIGITAL_INPUTS), 0x400000, 0x400000);              // Set your User Limit Condition (1st step to setting up your user limit)

                //// USER LIMIT OUTPUT  (copy TC.ActualPosition to UserBuffer)
                // controller.UserLimitOutputSet(USER_LIMIT_FIRST, RSIDataType.RSIDataTypeDOUBLE,  axis.AddressGet(RSIAxisAddressType.RSIAxisAddressTypeTC_ACTUAL_POSITION), controller.AddressGet(RSIControllerAddressType.RSIControllerAddressTypeUSER_BUFFER), true);

                //// USER LIMIT CONFIGURATION  (cause a TRIGGERED_MODIFY action on the Axis)
                controller.UserLimitConfigSet(USER_LIMIT_FIRST, TRIGGER_TYPE, ACTION, axis.NumberGet(), DURATION, ONE_SHOT);                    // Set your User Limit Configuration. (2nd step to setting up your user limit)


                //////////// SECOND USER LIMIT ////////////
                // CONDITION 0  (wait for first user limit to trigger)
                controller.UserLimitConditionSet(USER_LIMIT_SECOND, 0, RSIUserLimitLogic.RSIUserLimitLogicEQ, controller.AddressGet(RSIControllerAddressType.RSIControllerAddressTypeUSERLIMIT_STATUS, USER_LIMIT_FIRST), 1, 1);

                // CONDITION 1 (AND wait for Axis command velcity = 0.0)
                controller.UserLimitConditionSet(USER_LIMIT_SECOND, 1, RSIUserLimitLogic.RSIUserLimitLogicEQ, axis.AddressGet(RSIAxisAddressType.RSIAxisAddressTypeCOMMAND_VELOCITY), 0.0);

                // OUTPUT (copy value from UserBuffer to TC.CommandPosition when trigered)
                //controller.UserLimitOutputSet(USER_LIMIT_SECOND, RSIDataType.RSIDataTypeDOUBLE, controller.AddressGet(RSIControllerAddressType.RSIControllerAddressTypeUSER_BUFFER), axis.AddressGet(RSIAxisAddressType.RSIAxisAddressTypeTC_COMMAND_POSITION), true);
                controller.UserLimitConfigSet(USER_LIMIT_SECOND, RSIUserLimitTriggerType.RSIUserLimitTriggerTypeCONDITION_AND, RSIAction.RSIActionNONE, 0, 0, ONE_SHOT);


                // get the Axis moving
                axis.ClearFaults();
                axis.AmpEnableSet(true);
                axis.MoveVelocity(VELOCITY, ACCEL);

                // configure and enable interrupts
                ConfigureUserLimitInterrupts(USER_LIMIT_FIRST);
                ConfigureUserLimitInterrupts(USER_LIMIT_SECOND);
                controller.InterruptEnableSet(true);

                // wait for (and print) interrupts
                WaitForInterrupts();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }