LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Disable Modbus without deleting it.

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!

0 Kudos
Message 1 of 9
(2,688 Views)
Sorry, but I don't understand what you want. Modbus uses either serial or TCP/IP. Is that the driver you want to disable? Your reference to a simulator is equally confusing as well first saying communication is fine and then mentioning a time out.
0 Kudos
Message 2 of 9
(2,681 Views)

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.

 

0 Kudos
Message 3 of 9
(2,673 Views)
Put the code inside the Disable structure or inside a case statement.
0 Kudos
Message 4 of 9
(2,669 Views)

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.

0 Kudos
Message 5 of 9
(2,667 Views)

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!

0 Kudos
Message 6 of 9
(2,641 Views)

I simply disabled the "Automatic Error Handling" in VI Properties. But if you have a cleaner solution, let me know!

 

Thank you again.

0 Kudos
Message 7 of 9
(2,635 Views)

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.

0 Kudos
Message 8 of 9
(2,629 Views)

I didn't. Problem solved! Thank you.

0 Kudos
Message 9 of 9
(2,621 Views)