ECE 265 – LECTURE 9 PROGRAM DESIGN 8/12/2015 1 ECE265.

Slides:



Advertisements
Similar presentations
EET 2261 Unit 3 Assembly Language; Load, Store, & Move Instructions  Read Almy, Chapters 5 and 6.  Homework #3 and Lab #3 due next week.  Quiz next.
Advertisements

Week 3. Assembly Language Programming  Difficult when starting assembly programming  Have to work at low level  Use processor instructions >Requires.
The 8051 Microcontroller and Embedded Systems
1 COMS 361 Computer Organization Title: Instructions Date: 9/28/2004 Lecture Number: 10.
The Assembly Language Level
Chih-Hung Wang Chapter 2: Assembler (Part-1) 參考書目 Leland L. Beck, System Software: An Introduction to Systems Programming (3rd), Addison-Wesley, 1997.
Chapter 3 Assembly Language: Part 1. Machine language program (in hex notation) from Chapter 2.
Chapter3: Language Translation issues
Low-Level Programming Languages
Chapter 7 Low-Level Programming Languages Nell Dale John Lewis.
8051 ASSEMBLY LANGUAGE PROGRAMMING
MIPS Instruction Set Advantages
ECE 265 – LECTURE 4 The M68HC11 Address Modes 8/14/ ECE265.
Joseph L. Lindo Assembly Programming Sir Joseph Lindo University of the Cordilleras.
Chapter 2 Software Tools and Assembly Language Syntax.
Writing an Assembly-language program Atmel assembly language CS-280 Dr. Mark L. Hornick 1.
Lab 1 – Assembly Language and Interfacing Start date: Week 3 Due date: Week 4 1.
CPS120: Introduction to Computer Science
Assembly Language Programming for the MC68HC11. Assembly language programming  Recall the 4 design levels for software development: – Application – High.
Fortran 1- Basics Chapters 1-2 in your Fortran book.
P.1ECE 331, Prof. A. Mason Professor Andrew Mason Michigan State University Spring 2013 ECE 331: PC Lab 1: Using HC12 ASM Simulators.
Dr Masri Ayob TK 2633: Microprocessor & Interfacing Lecture 7: Assembly Language.
A Simple Two-Pass Assembler
1/2002JNM1 Basic Elements of Assembly Language Integer Constants –If no radix is given, the integer is assumed to be decimal. Int 21h  Int 21 –A hexadecimal.
Chapter 3 Elements of Assembly Language. 3.1 Assembly Language Statements.
CoE3DJ4 Digital Systems Design
1 Introduction Chapter 1 n What is Assembly Language? n Data Representation.
Assemblers.
Sharda University P. K. Mishra (Asst.Prof) Department of Computer Science & Technology Subject Name: Programming Using C Sub Code: CSE-106 Programming.
The LC-3 – Chapter 7 COMP 2620 Dr. James Money COMP
Ass. Prof. Dr Masri Ayob TK 6123 Lecture 13: Assembly Language Level (Level 4)
Computer Operations A computer is a programmable electronic device that can store, retrieve, and process data Data and instructions to manipulate the data.
Chapter 7 Low-Level Programming Languages. 2 Chapter Goals List the operations that a computer can perform Discuss the relationship between levels of.
9/20/6Lecture 2 - Prog Model Architecture, Data Types and Addressing Modes.
1 Segments and Pseudo Operations Program Development.
Assembly Language ELEC 330 Digital Systems Engineering Dr. Ron Hayne.
Chapter 7 Low-Level Programming Languages Nell Dale John Lewis.
ECE 265 – LECTURE 11 Editing and the Assembler (updated 11/11/10) 12/15/ ECE265.
Chapter 7 Low-Level Programming Languages Nell Dale John Lewis.
Machine Independent Assembler Features
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
8086/8088 Instruction Set, Machine Codes and Addressing Modes.
1 EKT 225 MICROCONTROLLER I CHAPTER ASSEMBLY LANGUAGE PROGRAMMING.
CS501 Advanced Computer Architecture Lecture 29 Dr.Noor Muhammad Sheikh.
Introduction to computer software. Programming the computer Program, is a sequence of instructions, written to perform a specified task on a computer.
Computer Science 210 Computer Organization
Machine dependent Assembler Features
Chapter 7 Assembly Language
MIPS Instruction Set Advantages
MODULAR PROGRAMMING Many programs are too large to be developed by one person. programs are routinely developed by teams of programmers The linker program.
Machine Independent Assembler Features
Assembly Language programming
Assembly Language Ms. V.Anitha AP/CSE SCT
ACOE301: Computer Architecture II Labs
The 8051 Microcontroller and Embedded Systems
Chapter 7 Assembly Language
Chapter 3 Machine Language and Assembly Language.
Machine Independent Assembler Features
Chapter 3 Machine Language and Assembly Language.
INTRODUCTION ABOUT ASSEMBLY
Unit# 8: Introduction to Computer Programming
Computer Science 210 Computer Organization
68000 Architecture, Data Types and Addressing Modes
Chapter 4 –Requirements for coding in Assembly Language
A Simple Two-Pass Assembler
INTRODUCTION ABOUT ASSEMBLY
Requirements for coding in Assembly Language
8051 ASSEMBLY LANGUAGE PROGRAMMING
Chapter 6 Programming the basic computer
Computer Architecture and System Programming Laboratory
Presentation transcript:

