The CSDB VIs allows programming of MAX Technologies' devices supporting the CSDB databus.
|CSDB||The Commercial Standard Digital Bus (CSDB) is a unidirectional asynchronous bus.Data is transmitted over an interconnect cable using devices compliant with the RS-422A|
|Message||A CSDB message is a block of six or eight bytes. Multibus VI encapsulate the CSDB message in an array of three or four 16-bit words|
|Label||The label identifies a message. It is the first byte transmitted on the databus.|
|Status||If used, the status byte follows the label byte. It contains information on the source, mode and validity of the data which follows in the message|
|Source Identifier (SI)||Source Identifier is the least significative two bits of the status byte|
|Data||Payload data to be transmitted. Data field is 4 bytes (in a 6 bytes message) or 6 bytes (in a 8 bytes message)|
|Word||2 bytes (16 bits)|
|Parity||Parity bit for integrity check|
CSDB message format
LabVIEW CSDB based applications must include Session VIs to create and terminate a Multibus session. A Multibus session is created by connecting to a MAX Technologies supported device like the FlexMulti 429 device. Refer to the Welcome section for all the currently supported devices.
Depending on the device capabilities, create a session using either Ethernet, USB or PCI/PXI Express link.
In the LabVIEW CSDB application, the appropriate Connect VI (mbus Ethernet Connect.vi for an Ethernet connection) is placed in the app initialization. To end a session, mbus Terminate.vi must be placed to clean up tasks and terminate the session properly.
A session is created with the Connect VI and is maintained up to mbus Terminate.vi. A sessionHandle identifies the created session. The next step is to configure the CSDB port.
The mbus Serial Protocol Select.vi selects CSDB for one or multiple Serial ports. It should be placed before configuring the port(s). Then, mbus CSDB Port Config.vi configures the CSDB port. The VI must be placed at the appropriate location, and in any case, after the Connect VI. The sessionHandle returned by the Connect VI must be wired to mbus CSDB Port Config.vi. The mbus CSDB Port Config.vi returns a portHandle that uniquely identifies this CSDB port.
The mbus CSDB Port Close.vi should be placed to the appropriate location to finish using the CSDB port. It must be wired to the portHandle.
If multiple CSDB ports are available on the hardware, the port number must be used to select desired port. Default port number is 0. The CSDB port is configured with a bus speed (default is 12,500 bps), parity (default is odd), stop bit (default is 1 bit size), msg size (default is 6 bytes) and a loopback (default is false).
Once the CSDB port is configured, the port is activated and will buffer any received data from the physical bus if the loopback is set to false. If the loopback parameter is set to true, the port is configured to buffer received data from the port transmitter internally. In the context of a self test, the loopback parameter must be set to true. No hardware interface is needed.
Those five VIs form the basic CSDB LabVIEW app data flow. The next step is to add the CSDB VIs to send or receive CSDB messages.
Sending and Receiving CSDB Messages
A CSDB Message is sent and received using a 16-bit words array. Each message in the array is formatted as follows.
6 bytes CSDB message consist of a 3 words array:
[word-0, word-1, word-2 ]
Example: [0x0102, 0x0304, 0x2CB7]
Label is 0xB7 Status is 0x2C Data Words are 0x0102, 0x0304
The resulting message bytes on the databus will be transmitted in the following order: Start Of Transmission -> 0xB7, 0x2C, 0x04, 0x03, 0x02, 0x01 ->
8 bytes CSDB message consist of a 4 words array:
[word-0, word-1, word-2, word-3 ]
Example: [0x0102, 0x0304, 0x0506, 0x19D8]
Label is 0xD8 Status is 0x19 Data Words are 0x0102, 0x0304, 0x0506
The resulting message bytes on the databus will be transmitted in the following order: Start Of Transmission -> 0xD8, 0x19, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01 ->
To sequentially read incoming CSDB databus messages, Multibus VI offers a Receive VI: mbus CSDB Receive.vi. This function reads received CSDB messages. mbus CSDB Receive.vi function must be wired to the CSDB Config Port function already placed.
To sequentially send CSDB databus messages, Multibus VI offers a Send function: mbus CSDB Send.vi. This function sends CSDB messages from a buffer. mbus CSDB Send.vi function must be wired to the CSDB Config Port function already placed.
The above figure shows basic wiring for a single read of received CSDB messages. For continuous reading, mbus CSDB Receive.vi must be included into a loop. The messages are populated in the csdbMsgWords buffer. The csdbMsgWords buffer is an array of CSDB 16-bit words.
With sampling functions, when a label is received repetitively on the bus, the receiver engine overwrites the last CSDB message with that same label by the new one and computes the message period (rate). Label sampling functions allow reading the last word value and its received rate.
To read last occurence of one or many CSDB labels, Multibus VI offers a Receive VI: mbus CSDB Receive Labels.vi. This VI reads received CSDB messages and rates. It must be wired to the CSDB Config Port VI already placed.
To send CSDB databus one or many messages repetitively at a given period, Multibus VI offers a Send VI: mbus CSDB Send Labels At Rates.vi. This VI sends one or many CSDB messages repetitively at the specified rate. It must be wired to the CSDB Config Port VI already placed.
The above figure shows basic wiring for a single snapshot read of all received CSDB labels. For continuous reading, mbus CSDB Receive Labels.vi must be included into a loop. The CSDB label, data and rate each received label are populated in the labels, messageWords and rates arrays.