Before we explain how to display your data, we should quickly explain how to manipulate screen components in DAQFactory. Because DAQFactory is a dynamic application, meaning you can make edits while your application is actually running, DAQFactory does not use the typical Windows click-and-drag style screen component manipulation.
Instead, you must hold down the Ctrl key to move the screen components. While the Ctrl key is pressed, you can click on components to select them, click-and-drag to move them around, and click-and-drag their corners to resize (for resizable components).
If you don't like this, you can put the system into edit mode by selecting Edit - Edit Mode from the DAQFactory main menu. This will reverse the functionality of the control key when working with components (except keyboard nudging). You can simply click and drag components, but if you want to click on a button to do an action you will have to hold the Ctrl key down. We strongly recommend against using Edit Mode except for when you have a lot of repetitive edits to make on a large number of components.
For those that skim and didn't read the previous paragraphs:
In order to manipulate screen components, you must hold down the Ctrl key.
The Channel View certainly provides a quick look at your data, but is not the most convenient or flexible way to display your data, especially once you have more than one channel. In this section we'll add a component to a page that will display data from the Pressure channel. This assumes, of course, that you created an analog Pressure channel in the basic I/O chapter. If you didn't, load the document LJGuideSamples\InputsSimpleWithDA.ctl and start from there.
1) Click on Page_0 in the Workspace under PAGES:.
This will display a blank white page unless you are working off InputsSimpleWithDA. When DAQFactory Express starts, 2 blank pages are generated automatically with default names. With Express you are limited to 2 pages, but with all the other versions of DAQFactory you can create as many pages as you need.
2) Right-click somewhere in the middle of the blank area and select Displays - Variable Value.
This will place a new page component on the screen. There are many different components available that allow you to create custom screens. This particular component simply displays a changing value in text form.
3) Right click on the new component and select Properties...
All of the screen components have different properties windows for configuring the look of the component and telling the component what data to display.
4) Next to Caption: enter Pressure.
The caption is what is displayed in front of your value. A colon is automatically added when displayed.
5) Next to Expression: enter Pressure[0].
Expressions are actually formulas that you can enter to display calculated data. In this case, the formula simply requests the most recent data point of the channel pressure. The [0] indicates the most recent data point. If, for example, we wanted to convert the pressure voltage into actually pressure units, we could put something like Pressure[0] / 5 * 500.
6) Click OK.
Now the screen should display Pressure: 0.42 V with a changing number. This is the current value in the pressure channel we created earlier. Feel free to open the properties window again and play with the units, font and other settings. When you are done, load the sample file listed below as we'll build on it in the next section.
Sample file: LJGuideSamples\VariableValue.ctl
In the previous section we displayed the voltage reading from our analog input channel. However, in most cases you really want to view your data in more appropriate units than volts. With pressure, for example, you might want PSI or millibar. There are two ways you can convert your data into different units.
The first way is to simply put the desired formula in the Expression area of the component properties. So, if you had a 0-5V pressure sensor with a range of 0-500 psi, you would put:
Pressure[0] * 100
to convert your voltage signal to PSI. You would also, of course, probably want to change the unit display. You can put much more complicated calculations as well, even ones based on multiple channels. DAQFactory supports a wide variety of operators and mathematical functions to make this easy. They are all listed in the Expressions chapter of the DAQFactory help.
Entering formulas directly into the Expression area of a component is handy because you can create another component to display the same input reading in different units. If, however, you always want your reading in particular units, you can instead use Conversions. This has the added benefit of allowing you to log your data in these units. Using our pressure example and a 0-5V : 0-500psi sensor, here is how you would create a conversion to put the readings into PSI:
1) Click on CONVERSIONS: in the Workspace.
This will display the conversion table.
2) Click Add to add a new row.
3) Give the conversion a name, say VoltsToPSI
4) In the Expression column put: Value * 100
You'll notice that we used the word "Value" instead of the channel name in the conversion's expression. This allows a single conversion to be used on multiple channels. The actual channel reading is substituted wherever "Value" appears in the formula.
5) Click Apply to save the new conversion.
6) Click on CHANNELS: in the Workspace to bring up your list of channels.
7) In the row with you Pressure channel, go over to the column labeled Conversion and select VoltsToPSI.
8) Click Apply to save your changes.
If you then go back to Page_0 you will see that your values are now 100 times their previous size.
Note: just to reinforce this: Value is a keyword and not the name of a channel or variable. When you apply the conversion to the channel, that channel's current reading is substituted where Value is found in the conversion.
Sample file: LJGuideSamples\Conversions.ctl
The variable value component is great for analog data, but less so for digital data where the only values are 0 and 1. For this, the Descriptive Text Component is useful to allow you to display a word or message for 0 and 1 instead.
To show this, let's use the "Output" D to A channel we created in the last chapter and pretend it is a digital channel.
1) On a page, right click and select Displays - Descriptive Text.
2) Once the new component is on the screen, right click on it and select Properties....
3) For the Expression type: Output[0]
4) By default, the component already will display the word "Text". Double-click on the word yellow highlighted word Text in the table at the bottom left of the properties to select it and replace it with the word Off.
This will cause the component to display the word Off when Output is 0.
5) Next, click on the Add button to create a new row in the table, and put 1 for the Threshold and On for the Text.
This will cause the component to display the word On when Output is 1. It doesn't matter what the order of the rows are in the table. DAQFactory will sort them once you close the window.
6) Click OK. Then go to the command / alert window and type Output = 0 and hit Enter and watch the new component display Off. Type Output = 1 and hit Enter and the component will change to On.
DAQFactory actually provides a quicker way to set this up.
7) Right click on our text component and select Properties....
8) Click on the button towards the bottom right labeled Digital In. This will pop up a window requesting a channel. Type Output and click OK. Then click OK to close the properties.
This button essentially did steps 3 through 5 in one step. It also setup the colors so that Off displays in red, and On displays in green. Go ahead and type Output = 0 and Output = 1 in the Command / Alert window to watch it change.
As you may have noticed, there is also a button labeled Digital Out, which does almost the exact same thing as the Digital In button, except that it makes the descriptive text component into a clickable component that will toggle the output between 0 and 1. It does this by changing the component's Action. You can see this by clicking on the Action tab of the components properties. Feel free to create a new Descriptive Text component then go into the component's properties, click Digital Out, enter Output, then on closing simply click on the component to toggle Output instead of going to the command alert window.
Sample file: LJGuideSamples\DescriptiveText.ctl
Displaying scalar values in text form is certainly useful, but nothing is better than a graph to give you a handle on what is happening with your system. DAQFactory offers many advanced graphing capabilities to help you better understand your system. In this section we will make a simple Y vs time or trend graph.
1) If you are still displaying the page with the value on it, hit the 1 key to switch to Page_1. If you are in a different view, click on Page_1 in the workspace.
The workspace is only one way to switch among pages. Another is using speed keys which can be assigned to a page by right clicking on the page name in the workspace and selecting Page Properties....
2) Right click somewhere on the blank page and select Graphs - 2D Graph. Move and resize the graph so it takes up most of the screen by holding down the Ctrl key and dragging the component. Drag the small black square boxes at the corners of the selected graph to resize. Next, open the properties window for the graph by right clicking on the graph and selecting Properties....
3) Next to Y Expression: type Pressure.
The Y expression is an expression just like the others we have seen so far. The difference is that a graph expects a list (or array) of values to plot, where in the previous components we have only wanted the most recent value. By simply naming the channel in the Y expression and not putting a [0] after it, we are telling the graph we want the entire history of values stored in memory for the channel. The history length, which determines how many values are kept in memory and therefore how far back in time we can plot is one of the parameters of each channel that we left in its default setting of 3600.
4) Leave all the rest in their default settings and click OK.
You should now see the graph moving. The data will move from right to left as more data is acquired for the pressure channel. However, we currently are multiplying our Pressure channel reading by 100 using the Conversion we created a few sections ago, so the trace is completely off scale and not visible. To display the data, we need to change the Y axis scaling.
5) Double click on the left axis of the graph.
Unlike other components, you can double click on different areas of the graph to open the properties window for the graph to different pages. Double clicking on the left axis brings up the axis page with the left axis selected. You can also just open the properties window for the graph and select the Axes tab, then Left Axis 1.
6) Next to Scale From enter 0, next to Scale To enter 100, then click OK.
This will scale the graph from 0 to 100. Depending on what you have plugged into your LabJack input, or what voltage the LabJack is floating at, this may or may not be a big enough scale. You can always click on Page_0 in the workspace to see what the current Pressure reading is and change the scaling of the graph appropriately.
Now we'll try another method to scale the graph.
7) Open the graph properties box again and go to the Traces page. Change the Y Expression to Pressure / 100 and hit OK.
Like the other screen components, the expressions in graphs can be calculations as well as simple channels. In this case, we are dividing each of the values of Pressure's history by 100 and plotting them. This is essentially removing the conversion we applied to Pressure in the previous section since it multiplied our reading by 100.
8) Deselect the graph by clicking on the page outside of the graph. The shaded rectangle around the graph should disappear. Next, right click on the graph and select AutoScale - Y Axis.
The graph component has two different right click pop up menus. When selected, the graph displays the same pop up menu as the rest of the components. When it is unselected, it displays a completely different pop up for manipulating the special features of the graph.
After autoscaling, you should see the graph properly scaled to display your signal zoomed in. Notice the rectangle around the graph. The left and right sides are green, while the top and bottom are purple. The purple lines indicate that the Y axis of the graph is "frozen". A frozen axis ignores the scaling parameters set in the properties window (like we did in step 6 above) and uses the scaling from an autoscale, pan, or zoom.
9) To "thaw" the frozen axis, right click on the graph and select Freeze/Thaw - Thaw Y Axis
Once thawed, the graph will revert to the 0 to 100 scaling indicated in the properties box and the box surrounding the graph will be drawn entirely in green. At this point you may wish to change the scaling to 0 to 5 using steps 5 and 6 above since we have divided Pressure by 100.
10) Double click on the bottom axis to open the properties to the axis page with the bottom axis selected. Next to Time Width:, enter 120 and click OK
If the double click method does not work, you can always open the properties window for the graph using normal methods, select the Axes page and click on Bottom Axis.
In a vs. time graph, the bottom axis does not have a fixed scale. It changes as new data comes in so that the new data always appears at the very right of the graph. The time width parameter determines how far back in time from the most recent data point is displayed. By changing it from the default 60 to 120 we have told the graph to plot the last 2 minutes of data.
Once again, if you zoom, autoscale, or pan the graph along the x axis, it will freeze the x axis and the graph will no longer update with newly acquired values. You must then thaw the axis to have the graph display the trace as normal.
Sample file: LJGuideSamples\Graphing.ctl
In addition to taking data, most systems also control outputs. Here we will create an output channel and control it manually from a page component. We'll assume you still have that Output channel we created earlier.
1) Click on Page_0 in the Workspace to go to our first page.
2) Right-click in a blank area of the page and select Displays-Variable Value to create another variable value component.
3) Right click on the new component and select Properties... to open the properties window.
4) For the expression, enter Output[0]
Like before, this will simply display the most recent value of the out channel. Feel free to set the caption as well.
5) Click on Action tab.
This tab exists on several different components including the static ones and works the same way with all of them.
6) From the Action drop down, select Set To
There are many different options for the Action described in the DAQFactory help. The Set To action will prompt the user for a new value when the component is clicked and apply the entered value to the channel or variable.
7) Next go to Action Channel: type Output
8) Leave the Range blank and click OK.
The range allows you to constrain the inputs to particular values. By leaving these properties blank, we are indicating that we do not want a range limitation. The page will now display your caption and either the most recent setting for Output, or a 0 with a big red X through it if you started from the last sample document. The red X indicates that Output does not have a valid value yet. This is because we haven't set it to anything.
9) Click on the component. A new window will appear requesting a new value. Enter a voltage value within the DAC range, such as 2, and click OK.
Output will now be set to the value you entered. The component will now display your new value without the big red X. If you tie a wire between DAC0 and AIN0 (on the U3-LV use DAC0 and FIO0) you will see the Pressure reading track with the DAC output, though multiplied by 100.
Note, if you’d like to be able to enter an output value in units other then volts, you need to create a Conversion and apply it to your output channel. We talked about conversions a little earlier. Conversions on output channels work in reverse. With regular input conversions, the formula is used to convert the devices units, usually volts, to your units. With output conversions, the formula is used to convert your units into the device units. So, if you had a variable pressure controller that controlled from 0 to 500 psi and took a 0 to 5V output, the conversion would be: Value / 100
Sample file: LJGuideSamples\AnalogOut.ctl
We talked a little about using a descriptive text component to toggle a digital output between its two states at the end of section 4.4. You can also create a button to toggle the output:
1) On a page, right click and select Buttons & Switches - Button.
2) Once the new component is on the screen, right click on it and select Properties....
3) For the Caption give whatever label you want
4) Click on the Action tab.
5) For Action, select Toggle Between from the drop down combobox.
6) For Action Channel type in the name of your digital output channel.
7) For Toggle Between, put 0 and 1. For digital outputs, only 0 and 1 apply, but you could also use this for toggling an analog output between two voltages by specifying other values here.
8) Click OK
Now you can click on the button and your digital output channel will toggle between 0 and 1.
Sample file: LJGuideSamples\DescriptiveText.ctl