liblabpro
Portable C library for data collection from Vernier LabPro devices
|
Functions | |
int | LabPro_send_raw (LabPro *labpro, char *command, int *length_transferred) |
Send a raw command to the LabPro. More... | |
int | LabPro_read_raw (LabPro *labpro, char **string, int *length) |
Read raw bytes from the LabPro. More... | |
int | LabPro_trim_response (char *string) |
Trim trailing junk that the LabPro sent Since the LabPro always returns data in multiples of 64 bytes, the last packet is likely to contain junk following the actual data. This replaces the trailing carriage return character with a NULL character. More... | |
Operations for analog channels.
Enumerator | |
---|---|
LABPRO_CHANOP_OFF | Turn the channel off. |
LABPRO_CHANOP_AUTOID | Auto-ID the sensor; units can be fetched from the sensor's description. |
LABPRO_CHANOP_VOLTAGE10V | Range from -10 V to +10 V. |
LABPRO_CHANOP_CURRENT10A | Presumably 0 Amps to 10 Amps. |
LABPRO_CHANOP_RESISTANCE | Measure resistance. |
LABPRO_CHANOP_VOLTAGE10V_PERIOD | Measure the signal period on a ±10 V signal. Channel 1 only. |
LABPRO_CHANOP_VOLTAGE10V_FREQUENCY | Measure the signal frequency on a ±10 V signal. Channel 1 only. |
LABPRO_CHANOP_VOLTAGE10V_TRANSITIONS_COUNT | Count signal transitions on a ±10 V signal. Channel 1 only. |
LABPRO_CHANOP_TI_TEMP_C | Measure temperature (Celsius) from the TI Temperature probe This is for measuring temperature in Celsius from the Texas Instruments Stainless Steel Temperature Probe. The CBL2 technical reference manual states that this probe supports Auto-ID, so I'm not sure what the purpose of this setting is. Maybe early revisions of the sensor didn't auto-ID...? |
LABPRO_CHANOP_TI_TEMP_F | Measure temperature (Fahrenheit) from the TI Temperature probe This is for measuring temperature in Fahrenheit from the Texas Instruments Stainless Steel Temperature Probe. The CBL2 technical reference manual states that this probe supports Auto-ID, so I'm not sure what the purpose of this setting is. Maybe early revisions of the sensor didn't auto-ID...? |
LABPRO_CHANOP_TI_LIGHT | Measure light from the TI Light Sensor This is for the Texas Instruments light sensor. (I think) it causes the LabPro to return units of milliwatts per square centimeter, since that is what the CBL2 technical manual says its units are. However, it also states that this sensor Auto-IDs, so I'm not sure this is necessary. |
LABPRO_CHANOP_VOLTAGE_ZERO_TO_FIVE | Higher-precision voltage measurement I assume this is just like the ±10 V measurement, but more precise due to the smaller range. |
Definition at line 130 of file liblabpro.h.
Post-processing performed on analog data. As with data collection from sonic channels, please calculate the derivatives in your application rather than making the LabPro compute them. The extra computations will raise the temperature of the LabPro and make its readings less accurate.
Definition at line 208 of file liblabpro.h.
enum LabPro_Commands |
Commands that can be sent to the LabPro.
Enumerator | |
---|---|
LABPRO_RESET | Clear RAM and reset the LabPro. |
LABPRO_CHANNEL_SETUP | Select channels and units for data collection. |
LABPRO_DATACOLLECT_SETUP | Set data collection rate and time, etc. |
LABPRO_CONVERSION_EQN_SETUP | Set up a manual conversion equation rather than one obtained by Auto-ID. |
LABPRO_DATA_CTL | Set parameters for what data points will be returned. |
LABPRO_SYS_SETUP | Set various settings for the LabPro itself. |
LABPRO_SYS_STATUS | |
LABPRO_CHAN_STATUS | Get a data point during non-realtime collection. |
LABPRO_REQUEST_CHAN_DATA | Get a single point of data outside of active data collection. |
LABPRO_ADVANCED_DATA_REDUCTION | |
LABPRO_DIGITAL_DATA_CAPTURE | |
LABPRO_QUERY_CHANNELS | Return sensor IDs for each channel |
LABPRO_PORT_POWER_CTL | |
LABPRO_REQUEST_SETUP_INFO | |
LABPRO_REQUEST_LONG_SENSOR_NAME | |
LABPRO_REQUEST_SHORT_SENSOR_NAME | |
LABPRO_ARCHIVE | |
LABPRO_ANALOG_OUT_SETUP | |
LABPRO_LED_CTL | |
LABPRO_SOUND_CTL | |
LABPRO_DIGITAL_OUT_CTL |
Definition at line 59 of file liblabpro.h.
Sampling modes.
Enumerator | |
---|---|
LABPRO_SAMPMODE_NON_REALTIME | Have the LabPro store all the datapoints in RAM and wait for a "get" command to transfer them. |
LABPRO_SAMPMODE_REALTIME | Have the LabPro send datapoints as they're collected without storing them. |
Definition at line 219 of file liblabpro.h.
Operations for sonic channels.
Enumerator | |
---|---|
LABPRO_CHANOP_RESET | |
LABPRO_DISTANCE_AND_DT_METERS | Return distance in meters and change in time since last measurement Fun fact: the manual states that sending a 2 will do the same thing. |
LABPRO_DISTANCE_AND_DT_FEET | Return distance in feet and change in time since last measurement. |
LABPRO_DISTANCE_VELOCITY_AND_DT_METERS | Return distance in meters, velocity in m/s, and delta t. If used with non-real-time mode sampling, this is the same as LABPRO_DISTANCE_AND_DT_METERS. It may be tempting to use this in your application and make the LabPro do the extra work, but please don't. The extra computations will mean the LabPro heats up more and loses accuracy. |
LABPRO_DISTANCE_VELOCITY_AND_DT_FEET | See LABPRO_DISTANCE_VELOCITY_AND_DT_METERS. |
LABPRO_DISTANCE_VELOCITY_ACCEL_AND_DT_METERS | Return distance, velocity, and acceleration in m, m/s, and m/(s^2), plus delta t. If used with non-real-time mode sampling, this is the same as LABPRO_DISTANCE_AND_DT_METERS. It may be tempting to use this in your application and make the LabPro do the extra work, but please don't. The extra computations will mean the LabPro heats up more and loses accuracy. |
LABPRO_DISTANCE_VELOCITY_ACCEL_AND_DT_FEET | See LABPRO_DISTANCE_VELOCITY_ACCEL_AND_DT_METERS. |
Definition at line 177 of file liblabpro.h.
int LabPro_read_raw | ( | LabPro * | labpro, |
char ** | string, | ||
int * | length | ||
) |
Read raw bytes from the LabPro.
This is for internal or console purposes; you shouldn't need to use it. It reads as many bytes as possible from the LabPro, then returns the string. If there is trailing garbage due to the LabPro's response not being a multiple of 64 bytes (the LabPro's USB packet size), it is NOT stripped (see LabPro_trim_response() for that purpose). If this function encounters six errors from libusb, it will assume that there is something wrong and abort with an error code from LabPro_USB_Errors.
Even if this function returns LABPRO_ERR_NO_MEM, some of the data may have been transferred, because this function calls realloc() after each 64-byte packet.
labpro | The LabPro to read from |
string | Pointer to char array that will hold the data |
length | The number of bytes that were read. This will always be a multiple of 64. Maybe useful if you're requesting binary sample data. |
Definition at line 281 of file liblabpro.c.
int LabPro_send_raw | ( | LabPro * | labpro, |
char * | command, | ||
int * | length_transferred | ||
) |
Send a raw command to the LabPro.
This is for internal or console purposes; you shouldn't need to use it. It sends the string specified by command directly to the LabPro, only modifying it by adding a trailing carriage return (CR) character. It does not check whether the LabPro is busy. It should not be used for anything but text data, because it uses string functions to get the length of the command string.
The memory pointed to by command
is not freed by this function.
labpro | The LabPro to write to |
command | Full command string to send to the LabPro |
length_transferred | The actual bytes transferred (in case an error occurs) |
Definition at line 225 of file liblabpro.c.
int LabPro_trim_response | ( | char * | string | ) |
Trim trailing junk that the LabPro sent Since the LabPro always returns data in multiples of 64 bytes, the last packet is likely to contain junk following the actual data. This replaces the trailing carriage return character with a NULL character.
string | The string to trim |
Definition at line 350 of file liblabpro.c.