Docsity

Program Design: Top-Down Methodology and Assembler Language for Embedded Systems, Slides of Microprocessor and Interfacing

Partial preview of the text

Download Program Design: Top-Down Methodology and Assembler Language for Embedded Systems and more Slides Microprocessor and Interfacing in PDF only on Docsity!

Lecture Overview

  • Program Design
    • General Overview
    • Program Design Methodology
    • Assembler Language
    • Assembler Directives
  • REF: Chapter 4

Program Design

  • General Overview
    • From the text page 89: “The design of an embedded microcontroller system requires an integrated use of hardware and software.”
    • Hardware and software provide a natural division of the view of the system. Embedded systems require well designed interaction between these two divisions.
    • The software design needs to follow established methodologies.

Top-down design methodology

  • A popular design methodology for software is Top-Down design and Bottom-up coding.
  • It starts with a specification of the system at the top level.
  • This top-level is then broken down into major tasks and subtasks.
  • Each major task (and subtask) is broken down into smaller subtasks as appropriate.

Top-Down Design

  • Graphical illustration of the Top-down design methodology.
  • The number of levels continues until the subtask is one that can be directly coded.

Statement of the problem

  • Where it all starts.
  • The highest level of abstraction
    • The statement of the problem to be solved
  • Requires full analysis of the problem to be addressed and the system being designed to address it.

An example of the methodology

  • Example 4.2 from the Text.

Assembler Language

  • Assembler Language is specific to the machine (processor architecture).
  • Each processor version may have instructions that other versions do not have.
  • Assembler language has a 1-to-1 relationship with the machine language, i.e., executable code of the processor. - One assembler language statement - = - one executable instruction.

Assembler language

  • Usually written line by line where each line is 80 character long.
  • Within the 80 character line there are fields. Field position can be fixed. For example: - The first 10 characters are a label - The next field is for the operand or assembler directive - This is followed by the operand field - The last filed is for comments

The 68HC11 format (cont)

  • The operation field
    • Must start in column 2 or after
    • Best to start in the same column for the complete program
    • Contains the instruction mnemonic such a LDAA, OR
    • an assembler directive OR
    • a macro call
  • Operand Field
    • The field contains the instruction operand or argument for assembler directives
    • Numbers in this field are identified by some symbols that can precede the number - None A decimal number - $ The number is a hexidecimal number - @ The number is an octal number - % The number is a binary number

68HC11 formal continued

  • The comment field
    • The last field is a comment field and is separated from the previous filed by at least one space
    • An optional field
    • Can have any printable ASCII character as this field is used for documentation
    • Can be continued (or you can use any line as a comment) by starting the line with a *. These lines are considered as comments and anything on the line is considered a comment, i.e., no assembly takes place.
  • LABEL: OPCODE OPERAND COMMENT Docsity.com

NAM directive

  • Give the program a name.
  • Documentation only. There is no impact on the machine code generated. - NAM Pressure Monitoring

ORG directive

  • Used extensively and common to all assemblers.
  • Sets the location (physical location) counter to a set value.
  • Example
    • ORG $C
    • CNTMAX RMB 2
  • This would place the 16-bits for CNTMAX at address $C000 and 2 bytes ofmemory are set aside.
    • ORG $D
    • START LDAA #$
    • x
    • x
  • Here the ORG place the executable code to start at address $D000 and thelabel START would have a value of $D
  • Memory address $D000 contains $86,
  • the op code for LDAA immediate mode

FCB directive

  • Form Constant Byte
  • This directive can have more than one value in the operand field.
  • EX
    • DIGITS FCB 0, 1, 2, 3 Fills a 4-byte memory
    • buffer labeled with DIGITS
    • with values 0,1,2, and 3
    • MYHEX FCB $32 Fills the location MYHEX
    • with a value of $32.

FCC directive

  • FCC is much like FCB except that now the memory locations are filled with the ASCII code for the characters in the string. - [
  • Note the use of single ’s
  • Example
    • MYLAB FCC ‘my ASCII string’