Programming and Problem Solving ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.

Slides:



Advertisements
Similar presentations
Code Composer Department of Electrical and Computer Engineering
Advertisements

Week 3. Assembly Language Programming  Difficult when starting assembly programming  Have to work at low level  Use processor instructions >Requires.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 2: IT Students.
Fall EE 333 Lillevik 333f06-l4 University of Portland School of Engineering Computer Organization Lecture 4 Assembly language programming ALU and.
IT253: Computer Organization Lecture 6: Assembly Language and MIPS: Programming Tonga Institute of Higher Education.
Slides created by: Professor Ian G. Harris PIC Development Environment MPLAB IDE integrates all of the tools that we will use 1.Project Manager -Groups.
Input/Output Ports and Interfacing ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.
Microprocessor and Microcontroller Fundamentals
Assembly 01. Outline Binary vs. Text Files Compiler vs. Assembler Mnemonic Assembly Process Development Process Debugging Example 1 this analogy will.
The assembler is the system program that translate source code written in assembly language to object code( Machine Language) and other information for.
Lab6 – Debug Assembly Language Lab
TK 2633 Microprocessor & Interfacing
TK 2633 Microprocessor & Interfacing Lecture 3: Introduction to 8085 Assembly Language Programming (2) 1 Prepared By: Associate Prof. Dr Masri Ayob.
Assemblers Dr. Monther Aldwairi 10/21/20071Dr. Monther Aldwairi.
Low-Level Programming Languages
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
Programming and Problem Solving
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
Chapter 7 Low-Level Programming Languages. 2 Chapter Goals List the operations that a computer can perform Discuss the relationship between levels of.
Table 1. Software Hierarchy Levels.. Essential Tools An assembler is a program that converts source-code programs into a machine language (object file).
Chapter 4 H1 Assembly Language: Part 2. Direct instruction Contains the absolute address of the memory location it accesses. ld instruction:
1-1 Embedded Software Development Tools and Processes Hardware & Software Hardware – Host development system Software – Compilers, simulators etc. Target.
Microcontroller Architecture— PIC18F Family
Microcontroller Architecture PIC18F Family
ECE 265 – LECTURE 9 PROGRAM DESIGN 8/12/ ECE265.
Assembly & Machine Languages
Chapter 2 Software Tools and Assembly Language Syntax.
Writing an Assembly-language program Atmel assembly language CS-280 Dr. Mark L. Hornick 1.
Stacks and Subroutines ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.
CSC141 Introduction to Computer Programming
Input/Output Ports and Interfacing
Chapter 3 Elements of Assembly Language. 3.1 Assembly Language Statements.
CISC105 General Computer Science Class 1 – 6/5/2006.
CHAPTER FOUR COMPUTER SOFTWARE.
Debug and Assembler By, B.R.Chandavarkar Lect. COMP Department NITK, Surathkal.
Vintage Computer Hardware 101 Featuring the MITS Altair 680b Bill Degnan.
Application Programs ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.
MIPS coding. slt, slti slt $t3, $t1, $t2 – set $t3 to be 1 if $t1 < $t2 ; else clear $t3 to be 0. – “Set Less Than.” slti $t3, $t1, 100 – set $t3 to be.
1 Assemblers System Programming by Leland L. Beck Chapter 2.
Computer Operations A computer is a programmable electronic device that can store, retrieve, and process data Data and instructions to manipulate the data.
Assembly Language ELEC 330 Digital Systems Engineering Dr. Ron Hayne.
Chapter 7 Low-Level Programming Languages Nell Dale John Lewis.
Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.
MIPS coding. slt, slti slt $t3, $t1, $t2 – set $t3 to be 1 if $t1 < $t2 ; else clear $t3 to be 0. – “Set Less Than.” slti $t3, $t1, 100 – set $t3 to be.
Microcontroller Applications ELEC 421 Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.
2/22/20161 Assembly Language (continue). 2/22/20162 Assembly Language Format LabelOpcodeOperandComment Start:LXISP,3FF0H;Initialize stack pointer DelimiterPlacement.
Interrupts ELEC 330 Digital Systems Engineering Dr. Ron Hayne
Interrupts ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.
CSCI 161 Lecture 3 Martin van Bommel. Operating System Program that acts as interface to other software and the underlying hardware Operating System Utilities.
Department of Electronic & Electrical Engineering Lecture 3. ● Template program. ● Introduction to IO ● PORTA PORTB TRISA TRISB ● Using a subroutine ●
First Foray into Programming (the hard way). A reminder from last lesson: A machine code instruction has two parts:  Op-code  Operand An instruction.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
CC410: System Programming Dr. Manal Helal – Fall 2014 – Lecture 4 - Assembler 1.
Writing an Assembly-language program MIPS assembly language using MARS: MIPS Assembler and Runtime Simulator CS-2710 Dr. Mark L. Hornick 1.
Microprocessor and Microcontroller Fundamentals
Microprocessor and Microcontroller Fundamentals
Assembly Language (continue)
Assembly Language Programming of 8085
Microprocessor T. Y. B. Sc..
Microcontroller Applications
IPCOWALA INSTITUTE OF ENGINEERING & TECHNOLOGY-DHARMAJ
ACOE301: Computer Architecture II Labs
Chapter 3 Machine Language and Assembly Language.
Chapter 3 Machine Language and Assembly Language.
Microcomputer Programming
ECEG-3202 Computer Architecture and Organization
System Programming by Leland L. Beck Chapter 2
Introduction to Computer Programming
Chapter 6 Programming the basic computer
Algoritmos y Programacion
Presentation transcript:

