org.lsst.ccs.drivers.mcc
Class MccUsb

java.lang.Object
  extended by org.lsst.ccs.drivers.mcc.MccUsb
Direct Known Subclasses:
MccTc, MccTcAi, MccTemp

public class MccUsb
extends Object

Enables access to a Measurement Computing data acquisition device

Author:
Owen Saxton

Field Summary
static int CEX_10UA
          Current excitation - 10 microamps
static int CEX_210UA
          Current excitation - 210 microamps
static int CEX_OFF
          Current excitation - off
static int CIT_ADC_0
          Configuration item - ADC 0
static int CIT_ADC_1
          Configuration item - ADC 1
static int CIT_ADC_2
          Configuration item - ADC 2
static int CIT_ADC_3
          Configuration item - ADC 3
static int CSI_CH_0_COEF_0
          Config subitem - Channel 0 coefficient 0
static int CSI_CH_0_COEF_1
          Config subitem - Channel 0 coefficient 1
static int CSI_CH_0_COEF_2
          Config subitem - Channel 0 coefficient 2
static int CSI_CH_0_COEF_3
          Config subitem - Channel 0 coefficient 3
static int CSI_CH_0_GAIN
          Config subitem - Channel 0 gain value
static int CSI_CH_0_TC
          Config subitem - Thermocouple type for channel 0
static int CSI_CH_0_VCONN
          Config subitem - Input type for ADC 2&3 channel 0
static int CSI_CH_1_COEF_0
          Config subitem - Channel 1 coefficient 0
static int CSI_CH_1_COEF_1
          Config subitem - Channel 1 coefficient 1
static int CSI_CH_1_COEF_2
          Config subitem - Channel 1 coefficient 2
static int CSI_CH_1_COEF_3
          Config subitem - Channel 1 coefficient 3
static int CSI_CH_1_GAIN
          Config subitem - Channel 1 gain value
static int CSI_CH_1_TC
          Config subitem - Thermocouple type for channel 1
static int CSI_CH_1_VCONN
          Config subitem - Input type for ADC 2&3 channel 1
static int CSI_CONN_TYPE
          Config subitem - Connection type for RTD & Thermistor Sensors
static int CSI_EXCITATION
          Config subitem - Current excitation
static int CSI_FILTER_RATE
          Config subitem - Filter update rate
static int CSI_I_VALUE_0
          Config subitem - Measured I value @ 10uA
static int CSI_I_VALUE_1
          Config subitem - Measured I value @ 210uA
static int CSI_I_VALUE_2
          Config subitem - Measured I value @ 10uA (3 wire conn)
static int CSI_SENSOR_TYPE
          Config subitem - Connected sensor type
static int CSI_V_VALUE_0
          Config subitem - Measured V value @ 10uA
static int CSI_V_VALUE_1
          Config subitem - Measured V value @ 210uA
static int CSI_V_VALUE_2
          Config subitem - Measured V value @ 210uA (3 wire conn)
static int CSI_VREF
          Config subitem - Measured Vref value
static int FREQ_10_HZ
          Filter rate - 10 Hz
static int FREQ_12_5_HZ
          Filter rate - 12.5 Hz
static int FREQ_125_HZ
          Filter rate - 125 Hz
static int FREQ_16_7_HZ
          Filter rate - 16.7 Hz
static int FREQ_19_6_HZ
          Filter rate - 19.6 Hz
static int FREQ_250_HZ
          Filter rate - 250 Hz
static int FREQ_33_3_HZ
          Filter rate - 33.3 Hz
static int FREQ_39_2_HZ
          Filter rate - 39.2 Hz
static int FREQ_4_17_HZ
          Filter rate - 4.17 Hz
static int FREQ_50_HZ
          Filter rate - 50 Hz
static int FREQ_500_HZ
          Filter rate - 500 Hz
static int FREQ_6_25_HZ
          Filter rate - 6.25 Hz
static int FREQ_62_5_HZ
          Filter rate - 62.5 Hz
static int FREQ_8_33_HZ
          Filter rate - 8.33 Hz
static int GAIN_128X
          Gain - 128X
static int GAIN_16X
          Gain - 16X
static int GAIN_1X
          Gain - 1X
static int GAIN_2X
          Gain - 2X
static int GAIN_32X
          Gain - 32X
static int GAIN_4X
          Gain - 4X
static int GAIN_64X
          Gain - 64X
static int GAIN_8X
          Gain - 8X
static int RANGE_1_25V
          Voltage range +/- 1.25V
static int RANGE_10V
          Voltage range +/- 10V
static int RANGE_2_5V
          Voltage range +/- 2.5V
