Hi Everyone,
I just recently started exploring the modbus protocol. Generally, I get the idea of how modbus protocol works and the structure of a modbus query frame and response frame. However, I am curious on how I will integrate its concept in programming. Here is my idea on how I will implement modbus RTU in programming:
For example, the query that I would like to transmit is 11 04 0008 0001 B298.
In order to transmit it, I will simply need to have a string variable that contains the characters "110400080001B298" and then use a command to transmit that string variable to the modbus slave.
Take for example that the response that I am expecting should be 11 04 02 000A F8F4 (assuming that there will be no errors).
I will use a command to receive an incoming serial data and store that data into a string variable. That string variable should now contain the characters "110402000AF8F4". And then I will just have to conduct several steps to extract the Register Value that I wanted to read from that string variable.
I find that this idea of mine about implementing modbus in programing is too simple to be true or correct. I also have limited knowledge in programming but I really I want to learn how to implement modbus in programming. I'm not really asking for a specific syntax or code. I just want to ask you guys about the idea on how I can store the message that I want to transmit and how I can capture the response of the modbus slave that I am communicating with.
I hope I was able to express my idea clearly and I'm looking forward to reading your feedbacks.
NOTE: I am still waiting for the modbus slave that I ordered to arrive that's why I haven't tested this idea yet.
I just recently started exploring the modbus protocol. Generally, I get the idea of how modbus protocol works and the structure of a modbus query frame and response frame. However, I am curious on how I will integrate its concept in programming. Here is my idea on how I will implement modbus RTU in programming:
For example, the query that I would like to transmit is 11 04 0008 0001 B298.
In order to transmit it, I will simply need to have a string variable that contains the characters "110400080001B298" and then use a command to transmit that string variable to the modbus slave.
Take for example that the response that I am expecting should be 11 04 02 000A F8F4 (assuming that there will be no errors).
I will use a command to receive an incoming serial data and store that data into a string variable. That string variable should now contain the characters "110402000AF8F4". And then I will just have to conduct several steps to extract the Register Value that I wanted to read from that string variable.
I find that this idea of mine about implementing modbus in programing is too simple to be true or correct. I also have limited knowledge in programming but I really I want to learn how to implement modbus in programming. I'm not really asking for a specific syntax or code. I just want to ask you guys about the idea on how I can store the message that I want to transmit and how I can capture the response of the modbus slave that I am communicating with.
I hope I was able to express my idea clearly and I'm looking forward to reading your feedbacks.
NOTE: I am still waiting for the modbus slave that I ordered to arrive that's why I haven't tested this idea yet.