11-15-2013 02:52 PM - edited 11-15-2013 02:55 PM
Hi everyone,
I'm using the NI Modbus driver found here (nimodbus121.zip). I can communicate with a Modicon PLC and it's working fine. My problem is that I absolutely have to be connected to this PLC if I want to run my labview interface. Otherwise, my interface is stuck in its first loop until the timeout is reached because no communication is established.
Is there a way to disable (really or virtually) the Modbus driver without deleting the whole thing? I know there's simulator we can use but I want the simple solution which is to modify my labview control.
Thank you!
11-15-2013 03:14 PM
11-15-2013 03:40 PM
Thank you for your quick response. I think I shouldn't have used the word "driver" to describe my problem.
First of all, I'm using TCP/IP Modbus. Next, forget the "timeout" thing, I'm not even sure of what I'm saying.
Take a look at the joined vi.
Let's say I want to run my interface offline (not connected to my PLC - IP address : 84.3.44.10). If I run my interface offline, after some seconds, I obtain an error message saying that the "TCP Open Connection" couldn't established a connection.
What should I do to completely disable the Modbus communication with control button or programmatically? In other words, I want my program to ignore the modbus communication and continue to execute its loop. The only solution I know is to delete the "TCP Open Connection" block (block outside the while loop) and everything that's connected to it but I want a smart solution.
Thank you.
11-15-2013 03:51 PM
11-15-2013 03:53 PM
You put the stuff that you don't want to run in a case structure. Put the code in the True case, nothing in the false case.
11-18-2013 07:56 AM - edited 11-18-2013 07:58 AM
I thought about that solution but it seems to be complicated for my application. I tried it and I was quite right. Take a look at the *.swf with internet browser to see what I've done. I put 3 cases structure to cover the TCP initialization, the Read block and the Write block. I disable the Modbus and run my vi. We can see that the vi executes its loop continuously since I can push my button. But when I pushed an event button which isn't inside the while loop (it's in the event handler on left in the block diagram), I get an error message concerning the TCP Connection. If I click "Continue", everything seems to be working fine then. Please, open the vi without linking anything. My project requirements are very complicated so don't try to run it.
Is there a way to correct that TCP error?
OR
Is there a way to hide that error pop up and make it "Continue" by default each time it occurs?
Thank you for your help!
11-18-2013 08:18 AM - edited 11-18-2013 08:19 AM
I simply disabled the "Automatic Error Handling" in VI Properties. But if you have a cleaner solution, let me know!
Thank you again.
11-18-2013 09:46 AM
Did you put the part of the code that has the TCP/IP Close inside of a case structure? I can't see what is happening to the far right of your VI. But if that isn't disabled, then you are trying to close an empty reference that started at the far left of your code.
11-18-2013 11:32 AM
I didn't. Problem solved! Thank you.