I have a variable sequence of values from a canbus, these are markers, and for error detecting.
Basic sequence in hexadecimal is;
20 to 2F repeating,
there are markers within, if the packet contains the first byte intended for use as ASCII, 25 would become 5 or 2C would be C.
The end marker is 15 where a normal msg is 25.
I wrote some instructions to predict the next value in the chain if it is the last:
21 /1, next val, if last = 12
2C /C, next val, if last = 1D etc
until I get 2F and predict my end msg as 20 instead of 10, I know I can if() my way out of these quirks but...
It looks like I should be doing something with the bits/bytes and not using decimal math.
Norm. ASCIIstart Predict end val
0010 0001/0000 0001 = 0001 0010
0010 1111/0000 1111 = 0001 0000
Not a clue where to start in code, names and pointers please