VX7500 DLL — (vx7500lib.dll)

Functions

vx_error_t VX_Init(void)

VX_Init() must be called before any other function within the API.

Returns:

vx_error_t VX_End(void)

VX_End() must be called on exit of the application.

Returns:

vx_error_t VX_ComTest(uint32_t address, uint32_t* id, uint32_t* version, uint32_t* error_mask, uint32_t compile_date_time_len, char* compile_date_time)

Performs a communications test between the computer and the specified controller.

Inputs:

address - the address of the vx7500 controller. Valid address is in the range of 0 - 15.

compile_date_time_len - size of the compile_date_time array being passed.

Outputs:

id - returned id of the controller

version - returned version number of the controller firmware.

error_mask - returned error mask

compile_date_time - the returned string containing the compilation date and time of the controller firmware.

Returns:

Usage:

uint32_t address = 0;
uint32_t id;
uint32_t version;
uint32_t error_mask;
char compile_date_time[100];
vx_error_t error;

error = VX_ComTest(address, &id, &version, &error_mask, sizeof(compile_date_time), compile_date_time);

if (error == OK) {
        printf("%lu %lu 0x%08x %s\n", id, version, error_mask, compile_date_time);
}
else {
        printf("COMTEST error 0x%08x\n", error);
}
vx_error_t VX_Trigger(uint32_t address)

Inputs:

address - the address of the vx7500 controller. Valid address is in the range of 0 - 15.

Returns:

Usage:

uint32_t address = 0;
vx_error_t error;
uint32_t channel = 0;
const uint32_t num_samples = 1000;
bool wait_for_trigger = true;

error = VX_DaqStart(address, channel, num_samples, wait_for_trigger);
if ((error == OK) && wait_for_trigger) error = VX_Trigger(address);
vx_error_t VX_ReadVariable(uint32_t address, uint32_t chan_id, uint32_t variable_id, flex_t* value)

The function VX_ReadVariable() will read a variable from the controller. The variables are described in the Variable ID Definitions table.

Inputs:

address - the address of the vx7500 controller. Valid address is in the range of 0 - 15.

chan_id - the channel id. When the channel refers to a DAQ channel, then the chan_id is the daq channel id. When the channel refers to a MTR, then the chan_id is the motor is (0 - motor 1 and 1 - motor 2).

variable_id - the variable id. Refer to the Variable ID Definitions table for information on each variable.

Outputs:

value - returned value of type flex_t

Returns:

Usage:

uint32_t address = 0;
vx_error_t error;
uint32_t channel = 0;
double gain;
flex_t value;

error = VX_ReadVariable(address, channel, CONF_VAR_DAQ_GAIN, &value);
gain = value.d.double_v;
vx_error_t VX_WriteVariable(uint32_t address, uint32_t chan_id, uint32_t variable_id, flex_t value)

The function VX_WriteVariable() will write a variable to the controller. The variables are described in the Variable ID Definitions table.

Inputs:

address - the address of the vx7500 controller. Valid address is in the range of 0 - 15.

chan_id - the channel id. When the channel refers to a DAQ channel, then the chan_id is the daq channel id. When the channel refers to a MTR, then the chan_id is the motor is (0 - motor 1 and 1 - motor 2).

variable_id - the variable id. Refer to the Variable ID Definitions table for information on each variable.

value - writen value

Returns:

vx_error_t VX_DaqStart(uint32_t address, uint32_t channel, uint32_t samples, bool wait_for_trigger)

See Data Acquisition Channels

vx_error_t VX_DaqStop(uint32_t address, uint32_t channel)
vx_error_t VX_DaqSetFirCoefficients(uint32_t address, uint32_t channel, uint32_t number_of_coefs, double* coefs)
vx_error_t VX_DaqGetStatus(uint32_t address, uint32_t channel, uint32_t* samples_requested, uint32_t* samples_collected)
vx_error_t VX_DaqGetData(uint32_t address, uint32_t channel, uint32_t start_index, uint32_t number_of_samples, vx_sample_t* samples)
vx_error_t VX_MtrStart(uint32_t address, uint32_t channel, uint32_t num_accels, vx_accel_t* accels, bool wait_for_trigger)
vx_error_t VX_MtrStop(uint32_t address, uint32_t channel)
vx_error_t VX_MtrPower(uint32_t address, uint32_t channel, bool on)
vx_error_t VX_MtrMove(uint32_t address, uint32_t channel, double value)
vx_error_t VX_AoSetWaveform(uint32_t address, uint32_t channel, uint32_t num_entries, vx_wave_entry_t* entries, bool wait_for_trigger)

Inputs:

address - the address of the vx7500 controller. Valid address is in the range of 0 - 15.

channel - the channel id. 0 - AO1, 1 - AO2, 2 - AO3

num_entries - the number of entries in the entries table

entries - vx_wave_entry_t table containing time and output value

wait_for_trigger - true or false to wait for the trigger. false does not wait for trigger

Returns:

Usage:

vx_error_t error = OK;
vx_wave_entry_t wave_entries[2] = {{1.0, 0.1},{2.0, 0.0}};

// execute the voltage ramp
if (error == OK) error = VX_ao_set_waveform(address, 0, 2, wave_entries_rampup, false);

Types

vx_error_t
typedef uint32_t vx_error_t;

Error codes are defined in Return Error Codes.

vx_sample_t
typedef int16_t vx_sample_t;
vx_accel_t
typedef struct  {
        double time;
        double value;
        uint32_t options;
} vx_accel_t;
vx_wave_entry_t
typedef struct
{
        double time;
        double value;
} vx_wave_entry_t;
flex_t
typedef struct {

        uint32_t data_type;
        union {
                double          double_v;
                uint32_t        uint32_v;
                uint64_t        uint64_v;
                int32_t         int32_v;
                int64_t         int64_v;
        } d;
} flex_t;
VXLIB_API
#define VXLIB_API __declspec(dllimport)

