Modbus Functions 22 And 23 And Lrc


txturbo

Recommended Posts

I wanted to use an existing MODBUS ASCII Protocol to communicate with a device but no I/O type exists for the functions 22 and 23. 

 

SO I started to make a custom protocol. I can get the communication to work if I know the exact string to pass including the LRC. 

 

I assume that the MODBUS ASCII Protocol that is per configured can do this? Is it possible to edit this protocol so I can add function 22 and 23? 

 

 

 

 

 

 

 

Link to comment
Share on other sites

I have to ask why you need these functions.  22 you can do by simply reading the register, using the bit functions to set/clear the bit, then writing the result.  23 is just a combination of read and write in a single call and can be done in two calls.  Unless you are totally bandwidth limited, I don't see the need for these functions, nor, apparently has anyone else since this is the first request for them in 13 years.  I'm not downplaying your need, I just want to make sure you realize there are alternatives.

Link to comment
Share on other sites

Thanks for the response. There is not a bandwidth problem, the device is old and seems to be limited in it's ability to respond to commands.  

 

This is from the communication spec of the device:

 

 

            5. Current usage  supports Function Codes 23 (Read/Write 4X registers) and

                22 (Mask Write 4X registers).

 

            6. Each unit will provide communication for 1..16  (i.e. Channels).  Each channel will be associated with

                an Input and Output Segment in 4X memory. Input Segments are contiguous in

                4X memory and are in Channel Number order.  Similarly Output Segments are

                contiguous in 4X memory and are in Channel Number order.  The Modbus master

               will read locations in the Input Segments and will write and read

                locations in the Output Segments using functions 22 and 23.

 

            

            7. The Modbus master, will determine the rate the various parts of

                  4X memory will be read and written (using Modbus functions 22 and 23).

 

          

 

Are you suggesting that I can use the MODBUS ACSII Protocol? If so what I/O type would work? 

Link to comment
Share on other sites

If the device only supports 22 and 23, then no you can't use the existing protocol.  I was suggesting that you could do the same thing using other functions, but only if the device supported those other functions.  We can likely add functions 22 and 23 to the ModbusASCII protocol, but there would be some small NRE charge to cover the time as this is not a feature anyone else is likely to use.  You should email us directly at support @ to discuss further.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.