In SX Microcontrollers, SX/B Compiler and SX-Key Tool, g_daubach wrote: When looking at the instruction set of a processor/controller, in most cases, you will find some instructions that make you think "what are these good for?". Don't worry, one day, you will be glad that they are there. For example, when I started with the SX I was wondering about the SKIP instruction, asking me why should I ever use an instruction that always skips the next one, I could always leave out the SKIP and the next instruction. Later, when dealing with code to handle the I²C protocol, I found a good use for SKIP: To handle the bus timing, you sometimes need a delay routine for a certain period - let me call it T1 here, but sometimes you need to delay twice as long, i.e. T * 2, or T2. Here is a code snippet for this using the SKIP instruction: DelayT1 mov w, #Delay SKIP DelayT2 mov w, #Delay * 2 mov DelayCounter, w :Loop decsz DelayCounter jmp :Loop ret As you can see, the SKIP is used here to skip the initialization of W for the longer delay in case DelayT1 is called. Using SKIP instead of a JMP requires two clock cycles instead of three - not a big deal but "tricky" :-) . ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=60809#m83344 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)