|
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?
|
|
|
|
|
Hello,
I am not able to make the code work.
When I try, with the sample application, to read 32 coils starting at address 1000 (with the button <read coils="">, I always get empty data (zeroes everywhere). In the OnReceive function, id and function are equals to zero and tcpAsyClBuffer is filled with zeroes.
I checked in the slave Modbus, it receives the request and it answers it. I don't know where the data are going?
Thanks for any answer,
Joseph
|
|
|
|
|
Joseph,
could it be that the data simply is zero? You can double check with Wireshark what
data you request and what data you receive in the response. Also keep in mind that
coils are output data. If you want to read digital input data you have to use
discrete inputs.
Stephan
|
|
|
|
|
Stephan,
the function code returned in the answer can not be zero. It must be equal to 0x01 if there is no error or 0x81 if there is an error.
I do not understand why it is zero.
It seems that when the event OnReceive is fired, the tcpAsyClBuffer is not filled.
Joseph
|
|
|
|
|
Ok, I found the problem: everything is equal to zero because the slave didn't answer.
I modified the onReceive function (in modbus.cs) to detect it.
I used the following code:
int nBytesReceived;
nBytesReceived = tcpAsyCl.EndReceive(result);
if (nBytesReceived == 0)
{
CallException(0, 0, excExceptionTimeout);
return;
}
|
|
|
|
|
Hello.
I am Miguel, i am writting to ask about the ModbusTCP class.
I took several days trying to enterder your code.
When I put the IP of the device thtan i want to connect. The grpData grpExchange activated (visible = true), which means it was possible to communicate with the device. It's true.? ..
But when I put the address of the device, such as 400001, and give to the function read input register or holding register, in the textbox fields ... still nothing appears empty ...
I use a traditional SCADA demo to test the connection to the device and it is successful ... I think the problem is not the device
Could you please help me to understand what is happening.?
|
|
|
|
|
Hey There
I wanted to include your library with a sincronous threading. I'm not really getting an error but the problem is, that when I write a command get a response for it, write another one and get the same response for the first command I've written. Can you please help me fix this problem. I can't post much Code, because it's about 15'000 lines.
But I didn't changed anything of your library so please help me. I'm really getting crazy.. ^^
Greetings Farin
|
|
|
|
|
Farin,
the response to a write command is just the number of bytes that were written. So it makes sense that you get the same response if the number of bytes is the same.
Stephan
|
|
|
|
|
I'm sorry to correct you but the response you usually get is the transaction id, the function byte, an exception byte and in case of a read command some data bytes...
That's why I was wondering but I fixed the problem. My Porgram was too fast. It wrote into the buffer when it wasn't even written. ^^
So it's working now and everybody is happy.. yay =)
|
|
|
|
|
Hello,
I'm currently testing your modbus TCP application. How ever I get the following message: No connection could be made because the target machine actively refused it.
I entered 192.168.20.11 in the textfield as this is where it should connect to. Could anyone explain me what I do wrong?
My fire wall is turned off.
Kind regards,
Metroickha
|
|
|
|
|
This error message could mean that port is already in use and the slave is not allowing multiple connections or the slave is not running at all.
|
|
|
|
|
Hello,
Is it possible to communicate to slave devices from asp.net thru TCP?
Thank you
Chris
|
|
|
|
|
I am codding for an allan bradley micro logix 1400 plc. I'm using your class to code for the modbus tcp rtu protocol.
the problem is that the address are in the format N7 , N7:11, B3:200/0, etc. will these address work if i use them in the code or else, how am i supposed to map the adress??
|
|
|
|
|
I have stumbled upon this sample program "Modbus TCP class" and I would like to run it. What software to I need to run it? I have Visual Basic 2010 Express. Is that sufficient? I have done quite a lot of VB6 programming and have written a similar program. Any help to get me started would be most appreciated.
|
|
|
|
|
You need Visual C# to run the sample. The driver itself can run in any other .Net language
but you would not be able to debug any code if you do not have the correct .Net language
installed.
|
|
|
|