static int RANGE_5V
          Voltage range +/- 5V
static int STP_DISABLED
          Sensor type - Disabled
static int STP_RTD
          Sensor type - RTD
static int STP_SEMICONDUCTOR
          Sensor type - Semiconductor
static int STP_THERMISTOR
          Sensor type - Thermistor
static int STP_THERMOCOUPLE
          Sensor type - Thermocouple
static int STP_VOLTAGE
          Sensor type - Voltage
static int TC_TYPE_B
          Thermocouple type B
static int TC_TYPE_E
          Thermocouple type E
static int TC_TYPE_J
          Thermocouple type J
static int TC_TYPE_K
          Thermocouple type K
static int TC_TYPE_N
          Thermocouple type N
static int TC_TYPE_R
          Thermocouple type R
static int TC_TYPE_S
          Thermocouple type S
static int TC_TYPE_T
          Thermocouple type T
static int TCT_2WIRE_1SENSOR
          Therm connection - two wire, one sensor
static int TCT_2WIRE_2SENSOR
          Therm connection - two wire, two sensors
static int TCT_3WIRE
          Therm connection - three wire
static int TCT_4WIRE
          Therm connection - four wire
static int USB_TC_AI_DID
          The USB-TC-AI DAQ device
static int USB_TC_DID
          The USB-TC DAQ device
static int USB_TEMP_DID
          The USB-TEMP DAQ device
static int VCT_CALIBRATION
          Voltage connection - calibration
static int VCT_DIFFERENTIAL
          Voltage connection - differential
static int VCT_GROUNDED
          Voltage connection - grounded
static int VCT_SINGLE_ENDED
          Voltage connection - single-ended
 
Constructor Summary
MccUsb()
          Constructor
 
Method Summary
 float adcIn(int chan, int units)
          Reads an ADC channel
 int adcScan(int start, int end, int units, float[] value)
          Scans ADC channels
 void blink()
          Blinks the LED
 void calConfig(int gain, int polarity, int path)
          Configures the calibration MUX
 void calibrate(int type)
          Calibrates the ADC channels
 void calSteps(int[] steps)
          Gets the number of calibration steps
 void close()
          Closes the connection to the device
 void cntrInit()
          Initializes the event counter (sets it to zero)
 int cntrRead()
          Reads the event counter
 void configAlarm(int alarm, int iOptns, int oOptns, float value1, float value2)
          Configures an alarm
 void dioConfig(int direction)
          Configures the DIO port
 void dioConfigBit(int bitno, int direction)
          Configures one DIO line
 int dioIn()
          Reads all the DIO lines
 int dioInBit(int bitno)
          Reads one DIO line
 void dioOut(int value)
          Writes all the DIO lines
 void dioOutBit(int bitno, int value)
          Writes one DIO line
 void getAlarmConfig(int alarm, int[] optns, float[] values)
          Gets an alarm configuration
 int getBurnout(int mask)
          Gets the burnout status and clears it under a mask
 float getCoefficient(int chan, int coeff)
          Gets a channel's coefficient
 int getDevId()
          Gets the device ID
 int getExcitation(int chan)
          Gets a channel pair's current excitation
 int getFilterRate(int chan)
          Gets a channel pair's filter update rate
 int getGain(int chan)
          Gets a channel's gain
 float getItem(int item, int subItem)
          Gets a configuration item
 float getReferenceVoltage(int chan)
          Gets a channel pair's reference voltage
 int getSensorType(int chan)
          Gets a channel pair's sensor type
 int getStatus()
          Gets the calibration status
 int getTCType(int chan)
          Gets a channel's thermocouple type
 int getThermConnType(int chan)
          Gets a thermistor or RTD channel pair's connection type
 org.lsst.ccs.drivers.usb.UsbComm getUsbComm()
          Gets the USB communication object
 int getVoltageConnType(int chan)
          Gets a voltage channel's connection type
 void open(int did, String serial, boolean force)
          Opens a connection to the device
 void prepareDownload(int code, int micro)
          Prepares for a download
 int readCode(int addr, int count, byte[] data)
          Reads firmware code
 int readMemory(int addr, int type, int count, byte[] data)
          Reads device memory
 void reset()
          Resets the device
 void setCoefficient(int chan, int coeff, float value)
          Sets a channel's coefficient
 void setExcitation(int chan, int value)
          Sets a channel pair's current excitation
 void setGain(int chan, int gain)
          Sets a channel's gain
 void setItem(int item, int subItem, float value)
          Sets a configuration item
 void setSensorType(int chan, int type)
          Sets a channel pair's sensor type
 void setTCType(int chan, int type)
          Sets a channel's thermocouple type
 void setThermConnType(int chan, int type)
          Sets a thermistor or RTD channel pair's connection type
 void setVoltageConnType(int chan, int type)
          Sets a voltage channel's connection type
 void writeCode(int addr, int count, byte[] data)
          Writes firmware code
 int writeMemory(int addr, int type, int count, byte[] data)
          Writes device memory
 void writeSerial(String serial)
          Writes the serial number
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USB_TC_AI_DID

