Texas Instruments MSC1210 Power Supply User Manual


 
Description
6-2
6.1 Description
When the MSC1210 is first initialized the PC SFR is cleared to 0000
H
. The part
then begins to execute instructions sequentially in memory unless a program
instruction causes the PC to be otherwise altered. There are various instruc-
tions that can modify the value of the PC; specifically, conditional branching
instructions, direct jumps and calls, and returns from subroutines. Additionally,
interrupts (when enabled) can cause the program flow to deviate from its
otherwise sequential scheme.
6.2 Conditional Branching
The MSC1210 contains a suite of instructions that, as a group, are referred to
as “conditional branching” instructions. These instructions cause the program
execution to follow a non-sequential path if a certain condition is true.
Let us use the JB instruction as an example. This instruction means jump if bit
set. An example of the JB instruction might be:
JB 45h,HELLO
NOP
HELLO:....
In this case, the MSC1210 will analyze the contents of bit 45
H
. If the bit is set,
program execution will jump immediately to label HELLO, skipping the NOP
instruction. If the bit is not set, the conditional branch fails and program execu-
tion continues as usual with the NOP instruction that follows.
Conditional branching is really the fundamental building block of program logic
because all decisions are accomplished by using conditional branching. Con-
ditional branching can be thought of as the “IF ... THEN” structure of assembly
language.
Note:
Your program may only branch to instructions located within 128 bytes prior
to, or 127 bytes after the address that follows the conditional branch
instruction. This means that in the above example, the label HELLO must be
within −128 bytes to +127 bytes of the memory address that contains the
conditional branching instruction.
6.3 Direct Jumps
While conditional branching is extremely important, it is often necessary to
make a direct branch to a given memory location without basing it on a given
logical decision. This is equivalent to saying GOTO in Basic. In this case, the
program flow will continue at a given memory address without considering any
conditions.
This is accomplished with the MSC1210 using direct jump and call
instructions. As illustrated in the last paragraph, this suite of instructions
causes program flow to change unconditionally.