guney eser

Crc Calculate For Modbus Comm.by Using Ladder

10 posts in this topic

How can i calculate crc checksum easly by using ladder diagram with omron cpm2a plc.. Is it possible?

Share this post


Link to post
Share on other sites
Not sure this will help, but have you looked at the FCS instruction?

Share this post


Link to post
Share on other sites
No, because FCS != CRC. FCS basically just is all the ASCII values XOR:ed together, and then converted to two hex digits in ASCII format. A very simplistic checksum! CRC is far more advanced than that - please see http://en.wikipedia.org/wiki/Cyclic_Redundancy_Check for a complete explanation. The question still stands though - does anyone have a ready implementation on PLC:s for CRC calculations? It's not very fun to have to do it from scratch! (It still should be possible - it should be enough to have XOR:s and shifts - and both are available in CPM2A:s. But that really doesn't mean you're going to like coding it). Edited by TERdON

Share this post


Link to post
Share on other sites
thanks for all reply ; i know fcs inst.and its not same crc . I think I must coding! :(

Share this post


Link to post
Share on other sites
my opinion is, it is possible if u have sufficient Holding memories to store the precalculated polynomial tables. because the rest will b just bit shifting and simple calculations, yet still too lengthy for ladder diagram, better use listing code and make it into a subroutine.

Share this post


Link to post
Share on other sites
There is some example ladder code available on this site... http://forums.mrplc.com/index.php?autocom=downloads&showfile=512 I have also attached another example I wrote a while back. The algorythm to calculate the CRC is available from modbus.org Nibroc Modbus_TOS_Slave.cxp
1 person likes this

Share this post


Link to post
Share on other sites
I did this a long time ago with an Allen Bradley SLC500. I used a lookup table approach. I can't remember any of the details but I had some documentation concerning CRC calculations that showed how it worked. Jim

Share this post


Link to post
Share on other sites
The link to the MrPLC.com download section in the post from Nibroc contains a subroutine for calculating CRC16.

Share this post


Link to post
Share on other sites
... And also the sample code I posted above uses subroutines to calculate the CRC16 using ladder. You should be able to adapt one of these examples to suit. I would recommend using a separate program to check your ladder code is generating the correct CRC during commissioning, eg Omron Multiway will auto generate the CRC for any modbus message. See also the attached document section 6.2.2, this describes the CRC generation algorythm for modbus. Modbus_over_serial_line_V1.pdf

Share this post


Link to post
Share on other sites

Hi 

I want to use  CP1W-CIF11 with CJ2M to simply operation with Modbus RTU. I tried to find ladder code for calculating CRC16 but I can't find it in download section.

 

Can you help me

 

thanks

 

 

 

 

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