public static final int USB_TC_AI_DID
The USB-TC-AI DAQ device

See Also:
Constant Field Values

USB_TC_DID

public static final int USB_TC_DID
The USB-TC DAQ device

See Also:
Constant Field Values

USB_TEMP_DID

public static final int USB_TEMP_DID
The USB-TEMP DAQ device

See Also:
Constant Field Values

CIT_ADC_0

public static final int CIT_ADC_0
Configuration item - ADC 0

See Also:
Constant Field Values

CIT_ADC_1

public static final int CIT_ADC_1
Configuration item - ADC 1

See Also:
Constant Field Values

CIT_ADC_2

public static final int CIT_ADC_2
Configuration item - ADC 2

See Also:
Constant Field Values

CIT_ADC_3

public static final int CIT_ADC_3
Configuration item - ADC 3

See Also:
Constant Field Values

CSI_SENSOR_TYPE

public static final int CSI_SENSOR_TYPE
Config subitem - Connected sensor type

See Also:
Constant Field Values

CSI_CONN_TYPE

public static final int CSI_CONN_TYPE
Config subitem - Connection type for RTD & Thermistor Sensors

See Also:
Constant Field Values

CSI_FILTER_RATE

public static final int CSI_FILTER_RATE
Config subitem - Filter update rate

See Also:
Constant Field Values

CSI_EXCITATION

public static final int CSI_EXCITATION
Config subitem - Current excitation

See Also:
Constant Field Values

CSI_VREF

public static final int CSI_VREF
Config subitem - Measured Vref value

See Also:
Constant Field Values

CSI_I_VALUE_0

public static final int CSI_I_VALUE_0
Config subitem - Measured I value @ 10uA

See Also:
Constant Field Values

CSI_I_VALUE_1

public static final int CSI_I_VALUE_1
Config subitem - Measured I value @ 210uA

See Also:
Constant Field Values

CSI_I_VALUE_2

public static final int CSI_I_VALUE_2
Config subitem - Measured I value @ 10uA (3 wire conn)

See Also:
Constant Field Values

CSI_V_VALUE_0

public static final int CSI_V_VALUE_0
Config subitem - Measured V value @ 10uA

See Also:
Constant Field Values

CSI_V_VALUE_1

public static final int CSI_V_VALUE_1
Config subitem - Measured V value @ 210uA

See Also:
Constant Field Values

CSI_V_VALUE_2

public static final int CSI_V_VALUE_2
Config subitem - Measured V value @ 210uA (3 wire conn)

See Also:
Constant Field Values

CSI_CH_0_TC

public static final int CSI_CH_0_TC
Config subitem - Thermocouple type for channel 0

See Also:
Constant Field Values

CSI_CH_1_TC

public static final int CSI_CH_1_TC
Config subitem - Thermocouple type for channel 1

See Also:
Constant Field Values

CSI_CH_0_GAIN

public static final int CSI_CH_0_GAIN
Config subitem - Channel 0 gain value

See Also:
Constant Field Values

CSI_CH_1_GAIN

public static final int CSI_CH_1_GAIN
Config subitem - Channel 1 gain value

See Also:
Constant Field Values

CSI_CH_0_COEF_0

public static final int CSI_CH_0_COEF_0
Config subitem - Channel 0 coefficient 0

See Also:
Constant Field Values

CSI_CH_1_COEF_0

public static final int CSI_CH_1_COEF_0
Config subitem - Channel 1 coefficient 0

See Also:
Constant Field Values

CSI_CH_0_COEF_1

public static final int CSI_CH_0_COEF_1
Config subitem - Channel 0 coefficient 1

See Also:
Constant Field Values

CSI_CH_1_COEF_1

public static final int CSI_CH_1_COEF_1
Config subitem - Channel 1 coefficient 1

See Also:
Constant Field Values

CSI_CH_0_COEF_2

public static final int CSI_CH_0_COEF_2
Config subitem - Channel 0 coefficient 2

See Also:
Constant Field Values

CSI_CH_1_COEF_2

public static final int CSI_CH_1_COEF_2
Config subitem - Channel 1 coefficient 2

See Also:
Constant Field Values

CSI_CH_0_COEF_3

