using System; using System.Runtime.InteropServices; namespace OvladacPohybu { /// /// Ovladač pohybu využívající knihovnu FlexMotion32.dll. /// public unsafe class CFlexOvladacPohybu : IOvladacPohybu { enum u8 : byte { } enum i8 : sbyte { } enum u16 : ushort { } enum i16 : short { } enum i32 : int { } enum u32 : int { } public CFlexOvladacPohybu() { } // The Initialization function [DllImport("FlexMotion32.dll")] static extern i32 flex_initialize_controller (u8 boardID, byte[] settingsName /*i8 *settingsName*/); /////////////////////////////////////////////////////////////////////////////////////// // Axis & Resource Configuration Functions /////////////////////////////////////////////////////////////////////////////////////// //Configure Axis Resources [DllImport("FlexMotion32.dll")] static extern i32 flex_config_axis(u8 boardID, u8 axis, u8 primaryFeedback, u8 secondaryFeedback, u8 primaryOutput, u8 secondaryOutput); //Configure Move Complete Status Criteria [DllImport("FlexMotion32.dll")] static extern i32 flex_config_mc_criteria(u8 boardID, u8 axis, u16 criteria, u16 deadband, u8 delay, u8 minPulse); //Configure Stepper Output [DllImport("FlexMotion32.dll")] static extern i32 flex_configure_stepper_output(u8 boardID, u8 axisOrStepperOutput, u16 outputMode, u16 polarity, u16 driveMode); //Configure Vector Space [DllImport("FlexMotion32.dll")] static extern i32 flex_config_vect_spc(u8 boardID, u8 vectorSpace, u8 xAxis, u8 yAxis, u8 zAxis); //Enable Axes [DllImport("FlexMotion32.dll")] static extern i32 flex_enable_axis(u8 boardID, u8 reserved, u8 PIDRate, u16 axisMap); //Load Advanced Control Parameter [DllImport("FlexMotion32.dll")] static extern i32 flex_load_advanced_control_parameter(u8 boardID, u8 axis, u16 parameterType, u32 value, u8 inputVector); // Load Counts/Steps per Revolution [DllImport("FlexMotion32.dll")] static extern i32 flex_load_counts_steps_rev(u8 boardID, u8 axis, u16 unitType, u32 countsOrSteps); //Load All PID Parameters //[DllImport("FlexMotion32.dll")] static extern i32 flex_load_pid_parameters(u8 boardID, u8 axis, PID *PIDValues, u8 inputVector); // Load Single PID Parameter [DllImport("FlexMotion32.dll")] static extern i32 flex_load_single_pid_parameter(u8 boardID, u8 axis, u16 parameterType, u16 PIDValue, u8 inputVector); //Set Stepper Loop Mode [DllImport("FlexMotion32.dll")] static extern i32 flex_set_stepper_loop_mode(u8 boardID, u8 axis, u16 loopMode); //Load Velocity Filter Parameter [DllImport("FlexMotion32.dll")] static extern i32 flex_load_velocity_filter_parameter(u8 boardID, u8 axis, u16 filterDistance, u16 filterTime, u8 inputVector); //Load Commutation Mode //[DllImport("FlexMotion32.dll")] static extern i32 flex_load_commutation_parameter(u8 boardID, u8 axis, u16 attribute, double value); // Load Axis Configuration Parameter //[DllImport("FlexMotion32.dll")] static extern i32 flex_load_axis_configuration_parameter(i32 boardID, i32 axisID, TnimcAxisConfigurationParameter attribute, NIMC_DATA* data); /////////////////////////////////////////////////////////////////////////////////////// // Trajectory Functions /////////////////////////////////////////////////////////////////////////////////////// // Load Acceleraton [DllImport("FlexMotion32.dll")] static extern i32 flex_load_acceleration(u8 boardID, u8 axisOrVectorSpace, u16 accelerationType, u32 acceleration, u8 inputVector); //Load Following Error [DllImport("FlexMotion32.dll")] static extern i32 flex_load_follow_err(u8 boardID, u8 axis, u16 followingError, u8 inputVector); //Load Velocity in RPM //[DllImport("FlexMotion32.dll")] static extern i32 flex_load_rpm(u8 boardID, u8 axisOrVectorSpace, double RPM, u8 inputVector); // Load Acceleration in RPS/sec //[DllImport("FlexMotion32.dll")] static extern i32 flex_load_rpsps(u8 boardID, u8 axisOrVectorSpace, u16 accelerationType, double RPSPS, u8 inputVector); //Load Target Position [DllImport("FlexMotion32.dll")] static extern i32 flex_load_target_pos(u8 boardID, u8 axis, i32 targetPosition, u8 inputVector); //Load Velocity [DllImport("FlexMotion32.dll")] static extern i32 flex_load_velocity(u8 boardID, u8 axisOrVectorSpace, i32 velocity, u8 inputVector); //Load Vector Space Position [DllImport("FlexMotion32.dll")] static extern i32 flex_load_vs_pos (u8 boardID, u8 vectorSpace, i32 xPosition, i32 yPosition, i32 zPosition, u8 inputVector); //Load Move Constraints //[DllImport("FlexMotion32.dll")] static extern i32 flex_load_move_constraint (i32 boardID, i32 axisID, TnimcMoveConstraint attribute, NIMC_DATA* value); //Read per Axis Status [DllImport("FlexMotion32.dll")] static extern i32 flex_read_axis_status(u8 boardID, u8 axis, u8 returnVector); //Read per Axis Status [DllImport("FlexMotion32.dll")] static extern i32 flex_read_axis_status_rtn(u8 boardID, u8 axis, out u16 axisStatus); //Read Blend Status [DllImport("FlexMotion32.dll")] static extern i32 flex_read_blend_status(u8 boardID, u8 axisOrVectorSpace, u8 returnVector); //Read Blend Status [DllImport("FlexMotion32.dll")] static extern i32 flex_read_blend_status_rtn(u8 boardID, u8 axisOrVectorSpace, u16 *blendStatus); //Read Following Error [DllImport("FlexMotion32.dll")] static extern i32 flex_read_follow_err(u8 boardID, u8 axisOrVectorSpace, u8 returnVector); //Read Following Error [DllImport("FlexMotion32.dll")] static extern i32 flex_read_follow_err_rtn(u8 boardID, u8 axisOrVectorSpace, i16 *followingError); //Read Motion Complete Status [DllImport("FlexMotion32.dll")] static extern i32 flex_read_mcs_rtn(u8 boardID, u16 *moveCompleteStatus); //Read Position [DllImport("FlexMotion32.dll")] static extern i32 flex_read_pos(u8 boardID, u8 axis, u8 returnVector); //Read Position [DllImport("FlexMotion32.dll")] static extern i32 flex_read_pos_rtn(u8 boardID, u8 axis, out i32 position); //Read Velocity in RPM //The data is returned in "IEEE f64" format and has to be converted appropriately. [DllImport("FlexMotion32.dll")] static extern i32 flex_read_rpm(u8 boardID, u8 axisOrVectorSpace, u8 returnVector); //Read Velocity in RPM //The data is returned in "IEEE f64" format and is converted in the DLL. //[DllImport("FlexMotion32.dll")] static extern i32 flex_read_rpm_rtn(u8 boardID, u8 axisOrVectorSpace, double *RPM); // Read Trajectory Status [DllImport("FlexMotion32.dll")] static extern i32 flex_read_trajectory_status(u8 boardID, u8 axisOrVectorSpace, u16 statusType, u8 returnVector); // Read Trajectory Status [DllImport("FlexMotion32.dll")] static extern i32 flex_read_trajectory_status_rtn(u8 boardID, u8 axisOrVectorSpace, u16 statusType, u16 *status); //Read Velocity [DllImport("FlexMotion32.dll")] static extern i32 flex_read_velocity(u8 boardID, u8 axisOrVectorSpace, u8 returnVector); //Read Velocity [DllImport("FlexMotion32.dll")] static extern i32 flex_read_velocity_rtn(u8 boardID, u8 axisOrVectorSpace, out i32 velocity); //Read Vector Space Position [DllImport("FlexMotion32.dll")] static extern i32 flex_read_vs_pos (u8 boardID, u8 vectorSpace, u8 returnVector); //Read Vector Space Position [DllImport("FlexMotion32.dll")] static extern i32 flex_read_vs_pos_rtn (u8 boardID, u8 vectorSpace, i32 *xPosition, i32 *yPosition, i32 *zPosition); //Reset Position [DllImport("FlexMotion32.dll")] static extern i32 flex_reset_pos (u8 boardID, u8 axis, i32 position1, i32 position2, u8 inputVector); //Set Operation Mode [DllImport("FlexMotion32.dll")] static extern i32 flex_set_op_mode (u8 boardID, u8 axisOrVectorSpace, u16 operationMode); // Check Move Complete Status [DllImport("FlexMotion32.dll")] static extern i32 flex_check_move_complete_status (u8 boardID, u8 axisOrVectorSpace, u16 axisOrVSMap, u16* moveComplete); // Check Blend Complete Status [DllImport("FlexMotion32.dll")] static extern i32 flex_check_blend_complete_status (u8 boardID, u8 axisOrVectorSpace, u16 axisOrVSMap, u16* blendComplete); // Wait for Move Complete [DllImport("FlexMotion32.dll")] static extern i32 flex_wait_for_move_complete (u8 boardID, u8 axisOrVectorSpace, u16 axisOrVSMap, u32 timeout, i32 pollInterval, u16* moveComplete); // Wait for Blend Complete [DllImport("FlexMotion32.dll")] static extern i32 flex_wait_for_blend_complete (u8 boardID, u8 axisOrVectorSpace, u16 axisOrVSMap, u32 timeout, i32 pollInterval, u16* blendComplete); //////// Arcs Functions //Load Circular Arc [DllImport("FlexMotion32.dll")] static extern i32 flex_load_circular_arc (u8 boardID, u8 vectorSpace, u32 radius, double startAngle, double travelAngle, u8 inputVector); //Load Helical Arc [DllImport("FlexMotion32.dll")] static extern i32 flex_load_helical_arc (u8 boardID, u8 vectorSpace, u32 radius, double startAngle, double travelAngle, i32 linearTravel, u8 inputVector); //Load Spherical Arc [DllImport("FlexMotion32.dll")] static extern i32 flex_load_spherical_arc (u8 boardID, u8 vectorSpace, u32 radius, double planePitch, double planeYaw, double startAngle, double travelAngle, u8 inputVector); //////// Gearing Functions //Configure Gear Master [DllImport("FlexMotion32.dll")] static extern i32 flex_config_gear_master(u8 boardID, u8 axis, u8 masterAxisOrEncoderOrADC); //Enable Gearing [DllImport("FlexMotion32.dll")] static extern i32 flex_enable_gearing(u8 boardID, u16 gearMap); //Enable Gearing Single Axis [DllImport("FlexMotion32.dll")] static extern i32 flex_enable_gearing_single_axis (u8 boardID, u8 axis, u16 enable); //Load Gear Ratio [DllImport("FlexMotion32.dll")] static extern i32 flex_load_gear_ratio(u8 boardID, u8 axis, u16 absoluteOrRelative, i16 ratioNumerator, u16 ratioDenominator, u8 inputVector); //////// Electronic Camming Functions //Configure Camming Master [DllImport("FlexMotion32.dll")] static extern i32 flex_configure_camming_master(i32 boardID, i32 axisID, i32 masterResource, double masterCycle); //Load Camming Parameter //[DllImport("FlexMotion32.dll")] static extern i32 flex_load_camming_parameter(i32 boardID, i32 axisID, TnimcCammingParameter attribute, NIMC_DATA* data); //Enable Camming (Multiaxes) //[DllImport("FlexMotion32.dll")] static extern i32 flex_enable_camming(i32 boardID, u32 arraySize, NIMC_CAMMING_ENABLE_DATA* dataArray); //Enable Camming Single Axis [DllImport("FlexMotion32.dll")] static extern i32 flex_enable_camming_single_axis(i32 boardID, i32 axisID, u16 enable, double position); //////// Advanced Trajectory Functions //Acquire Trajectory Data [DllImport("FlexMotion32.dll")] static extern i32 flex_acquire_trajectory_data(u8 boardID, u16 axisMap, u16 numberOfSamples, u16 timePeriod); //Load Base Velocity [DllImport("FlexMotion32.dll")] static extern i32 flex_load_base_vel(u8 boardID, u8 axis, u16 baseVelocity, u8 inputVector); //Load Blend Factor [DllImport("FlexMotion32.dll")] static extern i32 flex_load_blend_fact(u8 boardID, u8 axisOrVectorSpace, i16 blendFactor, u8 inputVector); //Load Position Modulus [DllImport("FlexMotion32.dll")] static extern i32 flex_load_pos_modulus(u8 boardID, u8 axis, u32 positionModulus, u8 inputVector); //Load Run/Stop Threshold [DllImport("FlexMotion32.dll")] static extern i32 flex_load_run_stop_threshold(u8 boardID, u8 axis, u16 runStopThreshold, u8 inputVector); //Load Velocity Threshold [DllImport("FlexMotion32.dll")] static extern i32 flex_load_velocity_threshold(u8 boardID, u8 axis, u32 threshold, u8 inputVector); //Load Velocity Threshold in RPM [DllImport("FlexMotion32.dll")] static extern i32 flex_load_rpm_thresh(u8 boardID, u8 axis, double threshold, u8 inputVector); //Load S-Curve Time [DllImport("FlexMotion32.dll")] static extern i32 flex_load_scurve_time(u8 boardID, u8 axisOrVectorSpace, u16 sCurveTime, u8 inputVector); //Load Torque Limit [DllImport("FlexMotion32.dll")] static extern i32 flex_load_torque_lim(u8 boardID, u8 axis, i16 primaryPositiveLimit, i16 primaryNegativeLimit, i16 secondaryPositiveLimit, i16 secondaryNegativeLimit, u8 inputVector); //Load Torque Offset [DllImport("FlexMotion32.dll")] static extern i32 flex_load_torque_offset(u8 boardID, u8 axis, i16 primaryOffset, i16 secondaryOffset, u8 inputVector); //Load Velocity Override [DllImport("FlexMotion32.dll")] static extern i32 flex_load_velocity_override(u8 boardID, u8 axisOrVectorSpace, float overridePercentage, u8 inputVector); //Read DAC [DllImport("FlexMotion32.dll")] static extern i32 flex_read_dac(u8 boardID, u8 axisOrDAC, u8 returnVector); //Read DAC [DllImport("FlexMotion32.dll")] static extern i32 flex_read_dac_rtn(u8 boardID, u8 axisOrDAC, i16 *DACValue); //Read DAC Limit Status [DllImport("FlexMotion32.dll")] static extern i32 flex_read_dac_output_limit_status(u8 boardID, u8 returnVector); //Read DAC Limit Status [DllImport("FlexMotion32.dll")] static extern i32 flex_read_dac_output_limit_status_rtn(u8 boardID, u16 *positiveStatus, u16 *negativeStatus); //Read Steps Generated [DllImport("FlexMotion32.dll")] static extern i32 flex_read_steps_gen(u8 boardID, u8 axisOrStepperOutput, u8 returnVector); //Read Steps Generated [DllImport("FlexMotion32.dll")] static extern i32 flex_read_steps_gen_rtn(u8 boardID, u8 axisOrStepperOutput, i32 *steps); //Read Target Position [DllImport("FlexMotion32.dll")] static extern i32 flex_read_target_pos(u8 boardID, u8 axis, u8 returnVector); //Read Target Position [DllImport("FlexMotion32.dll")] static extern i32 flex_read_target_pos_rtn(u8 boardID, u8 axis, i32 *targetPosition); //Read Trajectory Data [DllImport("FlexMotion32.dll")] static extern i32 flex_read_trajectory_data(u8 boardID, u8 returnVector); //Read Trajectory Data //returnData points to an array of size <= 12 depending upon the //number of axes data is being acquired for. For 6 axes returnData //points to an array of size 12. [DllImport("FlexMotion32.dll")] static extern i32 flex_read_trajectory_data_rtn(u8 boardID, i32 *returnData); /////////////////////////////////////////////////////////////////////////////////////// // Buffered Functions /////////////////////////////////////////////////////////////////////////////////////// // Configure Buffer [DllImport("FlexMotion32.dll")] static extern i32 flex_configure_buffer (u8 boardID, u8 buffer, u8 resource, u16 bufferType, i32 bufferSize, u32 totalPoints, u16 oldDataStop, double requestedInterval, double *actualInterval); // Write Buffer [DllImport("FlexMotion32.dll")] static extern i32 flex_write_buffer (u8 boardID, u8 buffer, u32 numberOfPoints, u16 regenerationMode, i32 *data, u8 inputVector); // Read Buffer [DllImport("FlexMotion32.dll")] static extern i32 flex_read_buffer (u8 boardID, u8 buffer, u32 numberOfPoints, u8 returnVector); [DllImport("FlexMotion32.dll")] static extern i32 flex_read_buffer_rtn (u8 boardID, u8 buffer, u32 numberOfPoints, i32* data); // Check Buffer [DllImport("FlexMotion32.dll")] static extern i32 flex_check_buffer (u8 boardID, u8 buffer, u8 returnVector); [DllImport("FlexMotion32.dll")] static extern i32 flex_check_buffer_rtn (u8 boardID, u8 buffer, u32 *backlog, u16 *bufferState, u32 *pointsDone); // Clear Buffer [DllImport("FlexMotion32.dll")] static extern i32 flex_clear_buffer (u8 boardID, u8 buffer); /////////////////////////////////////////////////////////////////////////////////////// // Start & Stop Motion Functions /////////////////////////////////////////////////////////////////////////////////////// //Blend Motion [DllImport("FlexMotion32.dll")] static extern i32 flex_blend(u8 boardID, u8 axisOrVectorSpace, u16 axisOrVSMap); //Start Motion [DllImport("FlexMotion32.dll")] static extern i32 flex_start(u8 boardID, u8 axisOrVectorSpace, u16 axisOrVSMap); //Stop Motion [DllImport("FlexMotion32.dll")] static extern i32 flex_stop_motion(u8 boardID, u8 axisOrVectorSpace, u16 stopType, u16 axisOrVSMap); /////////////////////////////////////////////////////////////////////////////////////// // Motion IO Functions /////////////////////////////////////////////////////////////////////////////////////// //Enable Home Inputs [DllImport("FlexMotion32.dll")] static extern i32 flex_enable_home_inputs(u8 boardID, u16 homeMap); //Enable Limits [DllImport("FlexMotion32.dll")] static extern i32 flex_enable_axis_limit(u8 boardID, u16 limitType, u16 forwardLimitMap, u16 reverseLimitMap); //Load Software Limit Positions [DllImport("FlexMotion32.dll")] static extern i32 flex_load_sw_lim_pos(u8 boardID, u8 axis, i32 forwardLimit, i32 reverseLimit, u8 inputVector); //Read Home Input Status [DllImport("FlexMotion32.dll")] static extern i32 flex_read_home_input_status(u8 boardID, u8 returnVector); //Read Home Input Status [DllImport("FlexMotion32.dll")] static extern i32 flex_read_home_input_status_rtn(u8 boardID, u16 *homeStatus); //Read Limit Status [DllImport("FlexMotion32.dll")] static extern i32 flex_read_axis_limit_status(u8 boardID, u16 limitType, u8 returnVector); //Read Limit Status [DllImport("FlexMotion32.dll")] static extern i32 flex_read_axis_limit_status_rtn(u8 boardID, u16 limitType, u16 *forwardLimitStatus, u16 *reverseLimitStatus); //Set Home Input Polarity [DllImport("FlexMotion32.dll")] static extern i32 flex_set_home_polarity(u8 boardID, u16 homePolarityMap); //Set Inhibit MOMO [DllImport("FlexMotion32.dll")] static extern i32 flex_set_inhibit_output_momo(u8 boardID, u16 mustOn, u16 mustOff); //Set Limit Input Polarity [DllImport("FlexMotion32.dll")] static extern i32 flex_set_limit_input_polarity(u8 boardID, u16 forwardPolarityMap, u16 reversePolarityMap); //Configure Inhibit Output [DllImport("FlexMotion32.dll")] static extern i32 flex_config_inhibit_output(u8 boardID, u8 axis, u16 enableInhibit, u16 polarity, u16 driveMode); //Configure Breakpoint [DllImport("FlexMotion32.dll")] static extern i32 flex_configure_breakpoint(u8 boardID, u8 axisOrEncoder, u16 enableMode, u16 actionOnBreakpoint, u16 operation); //Configure Breakpoint Output [DllImport("FlexMotion32.dll")] static extern i32 flex_configure_breakpoint_output(u8 boardID, u8 axisOrEncoder, u16 polarity, u16 driveMode); //Enable Breakpoint [DllImport("FlexMotion32.dll")] static extern i32 flex_enable_breakpoint(u8 boardID, u8 axisOrEncoder, u16 enable); //Load Breakpoint Modulus [DllImport("FlexMotion32.dll")] static extern i32 flex_load_bp_modulus(u8 boardID, u8 axisOrEncoder, u32 breakpointModulus, u8 inputVector); //Load Breakpoint Position [DllImport("FlexMotion32.dll")] static extern i32 flex_load_pos_bp(u8 boardID, u8 axisOrEncoder, i32 breakpointPosition, u8 inputVector); //Read Breakpoint Status [DllImport("FlexMotion32.dll")] static extern i32 flex_read_breakpoint_status(u8 boardID, u8 axisOrEncoder, u16 breakpointType, u8 returnVector); //Read Breakpoint Status [DllImport("FlexMotion32.dll")] static extern i32 flex_read_breakpoint_status_rtn(u8 boardID, u8 axisOrEncoder, u16 breakpointType, u16 *breakpointStatus); //Set Breakpoint Output MOMO [DllImport("FlexMotion32.dll")] static extern i32 flex_set_breakpoint_output_momo(u8 boardID, u8 axisOrEncoder, u16 mustOn, u16 mustOff, u8 inputVector); //Enable High-Speed Capture [DllImport("FlexMotion32.dll")] static extern i32 flex_enable_hs_capture(u8 boardID, u8 axisOrEncoder, u16 enable); //Read Captured Position [DllImport("FlexMotion32.dll")] static extern i32 flex_read_cap_pos(u8 boardID, u8 axisOrEncoder, u8 returnVector); //Read Captured Position [DllImport("FlexMotion32.dll")] static extern i32 flex_read_cap_pos_rtn(u8 boardID, u8 axisOrEncoder, i32 *capturedPosition); //Read High-Speed Capture Status [DllImport("FlexMotion32.dll")] static extern i32 flex_read_hs_cap_status(u8 boardID, u8 axisOrEncoder, u8 returnVector); //Read High-Speed Capture Status [DllImport("FlexMotion32.dll")] static extern i32 flex_read_hs_cap_status_rtn(u8 boardID, u8 axisOrEncoder, u16 *highSpeedCaptureStatus); //Configure High-Speed Capture (replaces flex_set_hs_cap_pol) [DllImport("FlexMotion32.dll")] static extern i32 flex_configure_hs_capture(u8 boardID, u8 axisOrEncoder, u16 captureMode, u16 operation); //Configure Drive Signal [DllImport("FlexMotion32.dll")] static extern i32 flex_configure_drive_signal(u8 boardID, u8 axis, u16 port, u16 pin, u16 mode, u16 polarity); //Read Drive Signal Status [DllImport("FlexMotion32.dll")] static extern i32 flex_read_drive_signal_status(u8 boardID, u8 axis, u8 returnVector); //Read Drive Signal Status [DllImport("FlexMotion32.dll")] static extern i32 flex_read_drive_signal_status_rtn(u8 boardID, u8 axis, u16 *driveStatus); // Load Motion IO Parameter //[DllImport("FlexMotion32.dll")] static extern i32 flex_load_motion_io_parameter(i32 boardID, i32 axisID, TnimcMotionIOParameter attribute, NIMC_DATA* data); // Read Motion IO Execution Data //[DllImport("FlexMotion32.dll")] static extern i32 flex_read_motion_io_execution_data(i32 boardID, i32 axisID, TnimcMotionIOExecution attribute, NIMC_DATA* data); /////////////////////////////////////////////////////////////////////////////////////// // Find Home & Index Functions /////////////////////////////////////////////////////////////////////////////////////// //Find Reference [DllImport("FlexMotion32.dll")] static extern i32 flex_find_reference(u8 boardID, u8 axisOrVectorSpace, u16 axisOrVSMap, u8 findType); //Wait Reference [DllImport("FlexMotion32.dll")] static extern i32 flex_wait_reference(u8 boardID, u8 axisOrVectorSpace, u16 axisOrVSMap, u32 timeout, u32 pollingInterval, u16 *found); //Read Reference Status [DllImport("FlexMotion32.dll")] static extern i32 flex_read_reference_status(u8 boardID, u8 axisOrVectorSpace, u16 axisOrVSMap, u16 attribute, u8 returnVector); //Read Reference Status [DllImport("FlexMotion32.dll")] static extern i32 flex_read_reference_status_rtn(u8 boardID, u8 axisOrVectorSpace, u16 axisOrVSMap, u16 attribute, u16 *value); //Check Reference [DllImport("FlexMotion32.dll")] static extern i32 flex_check_reference(u8 boardID, u8 axisOrVectorSpace, u16 axisOrVSMap, u16 *found, u16 *finding); //Load Reference Parameter [DllImport("FlexMotion32.dll")] static extern i32 flex_load_reference_parameter(u8 boardID, u8 axis, u8 findType, u16 attribute, double value); //Get Reference Parameter [DllImport("FlexMotion32.dll")] static extern i32 flex_get_reference_parameter(u8 boardID, u8 axis, u8 findType, u16 attribute, double* value); //Find Home [DllImport("FlexMotion32.dll")] static extern i32 flex_find_home(u8 boardID, u8 axis, u16 directionMap); //Find Index [DllImport("FlexMotion32.dll")] static extern i32 flex_find_index(u8 boardID, u8 axis, u16 direction, i16 offset); /////////////////////////////////////////////////////////////////////////////////////// // Analog & Digital IO Functions /////////////////////////////////////////////////////////////////////////////////////// // Configure PWM Output [DllImport("FlexMotion32.dll")] static extern i32 flex_configure_pwm_output (u8 boardID, u8 PWMOutput, u16 enable, u16 clock); // Enable ADCs [DllImport("FlexMotion32.dll")] static extern i32 flex_enable_adcs (u8 boardID, u8 reserved, u16 ADCMap); // Enable Encoders [DllImport("FlexMotion32.dll")] static extern i32 flex_enable_encoders (u8 boardID, u16 encoderMap); // Load DAC [DllImport("FlexMotion32.dll")] static extern i32 flex_load_dac (u8 boardID, u8 DAC, i16 outputValue, u8 inputVector); // Load PWM Duty Cycle [DllImport("FlexMotion32.dll")] static extern i32 flex_load_pwm_duty (u8 boardID, u8 PWMOutput, u16 dutycycle, u8 inputVector); // Read Encoder Position [DllImport("FlexMotion32.dll")] static extern i32 flex_read_encoder (u8 boardID, u8 axisOrEncoder, u8 returnVector); // Read Encoder Position [DllImport("FlexMotion32.dll")] static extern i32 flex_read_encoder_rtn (u8 boardID, u8 axisOrEncoder, i32 *encoderCounts); // Read I/O Port [DllImport("FlexMotion32.dll")] static extern i32 flex_read_port (u8 boardID, u8 port, u8 returnVector); // Read I/O Port [DllImport("FlexMotion32.dll")] static extern i32 flex_read_port_rtn (u8 boardID, u8 port, u16 *portData); // Reset Encoder Position [DllImport("FlexMotion32.dll")] static extern i32 flex_reset_encoder (u8 boardID, u8 encoder, i32 position, u8 inputVector); // Select Signal (RTSI) [DllImport("FlexMotion32.dll")] static extern i32 flex_select_signal (u8 boardID, u16 destination, u16 source); // Read ADC value [DllImport("FlexMotion32.dll")] static extern i32 flex_read_adc16(u8 boardID, u8 ADC, u8 returnVector); // Read ADC value [DllImport("FlexMotion32.dll")] static extern i32 flex_read_adc16_rtn(u8 boardID, u8 ADC, i32 *ADCValue); // Set ADC Range [DllImport("FlexMotion32.dll")] static extern i32 flex_set_adc_range (u8 boardID, u8 ADC, u16 range); // Configure Encoder Filter [DllImport("FlexMotion32.dll")] static extern i32 flex_configure_encoder_filter (u8 boardID, u8 axisOrEncoder, u16 frequency); //Configure Encoder Polarity [DllImport("FlexMotion32.dll")] static extern i32 flex_configure_encoder_polarity(u8 boardID, u16 indexPolarity, u16 phaseAPolarity, u16 phaseBPolarity); // Set I/O Port Direction [DllImport("FlexMotion32.dll")] static extern i32 flex_set_port_direction (u8 boardID, u8 port, u16 directionMap); // Set I/O Port MOMO [DllImport("FlexMotion32.dll")] static extern i32 flex_set_port(u8 boardID, u8 port, u8 mustOn, u8 mustOff, u8 inputVector); // Set I/O Port Polarity [DllImport("FlexMotion32.dll")] static extern i32 flex_set_port_pol (u8 boardID, u8 port, u16 portPolarityMap); /////////////////////////////////////////////////////////////////////////////////////// // Error & Utility Functions /////////////////////////////////////////////////////////////////////////////////////// // Get Error Description [DllImport("FlexMotion32.dll")] static extern i32 flex_get_error_description(u16 descriptionType, i32 errorCode, u16 commandID, u16 resourceID, i8 *charArray, u32 *sizeOfArray); // Get Motion Board Information [DllImport("FlexMotion32.dll")] static extern i32 flex_get_motion_board_info (u8 boardID, u32 informationType, u32 *informationValue); // Get Motion Board Information [DllImport("FlexMotion32.dll")] static extern i32 flex_get_motion_board_info_string(u8 boardID, u32 informationType, i8 *charArray, u32 *sizeOfArray); // Get Motion Board Name [DllImport("FlexMotion32.dll")] static extern i32 flex_get_motion_board_name (u8 boardID, i8 *charArray, u32 *sizeOfArray); //Read Error Message [DllImport("FlexMotion32.dll")] static extern i32 flex_read_error_msg_rtn(u8 boardID, u16 *commandID, u16 *resourceID, i32 *errorCode); //Read Error Message Detail [DllImport("FlexMotion32.dll")] static extern i32 flex_read_error_msg_detail_rtn(u8 boardID, u16 *commandID, u16 *resourceID, i32 *errorCode, u16 *lineNumber, u16 *fileNumber); // Get Last Error [DllImport("FlexMotion32.dll")] static extern i32 flex_get_last_error(u8 boardID, u16 *commandID, u16 *resourceID, i32 *errorCode); // Get u32 [DllImport("FlexMotion32.dll")] static extern i32 flex_getu32(u8 boardID, u8 resource, u16 attribute, u32 *value); // Set u32 [DllImport("FlexMotion32.dll")] static extern i32 flex_setu32(u8 boardID, u8 resource, u16 attribute, u32 value); // Get f64 [DllImport("FlexMotion32.dll")] static extern i32 flex_getf64(u8 boardID, u8 resource, u16 attribute, double *value); // Set f64 [DllImport("FlexMotion32.dll")] static extern i32 flex_setf64(u8 boardID, u8 resource, u16 attribute, double value); /////////////////////////////////////////////////////////////////////////////////////// // On-board Programming Functions /////////////////////////////////////////////////////////////////////////////////////// //Begin Program Storage [DllImport("FlexMotion32.dll")] static extern i32 flex_begin_store(u8 boardID, u8 program); //End Program Storage [DllImport("FlexMotion32.dll")] static extern i32 flex_end_store(u8 boardID, u8 program); //Insert Label [DllImport("FlexMotion32.dll")] static extern i32 flex_insert_program_label(u8 boardID, u16 labelNumber); //Jump to Label on Condition [DllImport("FlexMotion32.dll")] static extern i32 flex_jump_on_event (u8 boardID, u8 resource, u16 condition, u16 mustOn, u16 mustOff, u16 matchType, u16 labelNumber); //Load Program Delay [DllImport("FlexMotion32.dll")] static extern i32 flex_load_delay(u8 boardID, u32 delayTime); //Pause/Resume Program [DllImport("FlexMotion32.dll")] static extern i32 flex_pause_prog(u8 boardID, u8 program); //Read Program Status [DllImport("FlexMotion32.dll")] static extern i32 flex_read_program_status (u8 boardID, u8 program, u8 returnVector); //Read Program Status [DllImport("FlexMotion32.dll")] static extern i32 flex_read_program_status_rtn (u8 boardID, u8 program, u16 *programStatus); //Run Program [DllImport("FlexMotion32.dll")] static extern i32 flex_run_prog(u8 boardID, u8 program); //Set User Status MOMO [DllImport("FlexMotion32.dll")] static extern i32 flex_set_status_momo(u8 boardID, u8 mustOn, u8 mustOff); //Stop Program [DllImport("FlexMotion32.dll")] static extern i32 flex_stop_prog(u8 boardID, u8 program); //Wait on Condition [DllImport("FlexMotion32.dll")] static extern i32 flex_wait_on_event (u8 boardID, u8 resource, u16 waitType, u16 condition, u16 mustOn, u16 mustOff, u16 matchType, u16 timeOut, u8 returnVector); //Load Program Time Slice [DllImport("FlexMotion32.dll")] static extern i32 flex_load_program_time_slice (u8 boardID, u8 program, u16 timeSlice, u8 inputVector); //////// Object Management Functions //Load Memory Object Description //Maximum size of description that can be entered is 32 chars //[DllImport("FlexMotion32.dll")] static extern i32 flex_load_description(u8 boardID, u8 object, i8 *description); // Object Memory Management //[DllImport("FlexMotion32.dll")] static extern i32 flex_object_mem_manage(u8 boardID, u8 object, u16 operation); //Read Memory Object Description //description points to an array of size 32 //[DllImport("FlexMotion32.dll")] static extern i32 flex_read_description_rtn(u8 boardID, u8 object, i8 * description); //Read Object Registry //[DllImport("FlexMotion32.dll")] static extern i32 flex_read_registry_rtn(u8 boardID, u8 index, REGISTRY *registryRecord); //////// Data Operations Functions //Add Variables [DllImport("FlexMotion32.dll")] static extern i32 flex_add_vars(u8 boardID, u8 variable1, u8 variable2, u8 returnVector); //AND Variables [DllImport("FlexMotion32.dll")] static extern i32 flex_and_vars(u8 boardID, u8 variable1, u8 variable2, u8 returnVector); //Divide Variables [DllImport("FlexMotion32.dll")] static extern i32 flex_div_vars(u8 boardID, u8 variable1, u8 variable2, u8 returnVector); //Load Constant to Variable [DllImport("FlexMotion32.dll")] static extern i32 flex_load_var(u8 boardID, i32 value, u8 variable1); //Logical Shift Variable [DllImport("FlexMotion32.dll")] static extern i32 flex_lshift_var(u8 boardID, u8 variable1, i8 logicalShift, u8 returnVector); //Multiply Variables [DllImport("FlexMotion32.dll")] static extern i32 flex_mult_vars(u8 boardID, u8 variable1, u8 variable2, u8 returnVector); //Invert Variable [DllImport("FlexMotion32.dll")] static extern i32 flex_not_var(u8 boardID, u8 variable1, u8 returnVector); //OR Variables [DllImport("FlexMotion32.dll")] static extern i32 flex_or_vars(u8 boardID, u8 variable1, u8 variable2, u8 returnVector); //Read Variable [DllImport("FlexMotion32.dll")] static extern i32 flex_read_var(u8 boardID, u8 variable1, u8 returnVector); //Read Variable [DllImport("FlexMotion32.dll")] static extern i32 flex_read_var_rtn(u8 boardID, u8 variable1, i32 *value); //Subtract Variables [DllImport("FlexMotion32.dll")] static extern i32 flex_sub_vars(u8 boardID, u8 variable1, u8 variable2, u8 returnVector); //Exclusive OR Variables [DllImport("FlexMotion32.dll")] static extern i32 flex_xor_vars(u8 boardID, u8 variable1, u8 variable2, u8 returnVector); /////////////////////////////////////////////////////////////////////////////////////// // Advanced Functions /////////////////////////////////////////////////////////////////////////////////////// //Clear Power Up Status [DllImport("FlexMotion32.dll")] static extern i32 flex_clear_pu_status(u8 boardID); //Communicate [DllImport("FlexMotion32.dll")] static extern i32 flex_communicate(u8 boardID, u8 mode, u8 wordCount, u8 *resource, u16 *command, u16 *data, u8 vector); //Flush Return Data Buffer [DllImport("FlexMotion32.dll")] static extern i32 flex_flush_rdb(u8 boardID); //Enable Auto Start [DllImport("FlexMotion32.dll")] static extern i32 flex_enable_auto_start(u8 boardID, u8 enableOrDisable, u8 programToExecute); //Enable Shut Down [DllImport("FlexMotion32.dll")] static extern i32 flex_enable_shutdown(u8 boardID); //Enable 1394 Watchdog [DllImport("FlexMotion32.dll")] static extern i32 flex_enable_1394_watchdog(u8 boardID, u16 enableOrDisable); //Read Communication Status [DllImport("FlexMotion32.dll")] static extern i32 flex_read_csr_rtn(u8 boardID, u16 *csr); //Reset Default Parameters [DllImport("FlexMotion32.dll")] static extern i32 flex_reset_defaults (u8 boardID); //Save Default Parameters [DllImport("FlexMotion32.dll")] static extern i32 flex_save_defaults (u8 boardID); //Set Interrupt Event Mask [DllImport("FlexMotion32.dll")] static extern i32 flex_set_irq_mask(u8 boardID, u16 mask); //Read Board Temperature [DllImport("FlexMotion32.dll")] static extern i32 flex_read_board_temperature(u8 boardID, double* temperature); //Read Return Data Buffer [DllImport("FlexMotion32.dll")] static extern i32 flex_read_rdb(u8 boardID, u16 *number, u16 *wordCount, u8 *resource, u16 *command, u16 *commandData); /// /// Hledá pozici home pomocí home/limit switche. Pokud je směr 0 pak hledá ve směru forward, pro -1 hledá reverse /// /// /// /// public void NajdiHome( byte boardID, byte fyzCisloOsy, short smer ) { i32 status = flex_find_home( (u8) boardID, (u8) fyzCisloOsy, (u16) smer ); ZjistiChybu( status ); } public void NastavZpusobPohybu( byte boardID, byte fyzCisloOsy, ushort zpusobPohybu ) { i32 status = flex_set_op_mode( (u8) boardID, (u8) fyzCisloOsy, (u16) zpusobPohybu ); ZjistiChybu( status ); } public void NastavRychlostPohybu( byte boardID, byte fyzCisloOsy, uint rychlost ) { i32 status = flex_load_velocity( (u8) boardID, (u8) fyzCisloOsy, (i32) rychlost, (u8) 0xff ); ZjistiChybu( status ); //status = load_accel( boardID, fyzCisloOsy, 10000 ); // JESTE DODELAT - je to nutne delat po inicializalizaci //ZjistiChybu( status ); } public uint ZjistiRychlostPohybu( byte boardID, byte fyzCisloOsy ) { i32 vysledek; i32 status = flex_read_velocity_rtn( (u8) boardID, (u8) fyzCisloOsy, out vysledek ); ZjistiChybu( status ); return (uint)(vysledek); } public int ZjistiPozici( byte boardID, byte fyzCisloOsy ) { i32 vysledek = 0; i32 status = flex_read_pos_rtn( (u8) boardID, (u8) fyzCisloOsy, out vysledek ); ZjistiChybu( status ); return (int)(vysledek); } public void NastavPozici( byte boardID, byte fyzCisloOsy, int pozice ) { i32 status = flex_load_target_pos((u8) boardID, (u8) fyzCisloOsy, (i32) pozice, (u8) 0xff); ZjistiChybu( status ); } public void SpustPohyb( byte boardID, byte fyzCisloOsy ) { i32 status = flex_start((u8) boardID, (u8) fyzCisloOsy, 0); ZjistiChybu( status ); } public void ResetPozice( byte boardId, byte fyzCisloOsy ) { i32 status = flex_reset_pos( (u8) boardId, (u8) fyzCisloOsy, (i32) 0, (i32) 0, (u8) 0xff ); ZjistiChybu( status ); } public void ZastavPohyb( byte boardID, byte fyzCisloOsy, bool vypnoutProud ) { u16 stopType = (u16)(vypnoutProud ? 2 : 0); i32 status = flex_stop_motion( (u8) boardID, (u8) fyzCisloOsy, stopType, 0 ); ZjistiChybu( status ); } public bool PohybujeSe( byte boardId, byte fyzCisloOsy ) { u16 stavOsy; i32 status = flex_read_axis_status_rtn( (u8) boardId, (u8) fyzCisloOsy, out stavOsy ); ZjistiChybu( status ); ushort stav = (ushort)(stavOsy); bool bezi = (( stav & 1 ) != 0 ); bool dokoncen = (( stav & 2 ) != 0 ); bool vypnuty = (( stav & 4 ) != 0 ); bool stoji = ( dokoncen || vypnuty ) && !bezi; // dokonceny nebo vypnuty a nebezi return !stoji; } /// /// Inicializuje pohyb pomocí výchozích hodnot z MAXe /// /// /// Funkce může brát i jiná nastavení. Protože s nimi ale v Maxovi byly problémy (špatně se ukládaly a načítaly) tak tuto možnost raději neimplementujeme /// /// public void Inicializace( byte boardId ) { i32 status = flex_initialize_controller((u8)(boardId), null ); ZjistiChybu( status ); } private void ZjistiChybu( i32 status ) { if(status == 0) { return; } throw new Exception("FlexMotion32 error " + status); } private void ZjistiChybu( short status ) { if( status == 0 ) return; switch( status ) { case 1: throw new Exception( "NIMC_readyToReceiveTimeoutError. Ready to Receive Timeout. The controller is still not ready to receive commands after the specified timeout period. This error may occur if the controller is busy processing previous commands. If this error persists, even when the controller should not be busy, contact National Instruments." ); case 2: throw new Exception( "NIMC_currentPacketErrorEither this function is not supported by this type of controller, or the controller received an incomplete command packet and cannot execute the function." ); case 3: throw new Exception( "NIMC_noReturnDataBufferErrorNo data in the Return Data Buffer. The kernel driver returns an error if it runs out of time waiting for the controller to return data to the Return Data Buffer. For FlexMotion controllers, this error can also be returned if the power-up state of the controller has not been cleared." ); case 4: throw new Exception( "NIMC_halfReturnDataBufferErrorPartial readback packet. The data returned by the controller is incomplete. The kernel driver timed out after getting partial data." ); case 5: throw new Exception( "NIMC_boardFailureErrorMost likely, your controller is not installed or configured properly. If this error persists when you know your controller is installed and configured properly, it indicates an internal hardware failure." ); case 6: throw new Exception( "NIMC_badResourceIDOrAxisErrorFor ValueMotion, an invalid axis number was used. For FlexMotion, an invalid axis number or other resource ID (Vector Space, Encoder, I/O Port, and so on) was used." ); case 7: throw new Exception( "NIMC_CIPBitErrorA previous function is currently being executed, so the controller cannot accept this function until the previous function has completed. If this problem persists, try putting a delay between the offending commands." ); case 8: throw new Exception( "NIMC_previousPacketErrorThe function called previous to this one is not supported by this type of controller." ); case 9: throw new Exception( "NIMC_packetErrBitNotClearedErrorPacket error bit not cleared by terminator (hardware error)." ); case 10: throw new Exception( "NIMC_badCommandErrorCommand ID not recognized. Invalid command sent to the controller (FlexMotion only)." ); case 11: throw new Exception( "NIMC_badReturnDataBufferPacketErrorCorrupt readback data. The data returned by the motion controller is corrupt." ); case 12: throw new Exception( "NIMC_badBoardIDErrorIllegal board ID. You must use the board ID assigned to your controller in Measurement & Automation Explorer." ); case 13: throw new Exception( "NIMC_packetLengthErrorCommand packet length is incorrect." ); case 14: throw new Exception( "NIMC_closedLoopOnlyErrorThis command is valid only on closed-loop axes (closed-loop stepper and servo)." ); case 15: throw new Exception( "NIMC_returnDataBufferFlushErrorUnable to flush the Return Data Buffer." ); case 16: throw new Exception( "NIMC_servoOnlyErrorThis command is valid only on servo axes." ); case 17: throw new Exception( "NIMC_stepperOnlyErrorThis command is valid only on stepper axes." ); case 18: throw new Exception( "NIMC_closedLoopStepperOnlyErrorThis command is valid only on closed-loop stepper axes." ); case 19: throw new Exception( "NIMC_noBoardConfigInfoError. Controller configuration information is missing or corrupt." ); case 20: throw new Exception( "NIMC_countsNotConfiguredErrorSteps/rev and/or counts/rev (in ValueMotion, lines/rev) not loaded for this axis." ); case 21: throw new Exception( "NIMC_systemResetErrorSystem reset did not occur in maximum time allowed." ); case 22: throw new Exception( "NIMC_functionSupportErrorThis command is not supported by this controller or operating system." ); case 23: throw new Exception( "NIMC_parameterValueErrorOne of the parameters passed into the function has an illegal value." ); case 24: throw new Exception( "NIMC_motionOnlyErrorMotion command sent to an Encoder board." ); case 25: throw new Exception( "NIMC_returnDataBufferNotEmptyErrorThe Return Data Buffer is not empty. Commands that expect data returned from the controller cannot be sent until the Return Data Buffer is cleared." ); case 26: throw new Exception( "NIMC_modalErrorsReadErrorThe Motion Error Hander.flx VI discovered modal error(s) in the modal error stack. These error(s) can be viewed in the Modal Error(s) Out Indicator/terminal of this VI." ); case 27: throw new Exception( "NIMC_processTimeoutErrorUnder Windows NT, a function call made to the motion controller timed out waiting for driver access. For ethernet controllers, a function call made to the motion controller timed out waiting for return data. This can happen due to a slow or lost connection with the ethernet box product." ); case 28: throw new Exception( "NIMC_insufficientSizeErrorThe resource is not large enough to supported the specified operation." ); case 29: throw new Exception( "NIMC_reserved4ErrorReserved for obsolete product." ); case 30: throw new Exception( "NIMC_reserved5ErrorReserved for obsolete product." ); case 31: throw new Exception( "NIMC_reserved6ErrorReserved for obsolete product." ); case 32: throw new Exception( "NIMC_reserved7ErrorReserved for obsolete product." ); case 33: throw new Exception( "NIMC_badPointerErrorA NULL pointer has been passed into a function inappropriately." ); case 34: throw new Exception( "NIMC_wrongReturnDataErrorIncorrect data has been returned by the controller. This data does not correspond to the expected data for the command sent to the controller." ); case 35: throw new Exception( "NIMC_watchdogTimeoutErrorA fatal error has occurred on the controller. You must reset the controller by power cycling your computer. Contact National Instruments technical support if this problem persists." ); case 36: throw new Exception( "NIMC_invalidRatioErrorA specified ratio is invalid." ); case 37: throw new Exception( "NIMC_irrelevantAttributeErrorThe specified attribute is not relevant." ); case 38: throw new Exception( "NIMC_internalSoftwareErrorAn unexpected error has occurred internal to the driver. Please contact National Instruments with the name of the function or VI that returned this error." ); case 39: throw new Exception( "NIMC_1394WatchdogEnableErrorThe communication watchdog on the 1394 motherboard could not be started." ); case 40: throw new Exception( "NIMC_availableForUse40Available" ); case 41: throw new Exception( "NIMC_boardIDInUseErrorThe boardID is already in use by another controller. If trying to change a controllers boardID, select a boardID not in use." ); case 42: throw new Exception( "NIMC_availableForUse42Available" ); case 43: throw new Exception( "NIMC_availableForUse43Available" ); case 44: throw new Exception( "NIMC_availableForUse44Available" ); case 45: throw new Exception( "NIMC_availableForUse45Available" ); case 46: throw new Exception( "NIMC_availableForUse46Available" ); case 47: throw new Exception( "NIMC_availableForUse47Available" ); case 48: throw new Exception( "NIMC_availableForUse48Available" ); case 49: throw new Exception( "NIMC_downloadChecksumErrorThere was an error during check sum on a file being downloaded to the FlexMotion controller." ); case 50: throw new Exception( "NIMC_reserved50ErrorReserved." ); case 51: throw new Exception( "NIMC_firmwareDownloadErrorFirmware download failed. Reset the controller and try downloading again." ); case 52: throw new Exception( "NIMC_FPGAProgramErrorInternal Error. The FPGA failed to program. Reset the controller and try again. If the problem persists, contact National Instruments technical support." ); case 53: throw new Exception( "NIMC_DSPInitializationErrorInternal Error. The DSP failed to initialize. Reset the controller and try again. If the problem persists, contact National Instruments technical support." ); case 54: throw new Exception( "NIMC_corrupt68331FirmwareErrorCorrupt onboard microprocessor firmware detected. Download new firmware." ); case 55: throw new Exception( "NIMC_corruptDSPFirmwareErrorCorrupt DSP firmware detected. Download new DSP firmware." ); case 56: throw new Exception( "NIMC_corruptFPGAFirmwareErrorCorrupt FPGA firmware detected. Download new FPGA firmware." ); case 57: throw new Exception( "NIMC_interruptConfigurationErrorInternal Error. Host interrupt configuration failed and interrupt support is disabled." ); case 58: throw new Exception( "NIMC_IOInitializationErrorInternal Error. The I/O structure on the controller failed to initialize. Reset the controller and try again. If the problem persists, contact National Instruments technical support." ); case 59: throw new Exception( "NIMC_flashromCopyErrorError copying to the FLASH ROM." ); case 60: throw new Exception( "NIMC_corruptObjectSectorErrorThe objects stored in FLASH ROM are corrupt." ); case 61: throw new Exception( "NIMC_bufferInUseErrorThe specified buffer is in use." ); case 62: throw new Exception( "NIMC_oldDataStopErrorThe Read Buffer or Write Buffer function was unable to complete sucessfully because old data was encountered in the course of reading from or writing to the buffer." ); case 63: throw new Exception( "NIMC_bufferConfigurationErrorThe buffer has not been configured properly. Buffer type cannot be changed. The buffer might exist in ROM, but has not yet been configured since the last power cycle." ); case 64: throw new Exception( "NIMC_illegalBufferOperationThis operation is invalid at this time. You cannot write to a ROM buffer." ); case 65: throw new Exception( "NIMC_illegalContouringErrorThis operation cannot be executed while a contouring operation is in progress." ); case 66: throw new Exception( "NIMC_availableForUse66None" ); case 67: throw new Exception( "NIMC_availableForUse67None" ); case 68: throw new Exception( "NIMC_availableForUse68None" ); case 69: throw new Exception( "NIMC_availableForUse69None" ); case 70: throw new Exception( "NIMC_availableForUse70None" ); case 71: throw new Exception( "NIMC_availableForUse71None" ); case 72: throw new Exception( "NIMC_boardInPowerUpResetStateErrorThe FlexMotion controller is in power up reset state. Please execute the Clear Power Up Status function or VI before sending any commands to the controller." ); case 73: throw new Exception( "NIMC_boardInShutDownStateErrorThe controller cannot accept this function, as it has been shut down." ); case 74: throw new Exception( "NIMC_shutDownFailedErrorThe controller failed to shut down. This could be because it failed to disable the DACs, the encoders, or the ADCs, or because it could not reset the I/O back to user defaults. " ); case 75: throw new Exception( "NIMC_hostFIFOBufferFullErrorCommunication FIFO buffer between the host computer and the controller is full." ); case 76: throw new Exception( "NIMC_noHostDataErrorCommunications error. The controller did not receive any data in the command packet from the host computer." ); case 77: throw new Exception( "NIMC_corruptHostDataErrorCommunications error. The controller received corrupt data in the packet from the host computer." ); case 78: throw new Exception( "NIMC_invalidFunctionDataErrorInvalid function data has been passed. This is usually a parameter out of range, or an illegal combination of parameter values." ); case 79: throw new Exception( "NIMC_autoStartFailedErrorThe controller could not run the onboard program on auto start. When you enable auto start, make sure that you specify a valid program number and that the program is saved in FLASH ROM." ); case 80: throw new Exception( "NIMC_returnDataBufferFullErrorThe Return Data Buffer on the controller is full." ); case 81: throw new Exception( "NIMC_reserved81ErrorReserved - Never used for DSP messaging error." ); case 82: throw new Exception( "NIMC_reserved82ErrorReserved - Never used for position wrap-around error." ); case 83: throw new Exception( "NIMC_DSPXmitBufferFullErrorInternal error. The transmit buffer of the DSP is full. Messages from DSP to the onboard microprocessor are being delayed or lost." ); case 84: throw new Exception( "NIMC_DSPInvalidCommandErrorInternal error. The DSP received an illegal command." ); case 85: throw new Exception( "NIMC_DSPInvalidDeviceErrorInternal error. The DSP received a command with an invalid Device ID." ); case 86: throw new Exception( "NIMC_availableForUse86None" ); case 87: throw new Exception( "NIMC_availableForUse87None" ); case 88: throw new Exception( "NIMC_availableForUse88None" ); case 89: throw new Exception( "NIMC_availableForUse89None" ); case 90: throw new Exception( "NIMC_availableForUse90None" ); case 91: throw new Exception( "NIMC_availableForUse91None" ); case 92: throw new Exception( "NIMC_DSPXmitDataErrorInternal error. The data returned by the DSP is incomplete or corrupt." ); case 93: throw new Exception( "NIMC_DSPCommunicationsErrorInternal error. A command from the onboard microprocessor to the DSP was corrupt and ignored." ); case 94: throw new Exception( "NIMC_DSPMessageBufferEmptyErrorInternal Error. This is an internal message to indicate that the there is no more data in the internal message buffer." ); case 95: throw new Exception( "NIMC_DSPCommunicationsTimeoutErrorInternal error. There was an internal timeout while sending commands to the DSP." ); case 96: throw new Exception( "NIMC_passwordErrorThe password used for this function is incorrect." ); case 97: throw new Exception( "NIMC_mustOnMustOffConflictErrorThere is a conflict between the mustOn and mustOff values set for this function." ); case 98: throw new Exception( "NIMC_reserved98ErrorWas BAD_IO_DIR_ERROR" ); case 99: throw new Exception( "NIMC_reserved99ErrorWas OUTCOMP_ERROR - Counter/timer breakpoint is set for an invalid I/O bit." ); case 100: throw new Exception( "NIMC_IOEventCounterErrorProblem with the I/O Event Counter." ); case 101: throw new Exception( "NIMC_reserved101ErrorWas PAI_TM_ERROR - Problem with the I/O timer gate." ); case 102: throw new Exception( "NIMC_wrongIODirectionErrorThe I/O bit configuration does not agree with its port's direction setting." ); case 103: throw new Exception( "NIMC_wrongIOConfigurationErrorI/O bit configuration is not possible for that pin." ); case 104: throw new Exception( "NIMC_outOfEventsErrorInternal error. The number of events pending have reached the maximum allowed." ); case 105: throw new Exception( "NIMC_availableForUse105None" ); case 106: throw new Exception( "NIMC_outputDeviceNotAssignedErrorNo DAC or stepper output is assigned to this axis." ); case 107: throw new Exception( "NIMC_availableForUse107None" ); case 108: throw new Exception( "NIMC_PIDUpdateRateErrorPID rate specified is too fast for the number of axes and/or encoders enabled." ); case 109: throw new Exception( "NIMC_feedbackDeviceNotAssignedErrorNo primary feedback device (encoder or ADC) is assigned to a servo or closed-loop stepper axis." ); case 110: throw new Exception( "NIMC_reserved110ErrorNone - was duplicate - same as 106 -NIMC_outputDeviceNotAssignedError" ); case 111: throw new Exception( "NIMC_availableForUse111None" ); case 112: throw new Exception( "NIMC_availableForUse112None" ); case 113: throw new Exception( "NIMC_noMoreRAMErrorNo RAM available for object (program or buffer) storage." ); case 114: throw new Exception( "NIMC_reserved114ErrorWas NIMC_nestedProgramError." ); case 115: throw new Exception( "NIMC_jumpToInvalidLabelErrorA Jump to Label on Condition function in a program had an invalid label." ); case 116: throw new Exception( "NIMC_invalidConditionCodeErrorCondition selected is invalid." ); case 117: throw new Exception( "NIMC_homeLimitNotEnabledErrorFind Home function cannot execute because the Home and/or Limit inputs are not enabled." ); case 118: throw new Exception( "NIMC_findHomeErrorFind home was not successful because the motor stopped before the find home switch was found." ); case 119: throw new Exception( "NIMC_limitSwitchActiveErrorThe desired move cannot be completed because the limit input is active in the direction of travel." ); case 120: throw new Exception( "NIMC_availableForUse120None" ); case 121: throw new Exception( "NIMC_positionRangeErrorAbsolute target position loaded would cause the move length to be out of the +/-31 bit range allowed for a single move segment." ); case 122: throw new Exception( "NIMC_encoderDisabledErrorThe encoder is disabled. The encoder must be enabled to read it." ); case 123: throw new Exception( "NIMC_moduloBreakpointErrorThe breakpoint value loaded exceeds the modulo range." ); case 124: throw new Exception( "NIMC_findIndexErrorFind Index sequence did not find the index successfully." ); case 125: throw new Exception( "NIMC_wrongModeErrorThe function was not executed because it was attempted at an illegal time." ); case 126: throw new Exception( "NIMC_axisConfigurationErrorAn axis cannot be configured while enabled. Disable the axis and then configure it." ); case 127: throw new Exception( "NIMC_pointsTableFullErrorThe points table for cubic splining is full." ); case 128: throw new Exception( "NIMC_available128ErrorWas used for TABLE_ALLOC_ERROR but NIMC_noMoreRAMError should be used instead." ); case 129: throw new Exception( "NIMC_axisDisabledErrorA disabled axis has been commanded to move. Enable the axis before executing a move on it." ); case 130: throw new Exception( "NIMC_memoryRangeErrorAn invalid memory location is being addressed on the controller." ); case 131: throw new Exception( "NIMC_inPositionUpdateErrorInternal error. The axis position could not be read for in-position verification." ); case 132: throw new Exception( "NIMC_targetPositionUpdateErrorInternal error. The DSP was too busy to update the target position." ); case 133: throw new Exception( "NIMC_pointRequestMissingErrorInternal error. The internal points request buffer is missing a request." ); case 134: throw new Exception( "NIMC_internalSamplesMissingErrorInternal error. The internal samples buffer is missing samples." ); case 135: throw new Exception( "NIMC_reserved135ErrorWas NIMC_axisEnabledError" ); case 136: throw new Exception( "NIMC_eventTimeoutErrorA wait operation timed out or a read function timed out." ); case 137: throw new Exception( "NIMC_objectReferenceErrorAn attempt was made to reference a nonexistent program object or buffer object. Or, the object number is already in use by an object of a different type. Choose a different object number, or free/delete the object currently owning that object number." ); case 138: throw new Exception( "NIMC_outOfMemoryErrorNot enough FLASH ROM space to save this object (program or buffer)." ); case 139: throw new Exception( "NIMC_registryFullErrorObject registry is full. The number of programs and buffers has reached the limit. Free some programs or buffers from RAM or ROM using the Object Memory Management function." ); case 140: throw new Exception( "NIMC_noMoreProgramPlayerErrorAll program players (maximum 10) are in use storing/playing programs." ); case 141: throw new Exception( "NIMC_programOverruleErrorA Start, Blend, Find Home, or Find Index function being executed from an onboard program has been overruled by a Stop Motion function from the host computer. The program is left in the PAUSED state. Execute the Pause/Resume Program function to continue." ); case 142: throw new Exception( "NIMC_followingErrorOverruleErrorA Start, Blend, Find Home, or Find Index function being executed from an onboard program has been overruled due to a following error condition. The program is left in the PAUSED state. Execute the Pause/Resume Program function to continue." ); case 143: throw new Exception( "NIMC_reserved143ErrorNone - Was used for I/O interrupt stuck on condition." ); case 144: throw new Exception( "NIMC_illegalVariableErrorAn illegal general-purpose variable is being used." ); case 145: throw new Exception( "NIMC_illegalVectorSpaceErrorThe vector space being used does not have enough axes assigned to it." ); case 146: throw new Exception( "NIMC_noMoreSamplesErrorThere are no samples to read. Execute Acquire Trajectory Data before trying to read samples." ); case 147: throw new Exception( "NIMC_slaveAxisKilledErrorGearing cannot be enabled because the slave axis is in a killed state. Issue a halt stop or decel stop with the Stop Motion function on the slave axis to energize it." ); case 148: throw new Exception( "NIMC_ADCDisabledErrorThe ADC is disabled. The ADC channel must be enabled to read it." ); case 149: throw new Exception( "NIMC_operationModeErrorAxes that are a part of a vector space are either in velocity mode or have different operation modes." ); case 150: throw new Exception( "NIMC_followingErrorOnFindHomeErrorFind Home sequence did not find home successfully because the axis tripped on following error." ); case 151: throw new Exception( "NIMC_invalidVelocityErrorThe vector velocity is not valid. The resulting angular velocity is out of range. Change the vector velocity for the arc move." ); case 152: throw new Exception( "NIMC_invalidAccelerationErrorThe vector acceleration is not valid. The resulting angular acceleration is out of range. Change the vector acceleration for the arc move." ); case 153: throw new Exception( "NIMC_samplesBufferFullErrorInternal error. The internal samples buffer is full. " ); case 154: throw new Exception( "NIMC_illegalVectorErrorThe input or return vector being used is invalid." ); case 155: throw new Exception( "NIMC_QSPIFailedErrorInternal error. The internal QSPI serial bus failed and ADC values cannot be read." ); case 156: throw new Exception( "NIMC_reserved156ErrorNone - Duplicate - same as Error 27" ); case 157: throw new Exception( "NIMC_pointsBufferFullErrorInternal error. The internal point request buffer is full. " ); case 158: throw new Exception( "NIMC_axisInitializationErrorInternal Error. The internal axis data structures failed to initialize. Reset the controller and try again. If the problem persists, contact National Instruments technical support." ); case 159: throw new Exception( "NIMC_encoderInitializationErrorInternal Error. The internal encoder data structures failed to initialize. Reset the controller and try again. If the problem persists, contact National Instruments technical support." ); case 160: throw new Exception( "NIMC_stepChannelInitializationErrorInternal Error. The internal stepper output data structures failed to initialize. Reset the controller and try again. If the problem persists, contact National Instruments technical support." ); case 161: throw new Exception( "NIMC_blendFactorConflictErrorAxes, which are part of a vector space, have different blend factors. Make sure that all the axes in the vector space have the same blend factor." ); case 162: throw new Exception( "NIMC_torqueOffsetErrorThe torque offset is outside of the torque limit range." ); case 163: throw new Exception( "NIMC_invalidLimitRangeErrorThe negative (lower) limit is greater than or equal to the positive (upper) limit." ); case 164: throw new Exception( "NIMC_ADCConfigurationErrorADCs cannot be enabled or disabled while axes are enabled with analog feedback. Also, ADC ranges cannot be changed on ADC channels being used for analog feedback while axes are enabled." ); } throw new Exception( "Nastala chyba číslo " + status.ToString() + " v ovladači pohybu. Podrobnější informace o této chybě se dozvíte v sezanmu chybových kódů" ); } } }