View Single Post
  #13   Spotlight this post!  
Unread 04-10-2005, 23:04
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: 16 bit math on PIC

Quote:
Copied from http://www.mstracey.btinternet.co.uk...l/progtut8.htm
This carries on until 0C equals 127. This time, when we increment 0C by 1, 0C will now equal 0. Our INCFSZ instruction will then tell the PIC to skip the next instruction, which in this case is the goto statement, and so the PIC will continue with the rest of the program.
I believe that is simply an error in the tutorial. Other references describe the INCFSZ instruction more reasonably, saying that incrementing 255 yields zero. (The tutorial's example of usage is rather odd as well; apparently the author thinks it's a good idea to waste time incrementing a file/register until it overflows, rather than quickly setting it to zero. In my experience, "skip on zero" instructions are more often used to escape a loop, rather than to make a minimally short one.)