« Close

Datasheets and User Guides

App Notes

Software & Driver

 

4.32 - SHTComm

Low-level public function to send and receive up to 4 bytes to from an SHT1X sensor. Data rate is about 2 kbps with firmware V1.1 or higher (hardware communication). If firmware is less than V1.1, or TRUE is passed for softComm, data rate is about 20 bps.

DATA = IO0
SCK = IO1

The EI-1050 has an extra enable line that allows multiple probes to be connected at the same time using only the one line for DATA and one line for SCK. This function does not control the enable line.

This function automatically configures IO0 has an input and IO1 as an output.

Note that internally this function operates on the state and direction of IO0 and IO1, and to operate on any of the IO lines the LabJack must operate on all 4. The DLL keeps track of the current direction and output state of all lines, so that this function can operate on IO0 and IO1 without changing IO2 and IO3. When the DLL is first loaded, though, it does not know the direction and state of the lines and assumes all directions are input and output states are low.

Declaration:

long SHTComm (    long *idnum,
                  long softComm,
                  long waitMeas,
                  long serialReset,
                  long dataRate,
                  long numWrite,
                  long numRead,
                  unsigned char *datatx,
                  unsigned char *datarx)

Parameter Description:
Returns: LabJack errorcodes or 0 for no error.
Inputs:

  • *idnum – Local ID, serial number, or -1 for first found.
  • softComm – If >0, forces software based communication. Otherwise software communication is only used if the LabJack U12 firmware version is less than V1.1.
  • waitMeas – If >0, this is a T or RH measurement request.
  • serialReset – If >0, a serial reset is issued before sending and receiving bytes.
  • dataRate – 0=no extra delay (default), 1=medium delay, 2=max delay.
  • numWrite – Number of bytes to write (0-4).
  • numRead – Number of bytes to read (0-4).
  • *datatx – Array of 0-4 bytes to send. Make sure you pass at least numWrite number of bytes.

Outputs:

  • *idnum – Returns the local ID or –1 if no LabJack is found.
  • *datarx – Returns 0-4 read bytes as determined by numRead.

ActiveX Function Differences:
Transmit and receive data arrays are replaced with 4 individual parameters which each pass 1 transmit byte and return 1 read byte.

Declaration (ActiveX):

long SHTCommX (    long FAR* idnum,
                   long softComm,
                   long waitMeas,
                   long serialReset,
                   long dataRate,
                   long numWrite,
                   long numRead,
                   long FAR* data0,
                   long FAR* data1,
                   long FAR* data2,
                   long FAR* data3 )