LRC check
I am programming a program which will talk to a plc. I use the modbus protocol to communicate with it in C. But you have to do a LRC check and send that with the data. Does someone know how you do a LRC check? And if perhaps someone knows something more about the modbus protocol(how it works, where i can find more info)let me know.
Thanx in advance
We use modbus PLCs here, but I didn''t write the code for them. Are you sure it isn''t a CRC ?
Magmai Kai Holmlor
- Not For Rent
Magmai Kai Holmlor
- Not For Rent
No i am sure it is LRC check. Do you know anything about that. And do you know some documentation about modbus protocol?
We probably have some documentation around here somewhere... I peeked at our modbus code and it uses a CRC. And as I understand it, Modbus is an industry standard - so I'm about 99% certain it's a CRC. Perhaps cyclic begins with an L in another language??
And, oddly enough, there' a www.modbus.org
Edited by - Magmai Kai Holmlor on October 23, 2001 12:08:36 AM
And, oddly enough, there' a www.modbus.org
Edited by - Magmai Kai Holmlor on October 23, 2001 12:08:36 AM
CRC = Cyclical Redundancy Check
LRC = Longitudinal Redundancy Check
LRC's tend to crop up in serial data communications. (Mixed memories from many many moons ago of getting a Nippondenso barcode reader to talk to an Archimedes ;-)
LRC = Longitudinal Redundancy Check
LRC's tend to crop up in serial data communications. (Mixed memories from many many moons ago of getting a Nippondenso barcode reader to talk to an Archimedes ;-)
unsigned char get_lrc( unsigned char* data, int size ){ int i; unsigned char sum = 0, unsigned char checksum = 0xff; for (i=0; i < size; ++i) { sum = sum + buf;<br> }<br><br> for (i=0; i<8; i++) <br> {<br> if ((sum & (1 << i)) > 0)<br> {<br> checksum = checksum & (0xff ^ (1 << i));<br> }<br> }<br><br> ++checksum;<br><br> return checksum;<br>}<br> </pre> <br> <br><br>–<br>Simon O'Connor<br>Creative Asylum Ltd<br><A HREF="http://www.creative-asylum.com">www.creative-asylum.com</A><br><br><br><br>Edited by - S1CA on October 24, 2001 9:25:23 AM<br><br>Edited by - S1CA on October 24, 2001 9:26:23 AM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement