hello, half bytes are coming into the buffer, how do I select two half bytes and connect them to get the code in ASCii C1? Command to the port 8F C1 FF FF 5D
I take two characters from the buffer and want to connect them and send them back to the port buff[3] C + buff[4] 1 = It should work С1 I do not know how to do this.
If you receive "C1" as text and want to convert it to a number, you can look at strtoul; the page also links to an example on strtol(3) - Linux manual page.
Your question has nothing to do with IDE 2.x or any other version of the IDE. I have moved it to the Programming section of the forum. Before you post in future, please read the sticky post at the top of the forum section to understand what questions would be appropriate there.
Useless facts:
In Swedish it is nibble. I guess they took the word, Swedishized it because they couldn't stand borrow a word straight flat, and so it ended up being another English word. Or they only heard the word and thought it was nibble.
➜ the first two lines convert an ASCII character representing hexadecimal digit into a single byte by decoding each character to its numeric value (relying on the fact that in ASCII code the numbers and letters are consecutive so subtracting '0' or 'A' and adding 10 gives you the value )
then it's just shifting the high nibble by 4 bits to the left and combining it with the low nibble using a bitwise OR to get the right HEX value and storing the result.
your code is very good, I checked it, it works, thank you, this symbol is C1. in fact, it gives permission for the further operation of the entire program, then the same data will come to the port, but with the last two bytes variable, but I will apply your code for the last operations, thank you again
I took one procedure and worked it out without involving the main code, then I will insert this part into the main loop, I had to figure out how to solve the problem.