LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modbus Labview Program

Solved!
Go to solution

Hi,

5 is for adjusting temperature set point, 17 for addressing how many minutes do we have,11 for select a program that specifically preferred from that vı. As we come to the last entry of RavensFan, it is not working. I think it is not the way that communicate with those 4 slaves. Because there is one input in creat serial master modbus vi for unit ID. We can't read those slaves seperately yet. I did it with set unit ID vi but again didn't work. Any other way to do that ? Someones says create property nodes but how?

0 Kudos
Message 21 of 33
(2,572 Views)

What do you mean it is "not working"?  Are you getting an error message?  Unfortunately I don't have multiple devices handy right now to prove out the code I attached.

 

Attach  your VI so we can see.

 

The other thing you can do that arteitle mentioned is to use this function.

Create just one instance, but use this before each read with whichever unit ID/slave address you are trying to talk to.

 Multiple%20Slaves_BD

 

It is under the Master API and called Set Unit ID.

 

0 Kudos
Message 22 of 33
(2,566 Views)

Yeah. I got Error 56 about 'LabVIEW: The network operation exceeded the user-specified or system time limit.' I did the VI as like your example VI that you attached. I changed parity to even because device  requires  to communicate with the even parity. The arteitle's method is not meet my desired program. I need to read temperatures simultaneously at the same time. The VI seemed working but there was nothing in the wave chart. I think there was a mistake in for loop or index array. I tried to figure out that problem but I couldn't.So I used 'Set Unit ID' vi but I haven't got a chance to try. Here how I did as a snippet and attached the vi. There was a mistake that I assignd 3rd and 4th one as 1 and 2 but in vi I corrected. And one more think, I used 'set unit ID vi' inside the while loop as to checking all 4 slaves' data but I think there could be a mistake because in 'create serial master vi' I already assigned the unit ID as 1. It makes an error again most likely so I have to put a value that does not affect the Unit ID's. What is your comments on this? vi2png.png

 

 

0 Kudos
Message 23 of 33
(2,555 Views)

One thing that doesn't make sense is that error 56 refers to network errors.  I've never seen an error 56 associated with serial communication.

 

I don't know why Arteille's method wouldn't be working.  YOu'd have to attach your attempt at that VI.

 

You say you need to "read temperatures simultaneously at the same time".  Ignore the fact the statement is redundant, what do you consider "the same time"?  It can never be at the same time because you are dealing with 4 devices on a serial line.  You can talk to one until you are done talking to the other.  They can never send data at the same time.

 

Yes, you set the unit ID when you create the master, but the Set Unit ID used in the loop will change the unit ID.  Read the context help for that function.

0 Kudos
Message 24 of 33
(2,550 Views)

Yes, I didn't understand that error too but it says like that. I didn't use network connection so it is weird to see but when I stop the program, error refers to the shutdown VI, and shows that error 56. I mean with four graph, shouldn't I see each value at the same time? I know with serial, I can see one of them then if I want to see the other I have to turn back to it. You said; 'You can talk to one until you are done talking to the other.  They can never send data at the same time.', so in front panel, I can not see each of those data simultaneously.  How can I manage with that so? When I have one slave, it shows data but with multiple slaves I cannot see anything.  As I said before, I come across with error 56 if I used Arteitles method. Do you have any idea? Because I am totally confused. It should be work but not. 

0 Kudos
Message 25 of 33
(2,545 Views)

I meant to say you can *NOT* talk to one while talking to another.

 

If you can see data going to one, then you should ultimately see data going to all four.  You say 4 graphs.  Do you actually have 4 charts?

 

There is a difference between a chart and a graph.  A chart maintains a history so that you can write a single value to it and it will be shown with all the past values.  A graph only shows all of its data in one shot.  If you send it new data, the previous data is lost.  Now if you happen to have a graph and write a single data point to it.  You won't see it unless you have your plot format to show points, which is off by default.

 

So be sure you have waveform charts and not graphs.

0 Kudos
Message 26 of 33
(2,540 Views)

I know that information. If you look at the VI that I attached previously, there is 4 waveform charts. Sorry for the misleading statement. Here the front panel of that attached VI. Can't I see data from those waveform chart which links to 4 slaves? You said no. So how can I overcome this problem? Should I use Modbus Slave API instead of Master API? I cannot see anything from that VI? The objective is read them in seperate charts. How can I communicate with those 4 furnace slaves and collect data from them in that attached VI? Based on the discussion that we did, the attached VI will not work? So should there be a case structure or something like that? front.png

 

 

0 Kudos
Message 27 of 33
(2,532 Views)

You definitely want to use the Modbus Master functions. If you simplify the program down to reading from just one controller once, does it execute successfully? Can you manually edit the Unit ID to do that for each of the four controllers? Basically, I want to know if communication with each controller works individually, and/or if the problem only arises when you try to read all four in sequence.

0 Kudos
Message 28 of 33
(2,516 Views)

Hi again,

 

I want to ask something. I have four slave and 1 USB/ RS485 adapter. All four connected to only this converter. Maybe is the problem causing from this part? I connected each slaves as serial to each other and then connected to that adapter and connected it to the computer. When I simplify the program down to reading from just one controller once again, it gave error 56 again. Possibly the error causing from this part. vi.png

 

Secondly, is the schema at left correctly done? Instead of for loop, I used 'Set Unit ID.vi' and there is no need to index array right? I gave an address initially '1' to New Serial Master as Unit ID. Inside the while loop I retrieve those each slave's ID and combine them with each Waveform Chart. Are either with the for loop or with this one useful? Because I used Unit ID '1' in the new serial master. So all VI take the Unit ID as 1. I connected New Serial Mater to every each Read Holding Register VI, for this reason, the Unit ID '1' goes to each reading VI from a serial master instance. Don't this VI use only Unit ID '1' right? 

Sincerely.

0 Kudos
Message 29 of 33
(2,500 Views)

That code does look correct, although I would probably run the blue "modbus master" lines straight through the "Set Unit ID" and "Modbus Read" blocks in series rather than branching it like you did, but that shouldn't really matter. Unfortunately, error 56 doesn't tell us much, just that the device didn't respond in time before the function timed out. One question I should ask, are you sure your temperature controllers are equipped with RS-485 communications? The manual does say that it's an optional feature, just want to make sure.

 

It shouldn't matter much over short distances and at low speeds, but do you have all five devices (the USB converter plus the four controllers) wired together in a chain rather than a star, with all of the 'A' terminals wired together, and all of the 'B' terminals wired together, and with 120 ohm termination resistors across them at each end of the chain? That they all use the A/B nomenclature probably rules out accidentally swapping the two wires, but sometimes devices from different manufacturers will use '+' and '-' labels inconsistently making it easy to swap them by accident. You still might want to try swapping the two wires at your USB converter and see if that makes any difference.

 

Can you try using other Modbus test software to see if you can communicate? Here are some examples:

http://www.simplymodbus.ca/RTUmaster.htm

http://www.modbustools.com/

https://automationforum.in/t/modbus-test-utility-free-alternative-to-modscan-modbus-poll-simply-modb...

https://sourceforge.net/projects/qmodmaster/

0 Kudos
Message 30 of 33
(2,491 Views)