First, you didn't include what size your "z" & "i" variables are; var BYTE or WORD? If you declared them as BYTEs then 256 becomes your roll-over value, not 65536. If you are adding and want to check to see if your variable went over 255 and rolled over, the STATUS Register will show "STATUS.C = 1". If subtracting and want to see if it rolled from 0 to 255, "STATUS.C = 0". Look in your data sheet for the STATUS Register and how it works.
Bookmarks