ActiveX Function Differences:
Transmit and receive data arrays are each replaced with 4 individual parameters.
Declaration (ActiveX):
long SHTCRCX ( long statusReg,
long numWrite,
long numRead,
long datatx0,
long datatx1,
long datatx2,
long datatx3,
long datarx0,
long datarx1,
long datarx2,
long datarx3 )
4.34 - Synch
Requires firmware V1.1 or higher. This function performs SPI communication. Data rate is about 160 kbps with no extra delay,
although delays of 100 us or 1 ms per bit can be enabled.
Execution time for this function is about 20 milliseconds to write and/or read up to 4 bytes, plus about 20 milliseconds for each
additional 4 bytes written or read. Extra 20 milliseconds if configD is true, and extra time if delays are enabled.
Control of CS (chip select) can be enabled in this function for D0-D7 or handled externally via any digital output.
MOSI is D13
MISO is D14
SCK is D15
If using the CB25, the protection resistors might need to be shorted on all SPI connections (MOSI, MISO, SCK, CS).
The initial state of SCK is set properly (CPOL), by this function, before !CS is brought low (final state is also set properly before
!CS is brought high again). If chip-select is being handled manually, outside of this function, care must be taken to make sure SCK
is initially set to CPOL.
All modes supported (A, B, C, and D).
Mode A: CPHA=1, CPOL=1
Mode B: CPHA=1, CPOL=0
Mode C: CPHA=0, CPOL=1
Mode D: CPHA=0, CPOL=0
If Clock Phase (CPHA) is 1, data is valid on the edge going to CPOL. If CPHA is 0, data is valid on the edge going away from
CPOL. Clock Polarity (CPOL) determines the idle state of SCK.
Up to 18 bytes can be written/read. Communication is full duplex so 1 byte is read at the same time each byte is written. If more
than 4 bytes are written or read, this function uses calls to WriteMem/ReadMem to load/read the LabJack’s data buffer.
This function has the option (configD) to automatically configure default state and direction for MOSI (D13 Output), MISO (D14
Input), SCK (D15 Output CPOL), and CS (D0-D7 Output High for !CS). This function uses a call to DigitalIO to do this. Similar to
EDigitalIn and EDigitalOut, the DLL keeps track of the current direction and output state of all lines, so that these 4 D lines can be
configured without affecting other digital lines. 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 Synch ( long *idnum,
long demo,
long mode,
long msDelay,
long husDelay,
long controlCS,
long csLine,
long csState,
long configD,
long numWriteRead,
long *data )
Parameter Description:
Returns: LabJack errorcodes or 0 for no error.