ECE 265 – LECTURE 9 PROGRAM DESIGN 8/12/ ECE265

Lecture Overview  Program Design  General Overview  Program Design Methodology  Assembler Language  Assembler Directives  REF: Chapter 4 8/12/ ECE265

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. 8/12/2015ECE265 3

Software Design Methodology  The software of the system is typically called a Software Program.  A software program is software compiled and assembled into executable code for the target machine.  Window7 is a program designed as the operating system for general purpose PCs and will run on hardware structured to support that OS. 8/12/2015ECE265 4

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. 8/12/2015ECE265 5

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. 8/12/2015ECE265 6

Benefits of the top-down method  Each subtask is independent of other subtasks, allowing the programmer to design, write and test each module independently.  Errors can be detected and corrected in a logical manner.  Mentally, the programmer only has to grasp one subtask at a time.  A team of programmer can be used to accomplish the project faster.  Program modules can be used in future applications. For example, your program needs to use a linked list data structure. Most likely the routines to manage and manipulate a linked list are available. 8/12/2015ECE265 7

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. 8/12/2015ECE265 8

An example of the methodology  Example 4.2 from the Text. 8/12/2015ECE265 9

Assembler language programming  A good practice is never to program in assembler language directly.  Start with the specification of the module to be coded.  Code it in a Pseudo Design Language or PDL  PDL is much like any high level programming language. 8/12/2015ECE265 10

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. 8/12/2015ECE265 11

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 8/12/2015ECE265 12

The 68HC11 format  Each assembler language statement is on one line  Starts in column 1 and has 4 fields  The label field  The op code field  The operand filed  The comment field  THE LABEL FIELD  Starts in column 1  Can be blank  Label can be up to 15 characters in length  Upper case is distinct from lower case and must start with a character TDREG1 is valid 1TDREG is not valid  Delimited (ended) by a ‘:’ or a ‘ ’ 8/12/2015ECE265 13

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 is an octal number %The number is a binary number 8/12/2015ECE265 14

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 8/12/2015ECE265 15

Assembler directives  These are direction to the assembler to perform a particular task or set up a specific condition.  The assembler directives are 8/12/2015ECE265 16

NAM directive  Give the program a name.  Documentation only. There is no impact on the machine code generated.  NAM Pressure Monitoring 8/12/2015ECE265 17

ORG directive  Used extensively and common to all assemblers.  Sets the location (physical location) counter to a set value.  Example  ORG $C000  CNTMAX RMB 2  This would place the 16-bits for CNTMAX at address $C000 and 2 bytes of memory are set aside.  ORG $D000  START LDAA #$46  x  Here the ORG place the executable code to start at address $D000 and the label START would have a value of $D000  Memory address $D000 contains $86,  the op code for LDAA immediate mode 8/12/2015ECE265 18

END directive / EQU directive  END simply indicates that this is the last source code line.  EQU allows a value to be given to label for more readable and understandable code.  EQU [ ]  EX  ADCTL EQU $1030 Location of the A/D control  register. 8/12/2015ECE265 19

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. 8/12/2015ECE265 20

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.  [ ] FCC ‘ ’  Note the use of single ’s  Example  MYLAB FCC ‘my ASCII string’ 8/12/2015ECE265 21

RMB  RMB with reserve space in memory and attach a label to that location that can be used in the assembler code to refer to the location. Does not affect the value in the location.  EX  MRCNT RMB1 Reserve 1 byte  TREG1RMB2Reserve 2 bytes  TEBUFFRMB 12Reserve 12 bytes 8/12/2015ECE265 22

SET directive  The SET directive established the value for a label being used in the assembler code.  SET  EX  COUNT SET #40 sets the value for the label  COUNT to 40. Any time COUNT  is used it is the same as using 40  If you later reassign a value to the label, that value will be the new value for the label. 8/12/2015ECE265 23

BTEXT and ETEXT Directives  These directives allows the programmer to insert blocks of text easier than with the other directives.  No need for starting and ending quotes on each line  EXAMPLE  BTEXT  These lines will be ignored  by the assembler  but will appear in the LST file.  ETEXT  A BTEXT must be ended by a ETEXT 8/12/2015ECE265 24

Lecture summary 8/12/2015ECE  Program Design  General Overview of software  Program Design Methodology  Assembler Language in general  Assembler Directives for the 68HC11

Assignment 8/12/2015ECE  Problems : Chapter 4 page 127 – Prob 7