I have implemented Modbus RTU server in PIC12F1840. My problem is I have not implemented detection of start of message in the server device. Any guidance on how to implement it?
\$\begingroup\$
\$\endgroup\$
4
-
1\$\begingroup\$ It may be useful to you that Realterm can generate Modbus CRC's. Might help you with testing. \$\endgroup\$– Henry CrunCommented May 2, 2018 at 7:10
-
\$\begingroup\$ How come Realterm can be useful to me ? \$\endgroup\$– Nimit VachhaniCommented May 5, 2018 at 4:54
-
\$\begingroup\$ It can send you test packets and generate the CRC. It can display the (binary) that you are sending \$\endgroup\$– Henry CrunCommented May 5, 2018 at 4:55
-
\$\begingroup\$ Actually i have that kind of software that shows the packets being sent and received over the serial line. Well now i am getting the clear idea of detecting the RTU frame start and end. I am thinking for 3.5 and 1.5 char delay detection. The problem that arises is how to calculate 3.5 char delay interms of milli seconds or micro seconds. My standard communication parameters are 9600 baud, 8 Data bits, 1 stop bit and none partiy. \$\endgroup\$– Nimit VachhaniCommented May 5, 2018 at 4:58
Add a comment
|
1 Answer
\$\begingroup\$
\$\endgroup\$
1
According to Modbus protocol, there should be silent intervals of at least 3.5 character times. Character times can be calculated based on the baudrate of serial port.
-
1\$\begingroup\$ You can also have a look, for example, how FreeModbus implements frame detection: embedded-solutions.at/en/freemodbus \$\endgroup\$– filoCommented Oct 4, 2018 at 12:35