public static final int CSI_CH_0_COEF_3
Config subitem - Channel 0 coefficient 3

See Also:
Constant Field Values

CSI_CH_1_COEF_3

public static final int CSI_CH_1_COEF_3
Config subitem - Channel 1 coefficient 3

See Also:
Constant Field Values

CSI_CH_0_VCONN

public static final int CSI_CH_0_VCONN
Config subitem - Input type for ADC 2&3 channel 0

See Also:
Constant Field Values

CSI_CH_1_VCONN

public static final int CSI_CH_1_VCONN
Config subitem - Input type for ADC 2&3 channel 1

See Also:
Constant Field Values

STP_RTD

public static final int STP_RTD
Sensor type - RTD

See Also:
Constant Field Values

STP_THERMISTOR

public static final int STP_THERMISTOR
Sensor type - Thermistor

See Also:
Constant Field Values

STP_THERMOCOUPLE

public static final int STP_THERMOCOUPLE
Sensor type - Thermocouple

See Also:
Constant Field Values

STP_SEMICONDUCTOR

public static final int STP_SEMICONDUCTOR
Sensor type - Semiconductor

See Also:
Constant Field Values

STP_DISABLED

public static final int STP_DISABLED
Sensor type - Disabled

See Also:
Constant Field Values

STP_VOLTAGE

public static final int STP_VOLTAGE
Sensor type - Voltage

See Also:
Constant Field Values

FREQ_500_HZ

public static final int FREQ_500_HZ
Filter rate - 500 Hz

See Also:
Constant Field Values

FREQ_250_HZ

public static final int FREQ_250_HZ
Filter rate - 250 Hz

See Also:
Constant Field Values

FREQ_125_HZ

public static final int FREQ_125_HZ
Filter rate - 125 Hz

See Also:
Constant Field Values

FREQ_62_5_HZ

public static final int FREQ_62_5_HZ
Filter rate - 62.5 Hz

See Also:
Constant Field Values

FREQ_50_HZ

public static final int FREQ_50_HZ
Filter rate - 50 Hz

See Also:
Constant Field Values

FREQ_39_2_HZ

public static final int FREQ_39_2_HZ
Filter rate - 39.2 Hz

See Also:
Constant Field Values

FREQ_33_3_HZ

public static final int FREQ_33_3_HZ
Filter rate - 33.3 Hz

See Also:
Constant Field Values

FREQ_19_6_HZ

public static final int FREQ_19_6_HZ
Filter rate - 19.6 Hz

See Also:
Constant Field Values

FREQ_16_7_HZ

public static final int FREQ_16_7_HZ
Filter rate - 16.7 Hz

See Also:
Constant Field Values

FREQ_12_5_HZ

public static final int FREQ_12_5_HZ
Filter rate - 12.5 Hz

See Also:
Constant Field Values

FREQ_10_HZ

public static final int FREQ_10_HZ
Filter rate - 10 Hz

See Also:
Constant Field Values

FREQ_8_33_HZ

public static final int FREQ_8_33_HZ
Filter rate - 8.33 Hz

See Also:
Constant Field Values

FREQ_6_25_HZ

public static final int FREQ_6_25_HZ
Filter rate - 6.25 Hz

See Also:
Constant Field Values

FREQ_4_17_HZ

public static final int FREQ_4_17_HZ
Filter rate - 4.17 Hz

See Also:
Constant Field Values

TC_TYPE_J

public static final int TC_TYPE_J
Thermocouple type J

See Also:
Constant Field Values

TC_TYPE_K

public static final int TC_TYPE_K
Thermocouple type K

See Also:
Constant Field Values

TC_TYPE_T

public static final int TC_TYPE_T
Thermocouple type T

See Also:
Constant Field Values

TC_TYPE_E

public static final int TC_TYPE_E
Thermocouple type E

See Also:
Constant Field Values

TC_TYPE_R

public static final int TC_TYPE_R
Thermocouple type R

See Also:
Constant Field Values

TC_TYPE_S

public static final int TC_TYPE_S
Thermocouple type S

See Also:
Constant Field Values

TC_TYPE_B

public static final int TC_TYPE_B
Thermocouple type B

See Also:
Constant Field Values

TC_TYPE_N

public static final int TC_TYPE_N
Thermocouple type N

See Also:
Constant Field Values

GAIN_1X

public static final int GAIN_1X
Gain - 1X

See Also:
Constant Field Values

GAIN_2X

public static final int GAIN_2X
Gain - 2X

See Also:
Constant Field Values

GAIN_4X

public static final int GAIN_4X
Gain - 4X

See Also:
Constant Field Values

GAIN_8X

public static final int GAIN_8X
Gain - 8X

