Sign in to follow this  
Followers 0
brewer

Modbus Ascii

6 posts in this topic

I am looking for some assistance using a write block of an ASCII message with 984-485E I am presently reading the site and having no issues with the read. The issue i am having is the write. My ascii message is set up as follows : 03 10 04 7E 00 10 5B (crlf) : - start of message 03 - remote plc address 10 - write preset multiple (16 dec) 04 7E - 1150 write block starting at 401151 00 10 - Quantity of 16 5B - Calculated CheckSum -- Not sure if this needs to be there I am under the understanding that I have to calculate this every time so do I leave it out of the message an move it into the control block whic in my cas is as follows 400320 - Port/Error - 3 400321 - Message Number - 21 (where I have my message set-up) 400322 - Number of registers required - 22 400323 - Number of registers transmitted - 22 400324 - Status to Solve - 0 400324 - Unassigned - 0 400326 - Checksum -0000 HEX (is this where I calculate the checksum and add it?) Any assistance would be greatly apreciated Edited by brewer

Share this post


Link to post
Share on other sites
If you are reading from the same starting register and the same number of registers every time then it will never change and you can hard code it. If either the starting register or number of registers changes then it needs to be calculated every time.

Share this post


Link to post
Share on other sites
The read is not the issue it is the write. I think i have to calculate the checksum and put it into the message before I write it.

Share this post


Link to post
Share on other sites
I so seldom run into Modbus ASCII that I have to stop and think. Do you REALLY mean Modbus ASCII, not ASCII characters as data over Modbus RTU? I assume you do because you have the colon delimiter, but it's important because - Modbus ASCII uses 7 bit words, RTU uses 8 bit words - Modbus RTU uses CRC check and Modbus ASCII does NOT use CRC, it uses a one byte LRC value for error checking (does not include delimiters, colon or LRCF). - An ASCII message must start with a 'colon' ( : ) character (ASCII 3A hex), and end with a 'carriage return – line feed' (CRLF) pair (ASCII 0D and 0A hex). - Only allowable data characters are hexadecimal 0–9, A–F (ASCII coded). - timing differences that I can't recall. I think the RTU/ASCII message formats are common, but at this point, it's foggy. The graphic below is an example from the Modbus spec. The slave node ID is not included in the example. If the formats are the same, then you're missing the byte count register and the data bytes all of which contribute to the LRC calculation. The Modbus spec (MODBUS over serial line specification and implementation guide V1.02) has info on LRC calculation Dan

Share this post


Link to post
Share on other sites
Hello, >- Modbus ASCII uses 7 bit words, RTU uses 8 bit words It can be 7 or 8 bits. This is really a serial port setting. Originally, the serial settings were 7E1. 8N1 is more common. Parity checking is less common than in the early days of serial communications. Selecting 7 or 8 bits for the serial stream does not modify the protocol.

Share this post


Link to post
Share on other sites
After talking with tech support I have decided to bite the bullet and purchase a momentum Plc so I can use the xmit block. It ends up being about $1000 but I have done this in the past. The communication is 300 baud 8 even 1 slow but very reliable. I am only reading 16 registers from 3 sites and need to write 16 registers to one site. Thanks for all the comments.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0