Admin Production ni-theme
Current Publication

PlotDigitalLinesMultiBus

LabWindows/CVI

PlotDigitalLinesMultiBus

int PlotDigitalLinesMultiBus (int panelHandle, int controlID, void *dataArray, size_t numberOfPoints, int numberOfBuses, int dataType, int dataSequence, unsigned char numberOfPlotLinesArray[]);

Purpose

Plots data for multiple buses to a digital graph.

Use PlotDigitalLinesMultiBus to send in each data sample from each line as a separate value of the data array. Call PlotPackedDigitalLinesMultiBus to send packed data in which each data array element contains data values for multiple lines within a bus.

If you use NI-DAQmx to acquire the data you plot with PlotDigitalLinesMultiBus, you must call DAQmxReadDigitalLines as the read function. You also must group the lines from each bus into a channel to ensure that PlotDigitalLinesMultiBus can plot the data correctly.

Supported Controls

You can use PlotDigitalLinesMultiBus with digital graph controls.

Parameters

Input
Name Type Description
panelHandle int Specifier for a particular panel that is currently in memory. You can obtain this handle from functions such as LoadPanel and NewPanel.
controlID int The defined constant, located in the .uir header file, that you assigned to the control in the User Interface Editor, or the ID returned by functions such as NewCtrl and DuplicateCtrl.
dataArray void * Array that contains the values to plot on the digital graph. The data type must be of the type specified by dataType. If the value of a data item is non-zero, then the line is high; if the value is 0, then the line is low.

You can group the data into multiple buses, as specified in numBuses. If you plot data for more than one bus, all of the buses must have the same number of samples. Otherwise, the displayed data will be incorrect.

numberOfPoints size_t The number of points to plot. This value controls the number of points to plot even if the number of elements in dataArray is greater than the numPoints.

numPoints must be greater than zero and not greater than INT_MAX.
numberOfBuses int The number of data buses to plot. If you specify more than one bus in numBuses, all of the buses must contain the same number of lines. However, some of the lines can be invalid. You must pad the data in dataArray to ensure the buses have the same total number of lines, even if you want to plot only some of the lines for a particular bus. Use the numPlotLinesArray parameter to specify which lines to plot for each bus.
dataType int The data type of dataArray. The data must be one of the following valid integer data types:

VAL_CHAR A single byte character
VAL_INTEGER A 4 byte integer
VAL_SHORT_INTEGER A 2 byte integer
VAL_UNSIGNED_CHAR An unsigned single byte character
VAL_UNSIGNED_INTEGER An unsigned 4 byte integer
VAL_UNSIGNED_SHORT_INTEGER An unsigned 2 byte integer
dataSequence int Determines the order in which LabWindows/CVI plots the dataArray values. If numBuses is 1, LabWindows/CVI ignores this value. The data within an individual bus is always interleaved.

VAL_INTERLEAVED—LabWindows/CVI plots the data values for the first sample of the first bus, then the data values for the first sample of the second bus, and so on.

VAL_NON_INTERLEAVED—LabWindows/CVI plots all of the data values for the first bus, then all of the data values for the second bus, and so on.

If you use NI-DAQmx to acquire the data array, you must use the appropriate dataSequence.

Example Code

You can use the following code to plot two buses on a digital graph:

short int data[20] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

unsigned char lines[2] = {2,2};

PlotDigitalLinesMultiBus (panelHandle, PANEL_DGRAPH, data, 20, 2, VAL_SHORT_INTEGER, VAL_NON_INTERLEAVED, lines);



In this example, LabWindows/CVI plots two buses, each of which has two lines. Because the data is not interleaved, LabWindows/CVI plots the first 10 values as the data values for Bus 0 and the last 10 values as the data values for Bus 1. Given the data values, Bus 0 would contain all high values, and Bus 1 would contain all low values.

If you pass the following code instead:

short int data[20] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

unsigned char lines[2] = {2,2};

PlotDigitalLinesMultiBus (panelHandle, PANEL_DGRAPH, data, 20, 2, VAL_SHORT_INTEGER, VAL_INTERLEAVED, lines);



LabWindows/CVI plots the first two values in Bus 0, the next two values in Bus 1, the next two values in Bus 0, and so on. Given the data values, Bus 0 and Bus 1 would both contain high and low values.
numberOfPlotLinesArray unsigned char [] Array that contains the number of lines to plot per bus. Because each bus must have the same total number of lines, you can use numPlotLinesArray to specify how many lines are valid.

Example Code

You can use the following code to plot two buses on a digital graph:

short int data[20] = {1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0};

unsigned char lines[2] = {2,1};

PlotDigitalLinesMultiBus (panelHandle, PANEL_DGRAPH, data, 20, 2, VAL_SHORT_INTEGER, VAL_NON_INTERLEAVED, lines);



LabWindows/CVI separates the data into four lines, with two lines in each bus. However, LabWindows/CVI plots data for only three of the lines because only three of the lines are valid. As specified by the value of {2, 1} for numPlotLinesArray, Bus 0 contains two valid lines, and Bus 1 contains one valid line. The second line in Bus 1 is a padding line, which ensures the buses have the same total number of lines. The padding line is not plotted.

LabWindows/CVI divides the 20 data elements between the four total lines, plotting five data samples for each of the valid lines in Bus 0, plotting five data samples for the valid line in Bus 1, and ignoring the remaining five data samples as padding data. Only 15 of the 20 data elements are actually plotted on the digital graph.

Return Value

Name Type Description
status int Return value indicating whether the function was successful. A negative number indicates that an error occurred.

Additional Information

Library: User Interface Library

Include file: userint.h

LabWindows/CVI compatibility: LabWindows/CVI 7.1 and later