<< Chapter < Page | Chapter >> Page > |
The assembly program begins execution at the reset interrupt. The reset interrupt is the first thing that occurs when power is given to the processor. By default in the Rowley files, the reset interrupt is loaded to send the execution of the program to the start of the .code segment. Until a branch is reached, the processor will execute each instruction in turn. If the program does not loop back to an earlier point to keep going, eventually the execution will reach the end of the valid instructions in memory. You should never let this happen.
The control of a programs execution is called control flow , and it is accomplished through branching, jumping, function calls, and interrupts. Interrupts are the subject of future labs. Branching and jumping refer to changing the next instruction from the next one sequentially to an instruction elsewhere in the program. By branching to an instruction above the branch itself you can cause the program to repeat itself. This is a basic loop in assembly. Branches can also be conditional. In the MSP architecture conditional branches are generally dependent on the status register (SR) bits to decide whether to execute the next instruction after the branch or the instruction the branch specifies. Many arithmetic and logical operations can set the relevant bits in the status register; check the MSP430 User’s Guide for which ones you will need.
Once you understand the basics of assembly you should be able to write some simple routines.
Notification Switch
Would you like to follow the 'Microcontroller and embedded systems laboratory' conversation and receive update notifications?