See Also:
Constant Field Values

GAIN_16X

public static final int GAIN_16X
Gain - 16X

See Also:
Constant Field Values

GAIN_32X

public static final int GAIN_32X
Gain - 32X

See Also:
Constant Field Values

GAIN_64X

public static final int GAIN_64X
Gain - 64X

See Also:
Constant Field Values

GAIN_128X

public static final int GAIN_128X
Gain - 128X

See Also:
Constant Field Values

RANGE_10V

public static final int RANGE_10V
Voltage range +/- 10V

See Also:
Constant Field Values

RANGE_5V

public static final int RANGE_5V
Voltage range +/- 5V

See Also:
Constant Field Values

RANGE_2_5V

public static final int RANGE_2_5V
Voltage range +/- 2.5V

See Also:
Constant Field Values

RANGE_1_25V

public static final int RANGE_1_25V
Voltage range +/- 1.25V

See Also:
Constant Field Values

VCT_DIFFERENTIAL

public static final int VCT_DIFFERENTIAL
Voltage connection - differential

See Also:
Constant Field Values

VCT_SINGLE_ENDED

public static final int VCT_SINGLE_ENDED
Voltage connection - single-ended

See Also:
Constant Field Values

VCT_GROUNDED

public static final int VCT_GROUNDED
Voltage connection - grounded

See Also:
Constant Field Values

VCT_CALIBRATION

public static final int VCT_CALIBRATION
Voltage connection - calibration

See Also:
Constant Field Values

TCT_2WIRE_1SENSOR

public static final int TCT_2WIRE_1SENSOR
Therm connection - two wire, one sensor

See Also:
Constant Field Values

TCT_2WIRE_2SENSOR

public static final int TCT_2WIRE_2SENSOR
Therm connection - two wire, two sensors

See Also:
Constant Field Values

TCT_3WIRE

public static final int TCT_3WIRE
Therm connection - three wire

See Also:
Constant Field Values

TCT_4WIRE

public static final int TCT_4WIRE
Therm connection - four wire

See Also:
Constant Field Values

CEX_OFF

public static final int CEX_OFF
Current excitation - off

See Also:
Constant Field Values

CEX_10UA

public static final int CEX_10UA
Current excitation - 10 microamps

See Also:
Constant Field Values

CEX_210UA

public static final int CEX_210UA
Current excitation - 210 microamps

See Also:
Constant Field Values
Constructor Detail

MccUsb

public MccUsb()
       throws javax.usb.UsbException
Constructor

Throws:
javax.usb.UsbException
Method Detail

getDevId

public int getDevId()
Gets the device ID

Returns:
The ID of the current open device, or -1 if no device open.

getUsbComm

public org.lsst.ccs.drivers.usb.UsbComm getUsbComm()
Gets the USB communication object

Returns:
The UsbComm object associated with this MCC object.

open

public void open(int did,
                 String serial,
                 boolean force)
          throws MccUsbException,
                 javax.usb.UsbException
Opens a connection to the device

Parameters:
did - The device identifier code.
serial - The serial number of the device, or null if the first found device of this type is to be used.
force - If true, claiming the device is forced, allowing it to be opened even if another driver has claimed it.
Throws:
MccUsbException
javax.usb.UsbException

close

public void close()
           throws MccUsbException,
                  javax.usb.UsbException
Closes the connection to the device

Throws:
MccUsbException
javax.usb.UsbException

dioConfig

public void dioConfig(int direction)
               throws MccUsbException,
                      javax.usb.UsbException
Configures the DIO port

Parameters:
direction - The direction to set for all the DIO lines. If 0, all lines are output; otherwise they are input.
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

dioConfigBit

public void dioConfigBit(int bitno,
                         int direction)
                  throws MccUsbException,
                         javax.usb.UsbException
Configures one DIO line

Parameters:
bitno - The number (0 - 7) of the DIO line to configure.
direction - The direction to set for the DIO line. If 0, the line is output; otherwise it is input.
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

dioIn

public int dioIn()
          throws MccUsbException,
                 javax.usb.UsbException
Reads all the DIO lines

Returns:
The state of the 8 DIO lines represented as a bit mask.
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

dioInBit

public int dioInBit(int bitno)
             throws MccUsbException,
                    javax.usb.UsbException
Reads one DIO line

Parameters:
bitno - The number (0 - 7) of the DIO line to read.
Returns:
The state (0 or 1) of the DIO line.
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

dioOut

public void dioOut(int value)
            throws MccUsbException,
                   javax.usb.UsbException
Writes all the DIO lines

Parameters:
value - A bit mask of the states to set in the 8 DIO lines.
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

