Go Down

Topic: CRC byte assembly and disassembly (Read 1 time) previous topic - next topic

sy kristina


I have a stream of bytes with a final crc byte I would like to compare with to check for errors.

in visual basic, it is written like this:
Code: [Select]
For i=o To (n_rx - 2)
 crc += rxbuf(i)
Next i
crc = crc And HFF
If crc = rxbuf(n_rx -1)Then

How would I translate this to arduinian?


You've no supplied the VB code to declare the variables used so I'm assuming you can do this.

Code: [Select]

crc = 0;
for (i = o; i < n_rx - 2; i++)
 crc += rxbuf[i];

crc = crc & 0xff;
if (crc == rxbuf[n_rx - 1])

sy kristina

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131