First page Back Continue Last page Overview Text


C language code for a while loop:
//charPtr is a pointer that points to character string
//SendChar(char*) is a function that sends a character out an RS-232 port
//charCnt contains the number of characters to send
} while(charCnt>=0);

This program sends the number of characters specified in a character counter (accumulator B) to subroutine SendChar. The character count must be at least one. Since this is a do-while type loop the test is performed at the end of the loop. The dbne instruction decrements accumulator B and branches back to sendLp as long as B is not zero. When B is zero the code goes on to the next instruction.