You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Emiliano.
I want to congratulate you on your great work in this libraries.
It really is very useful to me.
I have just taken my first steps in the world of code and I consider myself a great ignorant.
I want to make a comment regarding the CRC check.
In your code you use a table of values for CRC.
In this library the CRC calculates it, I don't know which of the 2 ways are more efficient but I wanted to share it since it might be useful.
I hope I am not being too bold in making this comment.
A big greeting and thanks again for your work.
Here is the address: https://github.com/angeloc/simplemodbusng/blob/master/SimpleModbusSlave/SimpleModbusSlave.cpp
the part of code i mean:
unsigned int calculateCRC(byte bufferSize)
{
unsigned int temp, temp2, flag;
temp = 0xFFFF;
for (unsigned char i = 0; i < bufferSize; i++)
{
temp = temp ^ frame[i];
for (unsigned char j = 1; j <= 8; j++)
{
flag = temp & 0x0001;
temp >>= 1;
if (flag)
temp ^= 0xA001;
}
}
// Reverse byte order.
temp2 = temp >> 8;
temp = (temp << 8) | temp2;
temp &= 0xFFFF;
return temp; // the returned value is already swopped - crcLo byte is first & crcHi byte is last
}
The text was updated successfully, but these errors were encountered:
@Merdock1 CRC calculation with helper table (that used by the library) is way faster.
But your post has remind me that it's required to add table-less implementation for Arduino UNO and others PCL (to reduce memory footprint).
Hi Emiliano.
I want to congratulate you on your great work in this libraries.
It really is very useful to me.
I have just taken my first steps in the world of code and I consider myself a great ignorant.
I want to make a comment regarding the CRC check.
In your code you use a table of values for CRC.
In this library the CRC calculates it, I don't know which of the 2 ways are more efficient but I wanted to share it since it might be useful.
I hope I am not being too bold in making this comment.
A big greeting and thanks again for your work.
Here is the address:
https://github.com/angeloc/simplemodbusng/blob/master/SimpleModbusSlave/SimpleModbusSlave.cpp
the part of code i mean:
The text was updated successfully, but these errors were encountered: