Just off the top of my head, it sounds like there may be a data type issue (using an unsigned 8-bit integer) which causes it to be +49 (binary 100110001 becomes 00110001, which is 49). However, I don't currently have easy access to the source code, so I don't have any way to verify this. If that is the case, though, we just need to mess with the code a bit to make sure we don't overflow like that, either by changing the data type for run speed to 16-bit, or running checks using 16-bit before making it 8-bit.
|