LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Testing modbus serial communication

Solved!
Go to solution

Hi,

 

I would like to test the master server modbus serial communication running on CRIO (9012) and slave server modbus serial communication.

Questions:

Is it possible? Run two VI the same time? If yes, what i am doing wrong

 

The CRIO is connected by ethernet and by serial with PC.

 

 modbus-serial.jpg

 

Best Regards

David Fiorillo
0 Kudos
Message 1 of 12
(7,674 Views)

Yes you can run two VI's at the same time.  But you have several problems.

 

Your top VI has no connection whatsoever to your bottom VI.  It is just a random number generator connected to an indicator.  But that indicator will always show zero because it is set up for an integer.  The random number generator puts out a value from 0 to just under 1.  It will always round down to 0 when you coerce it into an integer.

 

Your real modbus reading problem is in your lower VI.  There is no way to tell what is going wrong by a screenshot.

0 Kudos
Message 2 of 12
(7,664 Views)

Hi Dfiorillo,

 

Not so long ago i wrote an application using Modbus. I downloaded a freeware piece of software off the internet that was really usefull. It allowed you to simulate a modbus slave. You could designate address and registers. Unfortunately it was on my laptop which i have recently changed operating system on and have lost. Im sure that if you have a look you will find something suitable.

 

Rgs,

 

Lucither

------------------------------------------------------------------------------------------------------
"Everything should be made as simple as possible but no simpler"
0 Kudos
Message 3 of 12
(7,636 Views)

Ravens,

 

How could I exchange modbus' data between two VIs? One emulanting a master and the other emulating a slave? The slave will run in the PC and the Master will be deployed in the CRIO (9012). Folow the files in attachment

 

Best Regards

David Fiorillo
0 Kudos
Message 4 of 12
(7,616 Views)

Lucither,

 

I will try the Simply modbus slave in http:/www.simplymodbus.ca/RTUslavemanual2.htm, just to make a test.

 

Thanks

David Fiorillo
0 Kudos
Message 5 of 12
(7,607 Views)

dfiorillo wrote:

Ravens,

 

How could I exchange modbus' data between two VIs?

 


How about a regular network based shared variable?

0 Kudos
Message 6 of 12
(7,601 Views)

Ravens,

 

Ok. I need to make sure that the master serial modbus IO server which running in CRIO is communicating with the VI slave modbus which will running in the PC. What do I do?

Change the indicators to the shared variables??? 

David Fiorillo
0 Kudos
Message 7 of 12
(7,582 Views)

Indicators are not the same things as shared variables.  Shared variables are items stored in a library that multiple VI's, even between systems can access.  An indicator is just a front panel display a value that only exists in the context of the VI.

 

Host a shared variable library on one system.  Have the VI on one system write to that shared variable.  Have the VI on the other system read the shared variable and write it to the terminal of the indicator.

 

You can actually take a shortcut.  On your front panel display on your PC, instead of using a shared variable in code that is wired to the indicator, you can use front panel binding for the indicator.  If you right click on the indicator and go to the data binding tab, you can associate that indicator with a shared variable that is a part of a library that is hosted either on that same computer, or on a different computer or target.  When you do it, a little triangular status LED will show up next to the indicator.

0 Kudos
Message 8 of 12
(7,569 Views)
I have tried to run  the VI with your suggestion but it did not worked yet. The serial cable have already was tested. However, the little triangular status LED is showing green but communication it is not working. Please see in the attachment file.

I ran the master and slave SimplyModbus VI in two computers and worked.

What does this VI error means?

Best Regards,
David Fiorillo
0 Kudos
Message 9 of 12
(7,511 Views)

Reavens,

 

I made the test of communication between CRIO and PC via MAX, and worked. The commands were requested from CRIO via TCP/IP, and received, in the PC, via serial. Now, it is just missing to make the VI modbus server works. What does the 1967353902 error means?

 

comunicação.jpg

David Fiorillo
0 Kudos
Message 10 of 12
(7,489 Views)