LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

3 NI-9871 modules on a single VI

Hello, i'm trying to read/write with the modbus library with 9 different serial ports. I have 3 cRIO controllers and every controller has a NI 9871 module with 4 serial ports. I need to make a VI that is able to communicate with all the 9 serial ports  (4 + 4 + 1) simultaneously.

If i connect the VI (Gestione.vi) directly under the controller it works fine. 

 wingSs_3-1646759495900.pngwingSs_0-1646758423060.png

 

The problem is that in this way i can only connect 4 serial ports and i need to connect all of them. So i switched the VI under my computer and in this way i can read all the serial ports (each controller has a different IP).

wingSs_1-1646758550000.pngwingSs_2-1646758601961.png

But modbus doesn't work, i'm not able to read/write anything. Can somebody help?

 

0 Kudos
Message 1 of 13
(1,354 Views)

Do you get an error number or message?

 

Are you sure that the cRIOs are set up to accept connections, on the default port, from your PC's IP address?

0 Kudos
Message 2 of 13
(1,346 Views)

Mhh no.. the VI runs fine but modbus read doesn't show me anything, i have "0" for every address i read.

I'm not sure about the second and i don't know how to do that, maybe that's the key

0 Kudos
Message 3 of 13
(1,306 Views)

I don't have a cRIO so I am not 100% sure how they work, but I do know that with NI-MAX you can set up NI-RIO to allow other systems to access VISA devices over the network (by going to the "Tools -> NI-RIO Settings" menu selection) and that by default it is off.  I would imagine that in the settings for a cRIO somewhere there has to be a similar set of controls, I just don't know if they default to being off as well.  Can you check the right-click menu on the cRIOs you have in MAX to see what shows up?

 

Also, instead of using the MODBUS VIs, where you can't really look inside, try just opening a regular VISA connection using one of the serial ports without using MODBUS... just standard VISA Open, VISA Write, etc. and see if you get errors on those when trying to access one of the serial connections on the cRIOs over the network.  

0 Kudos
Message 4 of 13
(1,295 Views)

 I'll try tomorrow, maybe the first thing you said is the answer, because the VI works perfectly if i place it under the controller. 

 

808fbf36-6ee9-44a4-a68e-87f388b2e15f.jpg3a1c41c8-3d1a-44e8-b3ec-cc7e3b8d0266.jpg

These are the options i get with the device disconnected.

0 Kudos
Message 5 of 13
(1,290 Views)

Why do you need 9 MODBUS masters?  How many Slave devices are there?  You know you can address several slave devices from one master right?  


"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 13
(1,280 Views)

Yes, but i don't know how to do that on the VI, so i just created a master for each slave ( i have 9 slaves, 1 on each serial port)

0 Kudos
Message 7 of 13
(1,276 Views)

@wingSs wrote:

Yes, but i don't know how to do that on the VI, so i just created a master for each slave ( i have 9 slaves, 1 on each serial port)


You do that in HARDWARE by properly wiring your slave devices and assigning them unique addresses.

 

Seriously,  you spent thousands of dollars to add 8 unnecessary modbus masters to save you from Googling MODBUS and reading a tutorial?  (Don't tell your NEXT boss)


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 13
(1,267 Views)

You're right, i'm doing this for a friend tough (only the software part, the hardware was already cabled this way), didn't pay for the hardware :d

0 Kudos
Message 9 of 13
(1,257 Views)

@wingSs wrote:

You're right, i'm doing this for a friend tough (only the software part, the hardware was already cabled this way), didn't pay for the hardware :d


A good friend would mention the silly mistake and show the right way to do it.


"Should be" isn't "Is" -Jay
Message 10 of 13
(1,253 Views)