:sigh:
You aren't listening, are you? When you asked this question:
Cannot implicitly convert type 'int' to 'bool'[
^] I said:
Quote:
When you find code on the internet in one language and try to use it in another, you have to understand three things:
1) The source language - in this case C or C++
2) The destination language - in this case C#
3) What the code does, and how it does it.
And that is exactly what I meant.
You need to understand both languages; you can't just dump C code into C# and expect it to compile! Worse, even if you get it to compile cleanly, there is no guarantee at all that it will work in exactly the same way as the original code did, these are
different languages which share some common syntax.
So think about what is going on, rather than just blindly trying to get others to translate it for you...
In this case, you are trying to put an integer value into a byte variable, and C# won't let you "just do that" because the operation "throws away" information and it want's to be sure you know that is what you are doing.
Change this:
MCUData[frame_length] = crc_register >> 8;
And all similar code to this:
MCUData[frame_length] = (byte)(crc_register >> 8);
and this error message will disappear.
You still need to be aware that you cannot expect the code even when it compiles to work exactly the same as the original unless you comply with all three of the conditions above!