10-22-2018 03:02 PM
Problem: I'm trying to communicate with a 2 speed fan motor controller using modbus protocol. The fan has 2 speeds (low/high) The problem is how the motor controller works. The controller uses 2 different slave id's and the registers for the slave id's are the same for both.
The registers are as follows
Slave | Function | Register | Signal Descrip |
3 | 4 | 30286 | Fan S13 On High |
3 | 16 | 40003 | Fan S13 Stop High |
3 | 16 | 40004 | Fan S13 Start High |
4 | 4 | 30286 | Fan S13 On Low |
4 | 16 | 40003 | Fan S13 Start Low |
4 | 16 | 40004 | Fan S13 Stop Low |
i'm trying to create 1 vi that can communicate with each one of the registers across both slave ID's. I basically want to be able to create a front panel with 4 buttons (start/stop) and 2 status lights for high and low.
I started with the NI example serial slave for my other controllers and i was able to maniplulate it to my needs when using a single Slave ID but Fans require multiple slave ID's
I thought about using 2 Vi's running at the same time but I dont know how to communicate between them the correct values. I also had the idea of maybe creating a Subvi but that wont work becasue the Vi's have while loops in that vi would then prevent the original vi from continuing.
Background:
Windows XP
Version - Labview 8.1
Modbus RTU over Serial
NI Modbus
Any help would be appreciated.
Solved! Go to Solution.
10-22-2018 03:11 PM
10-22-2018 04:36 PM - edited 10-22-2018 04:42 PM
The newer modbus libraries build in the slave address when you create the connection and use the class wire to distinguish between the different connections.
If so, you'll create two connections, one for each slave. Just keep the class wires separate, but use the error wire to determine order of execution when you alternate between each device/connection you are talking to.
10-22-2018 05:18 PM
I am currently working on a program that has to get measurements from 12 wattmeters all on MODBUS.
I am using NI's MODBUS toolkit and I open my sessions like this: (Modbus addresses 0000-0011)
Taking a measurement from all 12 is just as easy
10-22-2018 06:42 PM
@RTSLVU wrote:
I am currently working on a program that has to get measurements from 12 wattmeters all on MODBUS.
I am using NI's MODBUS toolkit and I open my sessions like this: (Modbus addresses 0000-0011)
Taking a measurement from all 12 is just as easy
Curious, do you have problems with ID 0? My understanding was that slave ID 0 was for broadcast messages on serial busses and devices on ID 0 wouldn't respond.
10-23-2018 08:02 AM
i don't think i conved my point well. I'm using a PLC as the master and Labview is slave. I've attached a couple pictures of what it kind of looks like now and what the front panel is supposed to look like unfortunanity becasue it's an air gapped system i can not get the vi off of it.
10-23-2018 08:30 AM
You've completely flipped the problem/question.
You originally said the controller has 2 different slave ID's. Effectively that means you have two different slaves. And the way that I read the message, it implied that the LabVIEW program was the master and you were talking to slave devices. That is the usual scenario.
Now you are saying that LabVIEW has to act as a slave? And act as 2 slaves? You now mention you have a PLC acting as a master, where is that PLC mentioned in your original post?
I have created VI's where LabVIEW acted as the slave before, mainly to simulate whatever real world device would normally be the slave. I've only done a couple times, and I don't think I've ever needed LabVIEW to act as two different slaves. I see you are using the oldest Modbus library, which is also the one I'm most familiar with, and the one that lets you dig in to see how it works.
The slave consists of two parts. One is the daemon which is the background service. And the other is the VI with some Slave Reads and Writes to store the data in a functional global variable. I don't have my LabVIEW version open right now that has the older library, so I'm going on memory. I think what you'll need to do is duplicate code so that the second slave can have its own running VI's under a different name. Or since there is probably just one VI that communicates with the serial port (the daemon if I recall correctly) you might need to modify that so it can react to the two different slave addresses.
10-23-2018 09:15 AM
wrote:
Curious, do you have problems with ID 0? My understanding was that slave ID 0 was for broadcast messages on serial busses and devices on ID 0 wouldn't respond.
Good question... Maybe these devices are not fully "Modbus compliant" as it works with the single meter I have on my desk set to address 0000.
10-23-2018 03:26 PM
i apologize if i wasn't clear earlier but i'm trying to simulate the real world equipment with the PLC acting as the Master, @RavensFan if you can find the computer with Modbus 1.2 on it I would greatly appriciate it.
I was doing some testing earlier where i ran 2 different vi's connected over the same serial port at the same time with 2 differnt slave id's and i could not get them to communicate with the Master properly, so i really need to figure this out for my simulator in general.
I have not tried running 2 vi's across 2 differnt ports with different slave id's but the amount of equipment i have to simulate will not allow me to do that.
10-23-2018 03:45 PM
Problem: I have several Modbus serial device I am using labview to simulate, A PLC is my master, but for testing purposes I am using the Modbus Poll program. Each piece of equipment has a different Slave ID but they all connect over one serial port. For this scenerio we will call it port 6
Scenerio: I have 2 differnt pumps I need to simulate. One has a Slave ID of 5 and the other has a Slave ID of 7. So far I created 2 vi's (One for each pump). The vi's are exact copies of each other with the only change being the Slave ID. I tried running them both at the same time but only 1 vi would respond to the Masters queries. I then tried to run them using 2 seperate processes of Labview and this also had the same problem.
Unfortunatly I can't copy the vi's off the machine but I could take screenshots if anything in here was not clear enough
Background:
Labview 8.6
Modbus 1.2
Windows XP
Any help or suggestions would be appriciated.