Code covered by the BSD License  

Highlights from
Append crc for modbus

4.4

4.4 | 5 ratings Rate this file 17 Downloads (last 30 days) File Size: 1.29 KB File ID: #11738

Append crc for modbus

by Brian Keats

 

19 Jul 2006 (Updated 19 Jul 2006)

Appends the crc for modbus serial communication

| Watch this File

File Information
Description

Takes an array to be sent to a modbus device using serial communication and appends two crc bytes for error checking.

MATLAB release MATLAB 7.0.1 (R14SP1)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (8)
20 Jul 2006 Stephan Lennartz

It's not clear whether the CRC algorithm is a very private one or that with a commonly used polynominal factor (see something with CCITT). The receiver has to check the CRC with the same algorithm.
And why computing byte-wise a 16-bit CRC ?
In my experience the offical 8-bit or 16-bit CRC algorithm works best with a 256 byte/word look-up table.

20 Jul 2006 Brian Keats

The algorithim is right out of the modbus specification www.modbus.org/docs/Modbus_over_serial_line_V1.pdf I only posted it here to save someone else from having to do it themselves. As for the table lookup option, I couldn't find one for the particular version of crc used in the modbus protocol.

02 Aug 2006 kamal kannan

I want matlab tool mother

Regards
s.kamalakannan .

10 Jan 2007 elif vural

nothing

01 Apr 2007 mohamed sa

very good

03 Aug 2007 Andriy Nych

Thank you. You really saved me some time.

22 Apr 2008 Bruce Cabral

i have tried gfdeconv(data,polynomial,2)
but it gives wrong results
your code saved me

04 Jun 2008 Jorge Higuera

this algorithm use the polinomy X16+X14+1. For others users can change this polynomial for other, for example the CRC CCITT = 1021

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
modbus Brian Keats 22 Oct 2008 08:32:57
crc Brian Keats 22 Oct 2008 08:32:57
watlow Brian Keats 22 Oct 2008 08:32:57
error checking Brian Keats 22 Oct 2008 08:32:57
serial communication Brian Keats 22 Oct 2008 08:32:57
modbus Steven 22 Jan 2010 13:23:42
modbus christian maier 09 Feb 2012 10:50:20

Contact us at files@mathworks.com