*idnum – Returns the local ID or –1 if no LabJack is found.
4.13 - Asynch
Requires firmware V1.1 or higher. This function writes and then reads half-duplex asynchronous data on 1 of two pairs of D lines
(8,n,1). Call AsynchConfig to set the baud rate. Similar to RS232, except that logic is normal CMOS/TTL (0=low=GND,
1=high=+5V, idle state of transmit line is high). Connection to a normal RS232 device will probably require a converter chip such
as the MAX233.
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. Slow baud rates can result in longer execution time.
PortA => TX is D8 and RX is D9
PortB => TX is D10 and RX is D11
Transmit Enable is D12
Up to 18 bytes can be written and read. If more than 4 bytes are written or read, this function uses calls to WriteMem/ReadMem to
load/read the LabJack’s data buffer.
Declaration:
long Asynch ( long *idnum,
long demo,
long portB,
long enableTE,
long enableTO,
long enableDel,
long baudrate,
long numWrite,
long numRead,
long *data )
Parameter Description:
Returns: LabJack errorcodes or 0 for no error.
Inputs:
*idnum – Local ID, serial number, or -1 for first found.
demo – Send 0 for normal operation, >0 for demo mode. Demo mode allows this function to be called without a LabJack.
portB – If >0, asynch PortB is used instead of PortA.
enableTE – If >0, D12 (Transmit Enable) is set high during transmit and low during receive.
enableTO – If >0, timeout is enabled for the receive phase (per byte).
enableDel – If >0, a 1 bit delay is inserted between each transmit byte.
baudrate – This is the bps as set by AsynchConfig. Asynch needs this so it has an idea how long the transfer should take.
numWrite – Number of bytes to write (0-18).
numRead – Number of bytes to read (0-18).
*data – Serial data buffer. Send an 18 element array. Fill unused locations with zeros.
Outputs:
*idnum – Returns the local ID or –1 if no LabJack is found.
*data – Serial data buffer. Returns any serial read data. Unused locations are filled with 9999s.
ActiveX Function Differences:
The maximum number of bytes to read and/or write is limited to 6 (numWrite and numRead should be 0-6). The data array is
replaced with pointers to 6 individual data bytes.
Declaration (ActiveX):
long AsynchX ( long FAR* idnum,
long demo,
long portB,
long enableTE,
long enableTO,
long enableDel,
long baudrate,
long numWrite,
long numRead,
long FAR* data0,
long FAR* data1,
long FAR* data2,
long FAR* data3,
long FAR* data4,