dioOutBit

public void dioOutBit(int bitno,
                      int value)
               throws MccUsbException,
                      javax.usb.UsbException
Writes one DIO line

Parameters:
bitno - The number (0 - 7) of the DIO line to write.
value - The value (0 or 1) to write.
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

cntrInit

public void cntrInit()
              throws MccUsbException,
                     javax.usb.UsbException
Initializes the event counter (sets it to zero)

Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

cntrRead

public int cntrRead()
             throws MccUsbException,
                    javax.usb.UsbException
Reads the event counter

Returns:
The counter value.
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

adcIn

public float adcIn(int chan,
                   int units)
            throws MccUsbException,
                   javax.usb.UsbException
Reads an ADC channel

Parameters:
chan - The channel to read: 0 - 3 are temperatures; 4 - 7 are temperatures for the USB-TC-AI and voltages for the USB-TC; 128 - 129 are the CJCs (only one for the USB-TC-AI).
units - The units of the result: for temperature channels 0 = temperature, 1 = raw units; for voltage channels 0 = voltage, 1 = ADC counts; CJC is always temperature.
Returns:
The read value. Special values are -8888.0 (open thermocouple), -9000.0 (initialization error), -9999.0 (floating point error).
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

adcScan

public int adcScan(int start,
                   int end,
                   int units,
                   float[] value)
            throws MccUsbException,
                   javax.usb.UsbException
Scans ADC channels

Parameters:
start - The first channel to read (0 - 7).
end - The last channel to read (0 - 7 and >= start).
units - The units of the result: for temperature channels 0 = temperature, 1 = raw units; for voltage channels 0 = voltage, 1 = ADC counts.
value - An array of sufficient size to contain the read values.
Returns:
The number of channels read.
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

blink

public void blink()
           throws MccUsbException,
                  javax.usb.UsbException
Blinks the LED

Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

reset

public void reset()
           throws MccUsbException,
                  javax.usb.UsbException
Resets the device

Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

getItem

public float getItem(int item,
                     int subItem)
              throws MccUsbException,
                     javax.usb.UsbException
Gets a configuration item

Parameters:
item - The item code (ADC number in the range 0 - 3) of the configuration data.
subItem - The subitem code of the configuration data.
Returns:
The value of the configuration item. Note that most items are unsigned bytes, but are returned as floating point.
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

getSensorType

public int getSensorType(int chan)
                  throws MccUsbException,
                         javax.usb.UsbException
Gets a channel pair's sensor type

Parameters:
chan - The channel number of one of the pair.
Returns:
The encoded sensor type
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

getThermConnType

public int getThermConnType(int chan)
                     throws MccUsbException,
                            javax.usb.UsbException
Gets a thermistor or RTD channel pair's connection type

Parameters:
chan - The channel number of one of the pair.
Returns:
The encoded connection type
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

getFilterRate

public int getFilterRate(int chan)
                  throws MccUsbException,
                         javax.usb.UsbException
Gets a channel pair's filter update rate

Parameters:
chan - The channel number of one of the pair.
Returns:
The encoded update rate
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

getExcitation

public int getExcitation(int chan)
                  throws MccUsbException,
                         javax.usb.UsbException
Gets a channel pair's current excitation

Parameters:
chan - The channel number of one of the pair.
Returns:
The encoded current excitation
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

getReferenceVoltage

public float getReferenceVoltage(int chan)
                          throws MccUsbException,
                                 javax.usb.UsbException
Gets a channel pair's reference voltage

Parameters:
chan - The channel number of one of the pair.
Returns:
The reference voltage
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

getTCType

public int getTCType(int chan)
              throws MccUsbException,
                     javax.usb.UsbException
Gets a channel's thermocouple type

Parameters:
chan - The channel number.
Returns:
The encoded thermocouple type
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

getGain

public int getGain(int chan)
            throws MccUsbException,
                   javax.usb.UsbException
Gets a channel's gain

Parameters:
chan - The channel number.
Returns:
The encoded gain
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

getCoefficient

public float getCoefficient(int chan,
                            int coeff)
                     throws MccUsbException,
                            javax.usb.UsbException
Gets a channel's coefficient

Parameters:
chan - The channel number.
coeff - The coefficient number (0 - 3).
Returns:
The encoded gain
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

getVoltageConnType

public int getVoltageConnType(int chan)
                       throws MccUsbException,
                              javax.usb.UsbException
Gets a voltage channel's connection type

Parameters:
chan - The channel number.
Returns:
The encoded connection type.
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

setItem

public void setItem(int item,
                    int subItem,
                    float value)
             throws MccUsbException,
                    javax.usb.UsbException
Sets a configuration item

