From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

FieldPoint Family

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use a table to fill an array

I have a cFP 2110 with a couple of relay modules I'm using to automate a process.  I'm  using an array of a cluster of elements to turn the relays on and off with a time delay for each step.  This was the first version I started with and I have since built a state machine around.  What I would like to do is add a table or array to the front pannel and move the relay control and time delay to the front panel and allow the user to specify which relays are on or off and for how long.  I also want to allow the user to save the table and have the option to select other saved versions of the table to operate the module with different.   I also need to add a string control to the table so I will need to use shared variables for to communicate between the target Vi and the host vi the user is working from.  Is a table the correct approach to do this?  I have never used the table functions.  How do I go about building a table and sending the data to an array?  Do I need to send the table contents to file OI first, then have the array read the specified file?

 

Thank for the help.

 

 

 

Danny
0 Kudos
Message 1 of 3
(6,161 Views)

Hi Danny,

 

Instead of using a constant array on your block diagram, you could use a control array so that the elements show up on the front panel. Then your user will have the ability to change the relays and time delay. You can then use Datalog files (see Help >> Find Examples... and search Datalog) to save individual clusters. Otherwise if you want to save entire arrays, you could just save them to a binary file. 

 

Using the array of controls eliminates the need for a table and its conversion, and also provides a front panel interface for your user to control. Does the string control need to be part of these array as well, or can it be separate?

 

If you are reading a file back to be used with your program, you will need to read the file to get its contents before using it to control your loop.

Will
CLA, CLED, CTD, CPI
LabVIEW Champion
Choose Movement Consulting
choose-mc.com
0 Kudos
Message 2 of 3
(6,146 Views)

Will,

Thank you for the help.  I'll play around with the control array this week and see how well it works.  I either need the string command to be part of the array, or to have a way to execute the string command at the same time as a specific step in the array is being completed.  I will be adding an additional instrument to the system shown in current block diagram had attached and I can only communicate to it with serial communication.

 

 

Danny
0 Kudos
Message 3 of 3
(6,141 Views)