05-26-2015 11:13 AM
Hi marcos,
You won't be able to run that function by iteself, which is why you're getting the 538179 error. You can ignore that error in this case.
First, double-check using probes where the first error occurs (is it on the read or on the create instance function?)
Second, I'm confused about how your network works. You say its a wireless / modbus serial gateway with a USB interface. The wireless part would imply modbus TCP but then you say its serial. I'd go through and double check the exact variety of modbus required by your device.
Finally, if it is modbus serial, you'll have to double check all of your settings. Some gateways require weird unit ID settings. The serial might be 2-wire vs 4-wire serial (you have to set this with a property node on the visa reference). Run through all the settings in your device manual.
Thanks,
Daniel
05-26-2015 12:15 PM
Hi Daniel.
This is my device and my architecture. I think is serial, correct? In my case, the modbus slave is a PLC.
05-26-2015 01:31 PM
yeah that looks right. If its serial then connecting probably won't be an issue, its more making sure you can communicate with the same settings as the device. Double check the baud rate, parity, stop bits, wire mode, etc.
05-27-2015 12:51 PM
Hi Daniel.
I am not understanding one thing. If my gatway is conected with pc that is the ModbusMaster of my network, this gatway will also function as the ´´master´´ ??? How the master (PC) can read the register values of this gatway? This code that I did can do this??? Resuming, how can I send comands to Gatway if it is the ´´master´´?????? Do I have two master???
05-27-2015 02:03 PM
Looking at pg 6 of the manual (http://www.novusautomation.com/downloads/Arquivos/v11x_c_manual_airgate-modbus_english_a4.pdf) the 2nd configuration, it seems like your PC acts as the modbus serial master and then the gateways automatically pass requests along to each slave. So for example if you send the request "read register 1 from slave 5" it will broadcast that request to any attached slaves (#1,2) and any slaves attached to the wireless devices.
As a starting point, I'd recommend just following the manual and configuring your system to have a single master, a single slave (#1 in the image) and a single gateway ("USB-master" in the image). That way you can confirm that requests are correctly passed to the connected slave. Then try to build up the rest of your network.
05-28-2015 01:15 PM
I´d like to see an example network for help me. is it possible provide one?? I dont have DSC or Real Time modules.
05-28-2015 04:16 PM
I'm not sure what you mean. You don't need DSC or real-time modules to use this library. Labview 2014 does include this library if you have RT or DSC, but you can still install the package separately.
As for an example network, what I was saying is you should try to do what is shown in the manual on pg 6 and just create a simple configuration to make sure you can communicate with your device. In the example on that page, you'd effectively have:
PC (Modbus Master)->Wireless gateway (Modbus slave)
Wireless gateway (Modbus master)->Device 1 (Modbus slave)
Based on what I've read I believe the real situation is:
PC (master) sends request to gateway
gateway sees request, forwards request to all physical and wireless devices
device #1 (slave) sees request and sends response
gateway sees response and forwards to PC (master).
From the PC's point of view, everything operates normally.
If you can get this simple network up and running I think you should be able to get a larger one working.
05-29-2015 11:52 AM
Sorry Daniel, but what I want to say is that I need an example of how is the project to start communicating with Labview. I tried these projects that is on the forum but I didn't have feedback. I want to know how to use this library, how to assemble the API in labview to start reading my PLC registers. Are there any projects to help me using this library and how to make the serial communicating? There was no error in the last attempt , but it didn't read anything either. Thank you.
05-29-2015 03:04 PM
There is an example on the master palette which demonstrates the use of the library. It only supports TCP right now, but you can change the selection in the connect case from New TCP Master to New Serial Master and the example should work.
The code you already have in that screenshot is close to a workable example except you are creating a new slave on your PC. You want to create a master as in your original screenshot. Otherwise what you have is the minimum for reading holding registers from your device. That code should work once you select "New Serial Master" instead of "New Serial Slave". The only other thing you'll have to do is make sure that your settings match. Once you've done those two things you should be able to communicate with your device.
06-11-2015 04:05 PM
Hi smithd-
First, thank for all your work with this. I spent the last couple hours reading all of the posts in this thread. Very helpful! Your diligence in responding and answering questions here is impressive.
A bit about my application. I'm using the API to create a PC interface, communicating with a cRIO using Modbus over TCP. Another developer here wrote the modbus part for the cRIO from the ground up. I want to use this API instead because it's cleaner, and hopefully more efficient (and now supported by NI in RT/DSC).
All of the functions here work with their implementation, so that's a good check for both sets of code. The only unique thing is that it's written such that the cRIO and the PC both are a master and a slave. I haven't seen this discussed anywhere, but I don't think that's a problem, is it? Anyway, everything that's been implemented is working fine. I have my code, using this API, setup to function as both master and slave and I'm reading all data fine.
Despite all of the info in this thread, and info from the web, I still have a few questions:
1. Custom functions. They've implemented function code 65 (x41) to pass a large amount of waveform data. I thought I saw a post here that might have been what I wanted, but I wasn't clear on how to actually do it. I'm not familiar with OOP at all. I did see the link posted to the LAVA presentation, which I'll look into right after this. I'm guessing this extra function gets added to the "Standard data model"? Is there an example I missed in the thread? or maybe a short/very brief bulleted list of steps would help? Whatever response, I think I just need to be pointed in the right direction.
2. For the slave, how can I tell when the master has written a value to me. Data needs to be shuffled off to other loops as soon as it's recieved. We have a very large list of registers and reading all of them sequentially, or otherwise, is not going to work well. I'd like to monitor for this incoming data from the master, determine the register, and move the data in a direct, timely fashion. Can I pull out the modbus response somehow? or maybe get some notification I was sent an update from the master?
3. I took your advice earlier on snooping the network to help debug and downloaded Ethereal and the CAS Modbus TCP parser. I haven't been able to get the parser to work, no matter what I've tried, it says no modbus messages found. Whatever. From the Ethereal logs though I did notice that TCP CRC fails checksum fails on all queries and responses from the API. The cRIO (custom modbus code) did not have this issue. Have you seen this before?
4. We're only using holding registers. No input, coil, or discrete. I'm wondering how big a performance hit I'm taking by initializing those 65xxx size arrays for each of the extra 3 data types, passing them around, and then never using them? What are your thoughts on removing them for better performance?
Thank you.
-John
Edit by J.Harv: The checksum is incorrect according to Ethereal, not specifically CRC (a type of checksum). I don't know what the specific checksum method used is