Instruction Set - PowerPoint PPT Presentation

1 / 24
About This Presentation
Title:

Instruction Set

Description:

For a detailed description of each instruction see Appendix A of ... bhs CONTINUE. addd #%1. bra TASKA. TASKA: ... bra FLOOP. CONTINUE: ... Example in Assembly: ... – PowerPoint PPT presentation

Number of Views:14
Avg rating:3.0/5.0
Slides: 25
Provided by: UH73
Learn more at: http://www.ewu.edu
Category:
Tags: bhs | inca | instruction | set

less

Transcript and Presenter's Notes

Title: Instruction Set


1
Instruction Set
  • Introduction to Microcontroller Programming


2
Instruction Set
  • See the Instruction Set summary in the
    Programming Reference Guide (pp.13-21)
  • For a detailed description of each instruction
    see Appendix A of the Reference Manual
    (pp.487-604)

3
(No Transcript)
4
(No Transcript)
5
Arithmetic Instructions (2)
6
Arithmetic Instructions (3)
7
Example 16-bit addition
8
Logic Instructions
9
Data Testing and Bit Manipulations
10
Example
11
Shift and Rotate Instructions
12
Example
13
(No Transcript)
14
CCR Instructions
15
Program Flow Control
  • High level programming structures
  • if-then-else
  • while loop
  • for loop

16
if-then-else
Example in C if v2 gt v1 is_greater() else
is_less_or_equal()
Example in Assembly
ldaa v2 cmpa v1 bgt GTLABEL
jsr ISLESSOREQUAL bra
CONTINUE GTLABEL bra ISGREATER CONTINUE ISL
ESSOREQUAL ISGREATER
bra CONTINUE
17
while-loop
Example in C while (v2 gt v1) task_a()
Example in Assembly
WLOOP ldaa v2 cmpa v1 bgt
TASKA bra CONTINUE TASKA
bra WLOOP CONTINUE
18
for-loop
Example in C for (i 4 i lt67i)
task_a()
iinitialvalue
Example in Assembly
for (true)
ldd 4 FLOOP cpd 67 bhs
CONTINUE addd 1 bra TASKA TASKA
bra FLOOP CONTINUE

(false)
true?
ii1
19
(No Transcript)
20
Jump and Subroutine Instructions
21
Jump Instructions
  • Jump instructions specify the exact absolute
    16-bit location for the next instruction (and are
    not conditional)
  • Example
  • START CBA compare A to B
  • BEQ SKIP branch if equal
  • JMP NEQ jump
  • SKIP INCA increment A
  • NEQ BRA loop here forever

22
Interrupt Handling Instructions
23
Miscellaneous Instructions
24
Relocatable Programs
  • A relocatable program is one that can start
    anywhere in memory without changing the machine
    code.
  • Branch instructions are relocatable because their
    address is relative to the instruction itself.
  • Jump instructions are not relocatable because
    their address is absolute
Write a Comment
User Comments (0)
About PowerShow.com