02-07-2014 09:50 PM
Hello Smithd,
Thanks for this great library, it looks like it will be perfect for my application, unfortunately I haven't got it to work yet. I'm using the serial master version from a PC with USB to RS485 FTDI serial converter to communicate to a single slave device. I want to read approximately 30 input registers and read and set around 70 holding registers. I've confirmed operation of the setup using Modbus Poll and it all works smoothly. I am trying to use your Labview modbus library modbus master example which I change to serial master and set all the communication parameters and device ID. When I 'fetch input registers" or "fetch holding registers" I get the following error:
Error -1073807253 occurred at VISA Read in ASCII Data Unit.lvclass:Read ADU Packet.vi:5030001->Modbus Master.lvclass:Read Input Registers.vi:5450001->Modbus Master Example.vi
With a scope I can see that the command is sent from the master and response is sent from the slave (length of response varies with number of input registers address requested). Any suggestions on what I can try to fix this read error would be much appreciated!
Thank you,
Terry
02-10-2014 02:21 AM
Hello Smithd
After few readings I have unknown "Error 538170 occurred at" with no source. I am reading 88 input registers and 32 discrete inputs.
I have also similar problem as OFG, sometimes i have received
Error -1073807253 occurred at VISA Read in RTU Data Unit.lvclass:Read ADU Packet.vi:5030001->Modbus Master.lvclass:Read Input Registers.vi
This error does not occur so often as Error 538170
Thanks Joz
02-10-2014 03:23 AM
Hello Smithd
one more trouble I will try my best to explain my problem
I created Modbus server through this library in my cRIO. There is another application running parallel which is updating Modbus Registers in cRIO. Then want to read the modbus registers by any master device or application. I am succesfull in creating this application and can read/write the modbus registers of the slave cRIO .
My problem is that i dont want that anyone can write the modbus registers of my cRIO . I want that only i should have authority to read and write the modbus registers and others can only read the registers. In short, is there any way to restrict the master to read or write the slave registers ?
I hope i cleared my point
Thanks in Advance
Varun
02-10-2014 03:29 AM
Just use the correct register type.
A Modbus master can only set Holding Registers. Input Registers on the other hand are Read Only.
Regards, Jens
02-10-2014 11:08 AM
OFG wrote:
Hello Smithd,
Thanks for this great library, it looks like it will be perfect for my application, unfortunately I haven't got it to work yet. I'm using the serial master version from a PC with USB to RS485 FTDI serial converter to communicate to a single slave device. I want to read approximately 30 input registers and read and set around 70 holding registers. I've confirmed operation of the setup using Modbus Poll and it all works smoothly. I am trying to use your Labview modbus library modbus master example which I change to serial master and set all the communication parameters and device ID. When I 'fetch input registers" or "fetch holding registers" I get the following error:
Error -1073807253 occurred at VISA Read in ASCII Data Unit.lvclass:Read ADU Packet.vi:5030001->Modbus Master.lvclass:Read Input Registers.vi:5450001->Modbus Master Example.vi
With a scope I can see that the command is sent from the master and response is sent from the slave (length of response varies with number of input registers address requested). Any suggestions on what I can try to fix this read error would be much appreciated!
Thank you,
Terry
Hey Terry, as indicated by the help, that error indicates a framing error:
VISA: (Hex 0xBFFF006B) A framing error occurred during transfer.
Unfortunately, I cannot reproduce this. As such, my initial recommendation would be to confirm that your serial port is configured exactly the same on both ends. If you have confirmed this, try version 1.2.1 of the library here and let me know if you still recieve this read error.
Thanks,
Daniel
02-10-2014 11:26 AM
Jozo wrote:
Hello Smithd
After few readings I have unknown "Error 538170 occurred at" with no source. I am reading 88 input registers and 32 discrete inputs.
I have also similar problem as OFG, sometimes i have received
Error -1073807253 occurred at VISA Read in RTU Data Unit.lvclass:Read ADU Packet.vi:5030001->Modbus Master.lvclass:Read Input Registers.vi
This error does not occur so often as Error 538170
Thanks Joz
It looks like you are also receiving the framing error. Please confirm your settings. 538170 ("The returned function code does not match the requested data." as indicated by the help) means exactly what it says--the function code you sent does not match the one returned. Because RTU is the way it is, this could mean one of the following, or probably a bunch of other potential causes:
My recommendation would be to (a) ensure your settings are correct on both ends to eliminate the framing error and (b) run the debugging code I posted. [Actually I have an update which I've attached here, but you'll need to follow the instructions in the previous post].
02-10-2014 11:30 AM
Varun_ECK wrote:
My problem is that i dont want that anyone can write the modbus registers of my cRIO
. I want that only i should have authority to read and write the modbus registers and others can only read the registers. In short, is there any way to restrict the master to read or write the slave registers ?
Depending on the specifics, you can either do as jg says and split items between input and output (holding) registers. Inputs are read-only, holding are read/write. However it sounds like you might want to restrict access by IP address. At present there is no facility for doing this in the code, and I don't believe modbus allows for this either. I can limit the number of simultaneous connections (already in the code), and restrict an entire connection (easy to add), but I can't specify that IP address X can call some function code while Y cannot. Hope this clarifies the capabilities. Again, this is mostly due to staying pure to modbus. Theres some papers out there about securing and authenticating modbus, but to me thats shoehorning a 40 year old protocol into a use case for which it was never intended
Thanks,
Daniel
02-12-2014 01:56 PM
new version.
fix: serial RTU, improved error handling in case of packet errors.
02-12-2014 03:24 PM
Hi smithd ,
I have just downloaded the latest Modbus VI Library. If you recall from my PM, I want to be able to communicate with an Emerson servo drive using Labview. After much reading, I have been able to identify the registers needed for motion control on the Emerson drive. A few of them for instance are 'Digital input 1 is in the 40821 modbus register for the servo drive, digital input 2 is on the 40822 modubus register' and so on. (Parameters in the drive are prefixed with 4 as all of the drive parameters are mapped to register file 4, which is a Read / Write 16bit register in the servo drive).
The Emerson servo drive supports Modbus RTU. Communication with a laptop and the drive is through a USB serial converter. When connected to my laptop, NIMAX identifies it as ASRL3::INSTR "COM3", is this correct, or does it have to manufacturer specific?
I want to use your library to read and write to these registers, as each represents different types of motion control (run forward, run reverse, jog, etc). My laptop would be the master and the drive as slave. I think it would be better for me to use your library than the Modbus I/O server within Labview as this is my first project with modbus and I do have the Labview DSC module.
Please where and how do I start? Can I please have an example code that explains this type of modbus communication? Even if its just a pointer as to how I can read and write to one register to perform motion. Thanks in advance
02-13-2014 09:26 AM
Thanks Smithd for the solution
I am also getting error as a master querying slave addresses i.e
Error 538179 occurred at Network Master.lvclass:Shutdown Master.vi
Possible reason(s):
The object used has been invalidated. A method was called on an interface class.
Interestingly i am getting the register values. I am getting this error only shuting down the connection.
Thanks in Advance
Varun Garg