Parameters:
item - The item code (ADC number in the range 0 - 3) of the configuration data.
subItem - The subitem code of the configuration data.
value - The value to set. Note that most items are unsigned bytes, but are specified as floating point.
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

setSensorType

public void setSensorType(int chan,
                          int type)
                   throws MccUsbException,
                          javax.usb.UsbException
Sets a channel pair's sensor type

Parameters:
chan - The channel number of one of the pair.
type - The sensor type to set.
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

setThermConnType

public void setThermConnType(int chan,
                             int type)
                      throws MccUsbException,
                             javax.usb.UsbException
Sets a thermistor or RTD channel pair's connection type

Parameters:
chan - The channel number of one of the pair.
type - The connection type to set.
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

setExcitation

public void setExcitation(int chan,
                          int value)
                   throws MccUsbException,
                          javax.usb.UsbException
Sets a channel pair's current excitation

Parameters:
chan - The channel number of one of the pair.
value - The encoded excitation value to set.
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

setTCType

public void setTCType(int chan,
                      int type)
               throws MccUsbException,
                      javax.usb.UsbException
Sets a channel's thermocouple type

Parameters:
chan - The channel number.
type - The thermocouple type to set.
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

setGain

public void setGain(int chan,
                    int gain)
             throws MccUsbException,
                    javax.usb.UsbException
Sets a channel's gain

Parameters:
chan - The channel number.
gain - The encoded gain value to set.
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

setCoefficient

public void setCoefficient(int chan,
                           int coeff,
                           float value)
                    throws MccUsbException,
                           javax.usb.UsbException
Sets a channel's coefficient

Parameters:
chan - The channel number.
coeff - The coefficient number (0 - 3).
value - The value to set.
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

setVoltageConnType

public void setVoltageConnType(int chan,
                               int type)
                        throws MccUsbException,
                               javax.usb.UsbException
Sets a voltage channel's connection type

Parameters:
chan - The channel number.
type - The connection type to set.
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

configAlarm

public void configAlarm(int alarm,
                        int iOptns,
                        int oOptns,
                        float value1,
                        float value2)
                 throws MccUsbException,
                        javax.usb.UsbException
Configures an alarm

This routine configures the temperature and voltage alarms. There are eight alarms available, corresponding to the eight available DIO bits. If an alarm is enabled, its associated DIO line will be configured as an output on power on and driven to its non-alarmed state. The alarm conditions are evaluated every measurement cycle.

Input options:

BitDescription
[0-2]:input channel (0-7)
3:units: 0 = temperature, 1 = raw
[4-6]:threshold type:
000 - alarm when reading > value1
001 - alarm when reading > value1, reset when reading < value2
010 - alarm when reading < value1
011 - alarm when reading < value1, reset when reading > value2
100 - alarm when reading < value1 or > value2
101 - not used
110 - not used
111 - not used
7:not used, must be 0

Output options:

BitDescription
0:1 = enable alarm, 0 = disable alarm
1:0 = active low alarm, 1 = active high alarm
[2-7]:not used

Parameters:
alarm - The number (0 - 7) of the alarm to configure.
iOptns - Input options.
oOptns - Output options.
value1 - The first alarm condition value.
value2 - The second alarm condition value.
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

getAlarmConfig

public void getAlarmConfig(int alarm,
                           int[] optns,
                           float[] values)
                    throws MccUsbException,
                           javax.usb.UsbException
Gets an alarm configuration

Parameters:
alarm - The number (0 - 7) of the alarm.
optns - A two-element array to receive the alarm's input [0] and output [1] options.
values - A two-element array to receive the alarm's value1 [0] and value2 [1] condition values.
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

calSteps

public void calSteps(int[] steps)
              throws MccUsbException,
                     javax.usb.UsbException
Gets the number of calibration steps

Parameters:
steps - A two-element array to receive the number of steps used in temperature [0] and voltage [1] calibrations.
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

calConfig

public void calConfig(int gain,
                      int polarity,
                      int path)
               throws MccUsbException,
                      javax.usb.UsbException
Configures the calibration MUX

This configures the calibration mux for voltage channels 4-7. To use the calibration input, the channel must be configured for calibration using setItem().

Parameters:
gain - The gain selector.
polarity - The polarity: 0 = positive, 1 = negative.
path - The channel path: 0 = channel high, 1 = channel low
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

calibrate

public void calibrate(int type)
               throws MccUsbException,
                      javax.usb.UsbException
Calibrates the ADC channels

