|
This is what I'm looking for,
Thanks
|
|
|
|
|
|
Hi,
I am trying communication between my PC and Siemens PLC with MODBUS TCP. PLC is a server, and I set "P#M100.0 BYTE 200" to holding register. I am using first 100 bytes for reading with no problem, but writing to the second 100 bytes doesn't work. I am using WriteMultipleRegister(6, 100, data), everything looks OK and no error msg, but value didn't change on the PLC side.
Could anyone please help?
Thanks a lot in advance.
Anne
|
|
|
|
|
Anne,
Can you please download wireshark and add some traces? This will tell us what data is sent and the response from the plc.
Stephan
|
|
|
|
|
Hi Stephen,
Thanks for your reply.
As you suggested, I tried wireshark, and was using your MODBUS tester to test the communication. It seems that for writing multiple registers, the start address couldn't go over 84. If start address is bigger than 84, for example 85, PLC will give out exception.
I saved the file and screen copy, but not sure how to attach it to this message.
and I am new to it, maybe did something silly.
Thanks,
Anne
|
|
|
|
|
Anne,
somewhere in the Siemens PLC there must be a configuration where you define the size of your Modbus buffer. It seems that you buffer is 84 plus the amount of data you try write. When you write to addresses below 84 do you see the values in the Siemens PLC?
Stephan
|
|
|
|
|
I am kind of get it. In my case, if the second 100 bytes are for writing, then the start address should be 50 instead of 100.
Is it right?
thanks,
Anne
|
|
|
|
|
did you resolve the problem!?
If yes could you contact me at andrea.feduzzi@gmail.com or post below.
I use siemens s1200 series
thanks
|
|
|
|
|
Hi thanks for the code but i am having a slight problem
Connection to the PLC is succesful but i cant seem to write coils.
I am using your test application.
Problem:
The Start address is at 0
The Size is 8 Bytes
I can write the first coil but when i try to write the second one it does not work
I have tried writing multiple coils but still it does not work. May I no why this is happening and how i can solve it
|
|
|
|
|
What error message do you get? Can you create a network trace with Wireshark?
|
|
|
|
|
I have Visual Studio 2008 and Framework 3.5 SP1
after convertion, a have error
'no overload for 'MBmaster_OnResponseData' matches delegate 'ModbusTCP.Master.ResponseData'
and others
which Framework or version VS should be correct for compile without convertion?
|
|
|
|
|
The framework that I used was 2.0 but it should work with newer frameworks as well. The message that you get sounds like the number of parameters that you define ResponseData function is not correct.
Stephan
|
|
|
|
|
I am not familiar with the visual studio tools, but I expect to be able to figure it out.
However, I cannot open the solution with the free download Visual Studio Express (VB and C# installed)
Can someone please give me a step by step on how to get started.
Thanks.
|
|
|
|
|
The source code should work with VS2010. What exactly happens when you try to open it?
|
|
|
|
|
Ah, I fixed it. I was confused about which tool to use, and ended up with the 2012 desktop version, which works really well.
Thank you !
|
|
|
|
|
Hi,
Thanks for this amazing API. Btw, I am able to write, but unable to read. No error message given. Did someone have that bug too?
Thanks.
Alex
|
|
|
|
|
If you dont see an error message everything should be fine. Can you create a Wireshark trace from the data exchange and post it here?
|
|
|
|
|
I am testing function code 23 using synchronous mode. I can get the command to work but am having some difficulity getting my code set up to check for exceptions, I wanted to make sure the command was executed sucessfully before processing the results. I was hoping to find a simple code sample that would show the proper way to check for exceptions.
|
|
|
|
|
Stephan, I tested your software in VisualStudio2008 and after some conversion processed by the environment, I compiled and worked perfectly without modifications.
I tested this software with a Modbus/TCP simulator from a company called EmbeddedIntelligence.
Excellent job.
|
|
|
|
|
Hi,
Thank you for shearing this code.
I just compiled your sample code and i'm having few problems...
few seconds after connecting and reading any data from HMI(Beijer iX), program disconnects(connection is lost).
Then i try read holding registers from HMI(40001-40005), the results i get is like that..
http://imageshack.us/photo/my-images/269/deletelt.png/[^]
data is correct but it is misplaced or something like that..
thank you.
|
|
|
|
|
The values may look wrong because you read them as BYTES. Most analog values in modbus are WORDS so if you changes the selection at "Show as" to word it should be correct. Some slaves also have a communication heart beat. This means that once you connect you have to send a reuqest every x seconds. Otherwise the slave will auto disconnect.
|
|
|
|
|
|
Hello, I get this error: (Modbus says error: Illegal function!) When working with a simulator called "Modbus Slave", but if I taste with another called "mod_RSsim" works perfectly, the same error I get when I connect to a device physical Modbus TCP. Is it a compatibility issue with some other Modbus protocol?
|
|
|
|
|
The error means that you try to call a function code that is not supported by the slave or you try to call a function to an address that does not allow this function. This error comes from the slave.
|
|
|
|
|
Thanks for the reply, I am using the sample application (Sample Modbus Common), without modification, then I don't think the error is to call a function or bad register, because the application properly written on the register configured by pressing the "Write multiple register - Write single register - Write multiple coils - Write single Coil" but no function of reading, in any of them I get this error. As I mentioned before this only happens to me with the simulator (Modbus Slave[^]) and the actual device, with other simulator (mod_RSsim) all functions are working properly. What can be?
|
|
|
|