Eppley Institute for Cancer Research

University of Nebraska Medical Center

Home - Introduction - Common Tasks - Index - About

Motion Controller API

Each motion controller module will occupy its own dll.  The functions must be named as indicated and compiled with the standard "C" calling convention and exported.  The DLL should look in directory labeled XML where the exe is located to load default values.  If none exists it should create one there.  If the user passes an XML with defaults it should use those instead.  __declspec(dllexport) is how borland builder determines if a function is exported by a DLL file.

Functions

extern "C" __declspec(dllexport)  int initcontrolsystem(jl_xml_element* initsettings=NULL);

Called when the control system DLL is loaded into memory of selected from the list of available control systems.

extern "C" __declspec(dllexport)  jl_xml_element* settings(void);

Returns the current settings as an XML element.

extern "C" __declspec(dllexport)  char* getxmltype(void);

Returns type of positioner.

extern "C" __declspec(dllexport)  int stopcontrolsystem(void);

Called when the DLL is removed from memory.

extern "C" __declspec(dllexport)  int home(int Type=0);

Move all motors to the home positions.  If type = 0 may ask interactive questions to the user.  If type = 1 then re-find zero positions by encountering limits etc then go to home.  If type = 2 just go to current settings of home.

extern "C" __declspec(dllexport)  int setupandtestcontrolsystem(void);

Should display a dialog box that allows the user to setup and test the control system.  This function is called when the user selects "Setup and Test Detector Positioner" from the Motion menu.

extern "C" __declspec(dllexport)  int emergencystop(void);

Software emergency stop.  Stop all of the motors as soon as possible.  Interrupting any currently executing commands.

extern "C" __declspec(dllexport)  int resetemergencystop(void);

Reset the control system after the emergency stop.  May require re homing the motors.

extern "C" __declspec(dllexport)  int status(void);

Return the status of the motion controller.  Return a value indicating the health of the motion control system.

extern "C" __declspec(dllexport)  int index_x(int x_microns);

Move x_microns relative to the current position.  Return a command id.

extern "C" __declspec(dllexport)  int abs_x(int x_microns);

Move to absolute position x_microns.  Return a command id.

extern "C" __declspec(dllexport)  int limits_x(int &x_max_microns,int &x_min_microns);

Set the absolute limits in the x direction.

extern "C" __declspec(dllexport)  int index_y(int y_microns);

Move y_microns relative to the current position.  Return a command id.

extern "C" __declspec(dllexport)  int abs_y(int y_microns);

Move to absolute position y_microns.  Return a command id.

extern "C" __declspec(dllexport)  int limits_y(int &y_max_microns,int &y_min_microns);

Set the absolute limits in the y direction.

extern "C" __declspec(dllexport)  int index_xyz(int x_microns=0, int y_microns=0, int z_microns=0);

Move multiple motors at the same time relative to current positions.  Return a command id.

extern "C" __declspec(dllexport)  int abs_xyz(int x_microns=0, int y_microns=0, int z_microns=0);

Move multiple motors at the same time to an absolute position.  Return a command id.

extern "C" __declspec(dllexport)  int abs_position_x(void);

Return the current position of motor x.

extern "C" __declspec(dllexport)  int abs_position_y(void);

Return the current position of motor y.

extern "C" __declspec(dllexport)  char* id_description(int AReturnCode);

Return a test message base on current status.

extern "C" __declspec(dllexport)  char* menustring(void);

Return a string used to describe the motion controller in the motion menu.

extern "C" __declspec(dllexport)  char* dlldescription(void);


extern "C" __declspec(dllexport)  int commandstatus(int CommandId);

Return the status for a movement command.

extern "C" __declspec(dllexport)  int update_status(int WaitForCompletion=0);

Update the status and determine whether to wait for the update or return immediately.

extern "C" __declspec(dllexport)  jl_xml_element* getcontrollerxmlsettings(void);

Get the xml element containing the current settings.

extern "C" __declspec(dllexport)  jl_xml_element* setcontrollerxmlsettings(jl_xml_element* newsettings);

Update the settings xml element to the new settings and apply these values to the controller.