Programming and Problem Solving ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning

Problem Solving  Modular Design Divide problem into various tasks  Subroutines Independent units that can be combined  Flowchart Graphical representation of processes (tasks) Sequence to be followed 2330_04

Flowcharting 3330_04

Example 4.1  Write instructions to load two bytes (37 H and 92 H ) in data registers REG0 and REG1. Add the bytes and store the sum in REG2.  Steps Load two bytes in data registers REG0 and REG1 Add the bytes Save the sum in data register REG2 4330_04

Example _04

Assembly Language Programming  Analyze the problem  Draw a flowchart  Convert the flowchart into mnemonics  Look up Hex code and assign memory addresses  Enter the Hex code into memory  Execute the program  Debug the program if necessary 6330_04

Illustrative Program  Addition With Carry Check Write instructions to load two bytes (F2 H and 32 H ) in data registers REG0 and REG1 and add the bytes. If the sum generates a carry, clear the data register REG2; otherwise, save the sum in REG _04

Illustrative Program 8330_04

Assembly Language 330_049 LabelOpcodeOperandComments START:MOVLW0xF2;Load first byte in W MOVWFREG0;Save first byte in REG0 MOVLW0x32;Load second byte in W MOVWFREG1;Save second byte in REG1 ADDWFREG0,W;Add bytes and save sum in W BNCSAVE;Branch if no carry MOVLW0;Clear W SAVE:MOVWFREG2;Save sum in REG2 SLEEP;Power Down

Code Look-up? 330_0410 AddressHexLabelOpcodeOperand EF2START:MOVLW0xF E00MOVWFREG E32MOVLW0x E01MOVWFREG ADDWFREG0,W 00002AE301BNCSAVE 00002C0E00MOVLW E6E02SAVE:MOVWFREG SLEEP

Execute the Program  Hardware MPLAB IDE PICDEM  2 Plus Demo Board Microchip PIC18F4520 MPU MPLAB ICD2  Simulation PIC18 Simulator IDE Microchip PIC18F452 MPU 330_0411

PIC18 Simulator IDE  Integrated Development Environment Editing Assembling Linking Downloading Executing Simulation Debugging 330_0412

Using an Assembler  Assembly Language Programs Program in Mnemonics Assembler Directives Comments  Assembly Language Statements (4 fields) Label Opcode Operand (data, register, or memory address) Comment 13330_04

Assembly Language Format LabelOpcodeOperandComment START:MOVLW0xF2;Load F2H in W ↑ ↑ ↑ ↑ Tab Tab Tab Semicolon 14330_04

Assembler Directives  #INCLUDE Include resources from library  ORGOrigin  EQUEquate  DBData byte  ENDEnd of assembly 15330_04

Radix Formats 330_0416 TypeFormat Hexadecimal0x4F H’4F’ 4F 4FH DecimalD’100’ BinaryB’ ’ ASCII‘Susan’ A’Susan’

PIC18 Simulator IDE  Editor Assembler  Debugger Breakpoint Manager Watch Variables  Simulator Run and Step  I/O Modules LED Board 7-Segment Display Keypad Matrix 17330_04

Assembler (Editor) 330_0418

Understanding the List File  List file generated primarily for documentation  Includes seven columns Line numbers Memory addresses where binary code is stored Hex code Contents of source file Labels Opcode Operands Comments 19330_04

Assembler Listing 330_0420

Executing a Program 21330_04

Debugging a Program  Single-step technique Execute one instruction at a time Observe registers for expected results  Breakpoint technique Execute a group of instructions Observe registers for expected results 22330_04

Breakpoint Manager  Simulation automatically switches to step-by-step mode when reaching a breakpoint 330_0423

Special Breakpoints  Switch to step-by- step when the value of a register has changed or equals a predefined value 330_0424