09-17-2009 02:18 PM
I have an application in which I communicate with several PLCs using MODBUS TCP/IP toolkit. There is an array of IP addresses that the user can configure. Using for loops allows to work with this however if one PLC is out, the program waits for the timeout before polling the next PLC. I would like to use a multithreading type in order that all PLCs are polled at once and is not dependent of each other. In other words, I would like to dynamically simulate several while loops happening at the same time. Is this possible?
Thanks
arikb
09-18-2009 01:36 PM
Hi arikb,
Why don't you put the code into a subVI and have each iteration of the loop call the subvi. Make sure you set it as a reenterant VI (VI Properties>>Execution).
Hope that helps.
Flash
09-18-2009 01:50 PM
Thanks A_Patel,
I thought of doing that but do I need to run this as a VI server in that case? How would I pass inputs and outputs of the subvi?
Appreciate the help,
arikb
09-18-2009 02:42 PM
arikb wrote:Thanks A_Patel,
I thought of doing that but do I need to run this as a VI server in that case? How would I pass inputs and outputs of the subvi?
Appreciate the help,
arikb
Take a look at my Nugget on dynamically creating occurences found here.
Just ignore the Occurence stuff and the rest of the code and verbage should help you. The example code creates a bunch of background processes and passes a unique parameter to each.
Have fun,
Ben