Return Error Codes

Name Value Description
OK 0 No error
ERROR_UNKNOWN 1001 An unknwon error occurred
ERROR_NOT_IMPLEMENTED 1002 This feature is not currently implemented
ERROR_INVALID_CHANNEL 1003 An invalid channel was selected
ERROR_DAQ_BUFFER_TOO_SMALL 1004 The buffer is too small for the available data
ERROR_DAQ_RESEND 1005 A packet was lost and is being resent
ERROR_RESPONSE_TIMEOUT 1006 Timeout on communication
ERROR_BAD_RESPONSE 1007 Received a bad response from the controller
ERROR_INVALID_ATTRIBUTE 1008 Attribute does not exist
ERROR_CALCULATION_ERROR 1009  
ERROR_BAD_PARAM 1010  
ERROR_CONNECTION 1011 A connection error occurred
ERROR_NO_CALIBRATION_SIGNAL 1012 Invalid calibration, system may need to be recalibrated
ERROR_BAD_CALIBRATION_CALC 1013  
ERROR_THIRTYSEVENCOEFS 1014 Invalid number of coefficients, 37 required

Variable ID Definitions

Name ID (hex) Description
MTR_VAR_KP 0x10001  
MTR_VAR_KI 0x10002  
MTR_VAR_KD 0x10003  
MTR_VAR_ILIM 0x10004  
MTR_VAR_COMWAITTIME 0x10005  
MTR_VAR_COMCURRENT 0x10006 Commutation current [1]
MTR_VAR_MAXCURRENT 0x10007 Maximum current [1]
MTR_VAR_OPENLOOPDRIVECURRENT 0x10008 Open loop drive current [1]
MTR_VAR_MAXPOSERROR 0x10009  
MTR_VAR_STEPSPERROTATION 0x1000a  
MTR_VAR_PHASES 0x1000b  
MTR_VAR_POLES 0x1000c  
MTR_VAR_TYPE 0x1000d  
MTR_VAR_MOVETYPE 0x1000e  
MTR_VAR_ENCCOUNTSPERROTATION 0x1000f  
MTR_VAR_WASRESET 0x10010  
MTR_VAR_FINETUNEOFFSET 0x10011  
MTR_VAR_GEN_EVENT_TYPE 0x10012  
MTR_VAR_GEN_EVENT_VALUE 0x10013  
MTR_VAR_RCV_EVENT_START_ENABLE 0x10014  
MTR_VAR_RCV_EVENT_CAPTURE_ENABLE 0x10015  
MTR_VAR_RCV_EVENT_VALID 0x10016  
MTR_VAR_RCV_EVENT_VAL 0x10017  
MTR_VAR_POS_ERROR 0x10018  
MTR_VAR_PID_OUTPUT 0x10019 RO, PID output current [1]
MTR_VAR_DAC_OUTPUT_A 0x1001a RO, DAC output phase A current [1]
MTR_VAR_DAC_OUTPUT_B 0x1001b RO, DAC output phase B current [1]
MTR_VAR_ELECCYCLETIME 0x1001c  
MTR_VAR_ERROR_FLAGS 0x1001d bitwise {0x00000000: none, 0x00000001: position error, 0x00000002: over temp}
DAQ_VAR_ENABLE_FILTER 0x20001  
DAQ_VAR_PGA_GAIN 0x20002 See PGA Gain Settings for HSAI1 and HSAI2.
DAQ_VAR_LASTSAMPLEAVG 0x20003  
DAQ_VAR_SWITCH_CHANNEL 0x20004  
DAQ_VAR_LASTSAMPLEMAX 0x20005  
DAQ_VAR_EVENT_TRIGGER_THRESHOLD 0x20006  
DAQ_VAR_EVENT_TRIGGER_ENABLE 0x20007  
DO_VAR_POLARITY 0x30001  
DO_VAR_TRIGGER_TYPE 0x30002  
AO_VAR_DAC 0x40001  
AO_VAR_VOLTAGE 0x40002  
AO_VAR_CURRENT 0x40003  
AO_VAR_RESISTANCE 0x40004  
AO_VAR_POWER 0x40005  
AO_VAR_WAVESTATE 0x40006  
AO_VAR_TRIGGER_OFF_ENABLE 0x40007  
CONF_VAR_AO_GAIN 0x50001  
CONF_VAR_AO_OFFSET 0x50002  
CONF_VAR_DAQ_GAIN 0x50003  
CONF_VAR_DAQ_OFFSET 0x50004  
CONF_VAR_FLASH_VALID 0x50005  
[1](1, 2, 3, 4, 5, 6) 1 amp = 18000 counts

PGA Gain Settings for HSAI1 and HSAI2

The input hardware gain for channels HSAI1 and HSAI2 can be set with DAQ_VAR_PGA_GAIN.

Set Value PGA Gain (V/V) PGA Gain (dB) Input Range (V)
0 0.08 -22 ± 5.0 [2]
1 0.16 -16 ± 5.0 [2]
2 0.32 -10 ± 5.0 [2]
3 0.63 -4 ± 3.25
4 [3] 1.26 2 ± 1.625
5 2.52 8 ± 0.813
6 5.01 14 ± 0.4088
7 10.0 20 ± 0.2048
[2](1, 2, 3) The maximum voltage range input for the HSAI1 and HSAI2 channels is ± 5.0 volts. This is true even when the input gain is negative dB.
[3]Default value is 4, with a gain of 1.26 (V/V)