NI Labs Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

NI LabVIEW Modbus API Discussion

With Modbus, the master (client) sends out requests and the slave (server) responds to these requests. The slave API is provided to implement a modbus slave. When you use the read multiple coils VI on the modbus slave wire, it just returns the values of the coils from its intermal data model. No network communication is initiated.

Message 401 of 529
(2,791 Views)

hi

i have understood very clearlyi have encountered problem while doing an experiment yesterday i tried to connect two plc which gives data by Rs-485 from RJ45 port i have used multiplex a data from two plc to one.I have used Used RS 485 to USB converter to get the data the following code to get coil data from communication,the problem i only get right answer when i enable highlight execution else the program is responding with error 56 please help to fix this

0 Kudos
Message 402 of 529
(2,778 Views)

As far as I know, this Modbus library doesn't do anything to protect the serial port from simultaneous access. Therefore, when you are trying to communicate with more than one slave on the same COM port in parallel, they will conflict with each other. To avoid this, you can use one modbus master wire and use the Unit ID property node to specify which slave to communicate with. You then alternate between the two slaves in sequence. See "modbus serial two devices same com_fixed.vi" attached.

 

Alternatively, you could use semaphores to protect the COM port from simultaneous access. The Plasmionique Modbus Master library has this functionality built-in. You can download the latest version of the library here: https://lavag.org/files/file/286-plasmionique-modbus-master/

See "modbus serial two devices same com_plasmionique.vi" attached.

Message 403 of 529
(2,770 Views)

Hi

I use a similar installation and your program generate exactly the same result. For simultaneous access on the same port I use Plasmionique-modus-master library without problem.

 

0 Kudos
Message 404 of 529
(2,761 Views)

The program is working fine but the thing is I would like to know is that

#this plasmionique library is a free library or not

# the link of plasmionique library does not match because i use labview 12 would you please send a link for 12 version 

 

thanks

 

0 Kudos
Message 405 of 529
(2,749 Views)

LabVIEW 2012 versions attached.

 

Plasmionique Modbus Master is a free and open source library.

0 Kudos
Message 406 of 529
(2,732 Views)

hi porter

I tried installing plasmionique library but my Vi package manager says that is not compatible with my software what should i do now

0 Kudos
Message 407 of 529
(2,719 Views)

You probably need to update VI package manager. The library's package was built using VI package manager 2014.

0 Kudos
Message 408 of 529
(2,711 Views)

Hi,

You can also use NI library.

You must only avoid to read slave 1 and slave 2 at the same time.

I modified your last program and test it on my installation; it works fine.

The code is not nice, but it is only to show you where is the problem.

 

Message 409 of 529
(2,708 Views)

Hi,

 

Is it possible to get the raw modbus response packet from the device after sending a write request using this protocol? The basic problem I am trying to solve is as follows:

I want to check that a particular modbus slave is responding with the correct modbus exception code when I send a wrong query (Example: I send a PDU with an illegal address from the master). When using the write functions in the API, only feedback I have when something is not right is through the error out of the write VI. Is there any way of getting to the raw reply PDU from the slave? or is there a one to one correspondence between the exception errors defined in the modbus standard and the LabVIEW error codes?

 

Thanks and Regards,

Supreeth

Thanks and Regards,
Supreeth.K

0 Kudos
Message 410 of 529
(2,662 Views)