This is used after reconfiguring the channel(s). This may take up to several seconds, and the completion may be determined by polling the status with getStatus(). Temperature readings will not be updated while the calibration is ongoing, but DIO operations may be performed. The device will not accept setItem() or memWrite() commands while calibration is being performed. Additionally, any calibrate() commands with type argument other than 255 (calibrate abort) will be ignored. After a calibration is aborted, getStatus() will indicate a calibration error until a new calibration is started. Once voltage calibration has been completed successfully, the calibration path location in the isolated microcontroller's EEPROM will be updatated to indicate which path was used for the most recent calibration.

Parameters:
type - The type of calibration to perform: 0 = temperature, 1 = voltage, 255 = abort.
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

getStatus

public int getStatus()
              throws MccUsbException,
                     javax.usb.UsbException
Gets the calibration status

Returns:
The status byte, formatted as follows: bits 0-5: Calibration progress (0 = no calibration) bit 6: Calibration type: 0 = temperature, 1 = voltage bit 7: Calibration status: 0 = good, 1 = error
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

getBurnout

public int getBurnout(int mask)
               throws MccUsbException,
                      javax.usb.UsbException
Gets the burnout status and clears it under a mask

This routine returns the status of burnout detection for thermocouple channels. The return value is a bitmap indicating the burnout detection status for all 8 channels. Individual bits will be set if an open circuit has been detected on that channel. The bits will be cleared after the call using the mask parameter. If a bit is set, the corresponding bit in the status will be left at its current value.

Parameters:
mask - The mask of status bits to clear (0 = clear).
Returns:
The burnout status (before being cleared).
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

readMemory

public int readMemory(int addr,
                      int type,
                      int count,
                      byte[] data)
               throws MccUsbException,
                      javax.usb.UsbException
Reads device memory

Parameters:
addr - The memory address.
type - The memory type: 0 = main microcontroller, 1 = isolated microcontroller.
count - The number of bytes to read (62 max for main, 60 max for isolated).
data - An array of sufficient size to contain the read data.
Returns:
The number of bytes read.
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

writeMemory

public int writeMemory(int addr,
                       int type,
                       int count,
                       byte[] data)
                throws MccUsbException,
                       javax.usb.UsbException
Writes device memory

Locations 0 - 255 are available on the main microcontroller.

Parameters:
addr - The memory address.
type - The memory type: 0 = main microcontroller, 1 = isolated microcontroller.
count - The number of bytes to write (59 max).
data - The data to write.
Returns:
The number of bytes written (?).
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

writeSerial

public void writeSerial(String serial)
                 throws MccUsbException,
                        javax.usb.UsbException
Writes the serial number

Note: The new serial number will be programmed but not used until hardware reset.

Parameters:
serial - The serial number to write. At most 8 bytes are written, and shorter strings are padded with blanks.
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

prepareDownload

public void prepareDownload(int code,
                            int micro)
                     throws MccUsbException,
                            javax.usb.UsbException
Prepares for a download

This routine puts the device into code update mode. The unlock code must be correct as a further safety device. Call this once before sending code with writeCode(). If not in code update mode, any call to writeCode() will be ignored. A reset() call must be issued after the code download in order to return the device to operation with the new code.

Parameters:
code - The unlock code (must be 0xad).
micro - The microcontroller to load (0 = main, 1 = isolated).
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

writeCode

public void writeCode(int addr,
                      int count,
                      byte[] data)
               throws MccUsbException,
                      javax.usb.UsbException
Writes firmware code

This routine writes to the program memory in the device, and is not accepted unless the device is in update mode. It will normally be used when downloading a new hex file, so it supports memory ranges that may be found in the hex file. The microcontroller that is being written to is selected with the prepareDownload() routine.

The address ranges are:

0x000000 - 0x0075FF: Microcontroller FLASH program memory
0x200000 - 0x200007: ID memory (serial number is stored here on main micro)
0x300000 - 0x30000F: CONFIG memory (processor configuration data)
0xF00000 - 0xF03FFF: EEPROM memory

FLASH program memory: The device must receive data in 64-byte segments that begin on a 64-byte boundary. The data is sent in messages containing 32 bytes. count must always equal 32.

Other memory: Any number of bytes up to the maximum (32) may be sent.

Parameters:
addr - The start address to be written to.
count - The number of bytes to write.
data - The data to be written.
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException

readCode

public int readCode(int addr,
                    int count,
                    byte[] data)
             throws MccUsbException,
                    javax.usb.UsbException
Reads firmware code

Parameters:
addr - The start address to be read from.
count - The number of bytes to read.
data - An array large enough to hold the read data.
Returns:
The number of bytes read.
Throws:
MccUsbException
javax.usb.UsbException
UnsupportedOperationException


Copyright © 2013 LSST. All Rights Reserved.