Microprocessor Fundamentals. Topic 8 Binary Addition

Size: px
Start display at page:

Download "Microprocessor Fundamentals. Topic 8 Binary Addition"

Transcription

1 Microprocessor Fundamentals Topic 8 Binary Addition

2 Objectives Examine several assembler directives:.dseg /.eseg /.cseg.db.byte Use indirect addressing X register (r26 and r27) Post-increment Store results in Data Memory Look at alternate approaches Discuss potential problems 1/4/2010 2

3 Assembler Directives Assembler directives are: Commands to the assembler (AVR Studio) not the microcontroller Most begin with. Have used several already:.device.def.include.list /.nolist 1/4/2010 3

4 Assembler Directives New directives are:.db (define constant byte) Allows us to place a list of data in the source file Must be used with.cseg or.eseg 1.BYTE.cseg: Code segment program memory.eseg: EEPROM segment.dseg: Data segment Allows us to reserve (and label) data space for storing data.org (origin) Allows us to specify where we want code or data to be placed in memory [1] AVR Studio Assembler Help File, but I could only get it to work in the simulator with.dseg and 1/4/2010 then placing the data in simulated memory manually needs to be tested on the development board 4

5 Example: Directives placed in a binary addition program ====== ;Data.dseg data:.db 5, 27, 31, 92, 7, 40, 1, 8, 13, 12 result:.byte 2 In this example, data is a label pointing to the data list, and result is pointing to 2 bytes of reserved memory space for the result Note: the list of data is in decimal, the assembler will convert the numbers to hex 1/4/2010 5

6 Add Program: ; Declarations.device ATmega128.def Addend = r16 ;name registers.def Sum = r17 LEDs Init: ldi r18,0b ;setup outputs on PortB for results out DDRB, r18 ldi r18,0b ;set initial values for outputs out PortB, r18 ; turn them all off ldi r26,low(data) ;get low byte of address"result" and put it in Zlow ldi r27,high(data) ;get high byte of address"result" and put it in Zhigh The results will be output to LEDs through PortB, so PortB had to be setup as all outputs with initial low outputs to turn off the = ;Start Program Start: ldi Sum,0 ; initialize Sum register Next: ld Addend,X+ ; get next number cpi Addend,255 ; see if this is the "end marker" (FF) breq Str ; send sum to LEDs add Sum,Addend ; add numbers jmp Next ; get next number Str: sts result,sum out PortB,Sum ; sends results to Port B and LEDs Stop: rjmp Stop ====== ;Data.dseg data:.db 5, 27, 31, 92, 7, 40, 1, 8, 13, 12 result:.byte 2 1/4/2010 6

7 Add Program: ; Declarations.device ATmega128.def Addend = r16 ;name registers.def Sum = r17 Init: ldi r18,0b ;setup outputs on PortB for results out DDRB, r18 address byte of X, and r27 holds the high byte ldi r18,0b ;set initial values for outputs out PortB, r18 ; turn them all off ldi r26,low(data) ;get low byte of address"result" and put it in Zlow ldi r27,high(data) ;get high byte of address"result" and put it in Zhigh X is being initialized to point to the data. R26 holds the low = ;Start Program Start: ldi Sum,0 ; initialize Sum register Next: ld Addend,X+ ; get next number cpi Addend,255 ; see if this is the "end marker" (FF) breq Str ; send sum to LEDs add Sum,Addend ; add numbers jmp Next ; get next number Str: sts result,sum out PortB,Sum ; sends results to Port B and LEDs Stop: rjmp Stop ====== ;Data.dseg data:.db 5, 27, 31, 92, 7, 40, 1, 8, 13, 12 result:.byte 2 1/4/2010 7

8 Add Program: ; Declarations.device ATmega128.def Addend = r16 ;name registers.def Sum = r17 Init: ldi r18,0b ;setup outputs on PortB for results out DDRB, r18 ldi r18,0b ;set initial values for outputs out PortB, r18 ; turn them all off ldi r26,low(data) ;get low byte of address"result" and put it in Zlow ldi r27,high(data) ;get high byte of address"result" and put it in Zhigh = The label data refers to the address of where the data is stored ;Start Program Start: ldi Sum,0 ; initialize Sum register Next: ld Addend,X+ ; get next number cpi Addend,255 ; see if this is the "end marker" (FF) breq Str ; send sum to LEDs add Sum,Addend ; add numbers jmp Next ; get next number Str: sts result,sum out PortB,Sum ; sends results to Port B and LEDs Stop: rjmp Stop ====== ;Data.dseg data:.db 5, 27, 31, 92, 7, 40, 1, 8, 13, 12 result:.byte 2 1/4/2010 8

9 Add Program: ; Declarations.device ATmega128.def Addend = r16 ;name registers.def Sum = r17 Init: ldi r18,0b ;setup outputs on PortB for results out DDRB, r18 ldi r18,0b ;set initial values for outputs out PortB, r18 ; turn them all off ldi r26,low(data) ;get low byte of address"result" and put it in Zlow ldi r27,high(data) ;get high byte of address"result" and put it in Zhigh r17 (named Sum ) will hold the sum of all the numbers, and so it is cleared as its initialization = ;Start Program Start: ldi Sum,0 ; initialize Sum register Next: ld Addend,X+ ; get next number cpi Addend,255 ; see if this is the "end marker" (FF) breq Str ; send sum to LEDs add Sum,Addend ; add numbers jmp Next ; get next number Str: sts result,sum out PortB,Sum ; sends results to Port B and LEDs Stop: rjmp Stop ====== ;Data.dseg data:.db 5, 27, 31, 92, 7, 40, 1, 8, 13, 12 result:.byte 2 1/4/2010 9

10 Add Program: ; Declarations.device ATmega128.def Addend = r16 ;name registers.def Sum = r17 Init: ldi r18,0b ;setup outputs on PortB for results out DDRB, r18 ldi r18,0b ;set initial values for outputs out PortB, r18 ; turn them all off ldi r26,low(data) ;get low byte of address"result" and put it in Zlow ldi r27,high(data) ;get high byte of address"result" and put it in Zhigh Addend is actually r16. Here, r16 is being loaded with the next (or 1 st ) number to be added to the sum (r17). X points to the data by containing the address of the 1 st data element. = ;Start Program Start: ldi Sum,0 ; initialize Sum register Next: ld Addend,X+ ; get next number cpi Addend,255 ; see if this is the "end marker" (FF) breq Str ; send sum to LEDs add Sum,Addend ; add numbers jmp Next ; get next number Str: sts result,sum out PortB,Sum ; sends results to Port B and LEDs Stop: rjmp Stop ====== ;Data.dseg data:.db 5, 27, 31, 92, 7, 40, 1, 8, 13, 12 result:.byte 2 1/4/

11 Add Program: ; Declarations.device ATmega128.def Addend = r16 ;name registers.def Sum = r17 Init: ldi r18,0b ;setup outputs on PortB for results out DDRB, r18 ldi r18,0b ;set initial values for outputs out PortB, r18 ; turn them all off ldi r26,low(data) ;get low byte of address"result" and put it in Zlow ldi r27,high(data) ;get high byte of address"result" and put it in Zhigh = ;Start Program Start: ldi Sum,0 ; initialize Sum register Next: ld Addend,X+ ; get next number FF (or 255 decimal) is being used as a marker for the end of data. Blank (or empty) memory locations are shown as FF. If the data loaded in the previous instruction is FF, then the program has reached the end of the list of data and it is time to cpi Addend,255 ; see if this is the "end marker" (FF) breq Str ; send sum to LEDs add Sum,Addend display ; add numbers the sum. jmp Next ; get next number Str: sts result,sum out PortB,Sum ; sends results to Port B and LEDs Stop: rjmp Stop ====== ;Data.dseg data:.db 5, 27, 31, 92, 7, 40, 1, 8, 13, 12 result:.byte 2 1/4/

12 Add Program: ; Declarations.device ATmega128.def Addend = r16 ;name registers.def Sum = r17 Init: ldi r18,0b ;setup outputs on PortB for results out DDRB, r18 ldi r18,0b ;set initial values for outputs out PortB, r18 ; turn them all off ldi r26,low(data) ;get low byte of address"result" and put it in Zlow ldi r27,high(data) ;get high byte of address"result" and put it in Zhigh = ;Start Program Start: ldi Sum,0 ; initialize Sum register Next: ld Addend,X+ ; get next number cpi Addend,255 ; see if this is the "end marker" (FF) breq Str ; send sum to LEDs add Sum,Addend ; add numbers jmp Next ; get next number Str: sts result,sum out PortB,Sum ; sends results to Port B and LEDs Stop: rjmp Stop ====== ;Data.dseg data:.db 5, 27, 31, 92, 7, 40, 1, 8, 13, 12 result:.byte 2 So, if the cpi instruction sets the Z bit (the two values were equal), the program should branch to the label Str 1/4/

13 Add Program: ; Declarations.device ATmega128.def Addend = r16 ;name registers.def Sum = r17 Init: ldi r18,0b ;setup outputs on PortB for results out DDRB, r18 ldi r18,0b ;set initial values for outputs out PortB, r18 ; turn them all off ldi r26,low(data) ;get low byte of address"result" and put it in Zlow ldi r27,high(data) ;get high byte of address"result" and put it in Zhigh = ;Start Program Start: ldi Sum,0 add ; initialize it to the current Sum register sum Next: ld Addend,X+ ; get next number cpi Addend,255 ; see if this is the "end marker" (FF) breq Str ; send sum to LEDs add Sum,Addend ; add numbers jmp Next ; get next number Str: sts result,sum out PortB,Sum ; sends results to Port B and LEDs Stop: rjmp Stop ====== ;Data.dseg data:.db 5, 27, 31, 92, 7, 40, 1, 8, 13, 12 result:.byte 2 If the number we retrieved is not FF, then it must be data, so 1/4/

14 Add Program: ; Declarations.device ATmega128.def Addend = r16 ;name registers.def Sum = r17 Init: ldi r18,0b ;setup outputs on PortB for results out DDRB, r18 ldi r18,0b ;set initial values for outputs out PortB, r18 ; turn them all off ldi r26,low(data) ;get low byte of address"result" and put it in Zlow ldi r27,high(data) ;get high byte of address"result" and put it in Zhigh = ;Start Program Start: ldi Sum,0 ; initialize Sum register Next: ld Addend,X+ ; get next number cpi Addend,255 ; see if this is the "end marker" (FF) breq Str ; send sum to LEDs add Sum,Addend ; add numbers jmp Next ; get next number Str: sts result,sum out PortB,Sum ; sends results to Port B and LEDs Stop: rjmp Stop ====== ;Data.dseg data:.db 5, 27, 31, 92, 7, 40, 1, 8, 13, 12 result:.byte 2 Branch to the label Next to get the next number in the list 1/4/

15 Add Program: ; Declarations.device ATmega128.def Addend = r16 ;name registers.def Sum = r17 Init: ldi r18,0b ;setup outputs on PortB for results out DDRB, r18 ldi r18,0b ;set initial values for outputs out PortB, r18 ; turn them all off ldi r26,low(data) ;get low byte of address"result" and put it in Zlow ldi r27,high(data) ;get high byte of address"result" and put it in Zhigh = ;Start Program Start: ldi Sum,0 ; initialize Sum register Next: ld Addend,X+ ; get next number cpi Addend,255 ; see if this is the "end marker" (FF) breq Str ; send sum to LEDs add Sum,Addend ; add numbers jmp Next ; get next number Str: sts result,sum out PortB,Sum ; sends results to Port B and LEDs Stop: rjmp Stop ====== ;Data.dseg data:.db 5, 27, 31, 92, 7, 40, 1, 8, 13, 12 result:.byte 2 If the last number to be retrieved from memory was FF (the marker for the end of data), then the program will branch here and store the data at the address labeled result 1/4/

16 Add Program: ; Declarations.device ATmega128.def Addend = r16 ;name registers.def Sum = r17 Init: ldi r18,0b ;setup outputs on PortB for results out DDRB, r18 ldi r18,0b ;set initial values for outputs out PortB, r18 ; turn them all off ldi r26,low(data) ;get low byte of address"result" and put it in Zlow ldi r27,high(data) ;get high byte of address"result" and put it in Zhigh = ;Start Program Start: ldi Sum,0 ; initialize Sum register Next: ld Addend,X+ ; get next number cpi Addend,255 ; see if this is the "end marker" (FF) breq Str ; send sum to LEDs add Sum,Addend the ; LEDs. add numbers jmp Next ; get next number Str: sts result,sum out PortB,Sum ; sends results to Port B and LEDs Stop: rjmp Stop ====== ;Data.dseg data:.db 5, 27, 31, 92, 7, 40, 1, 8, 13, 12 result:.byte 2 After the sum is stored, it will be sent out PortB, which lights 1/4/

17 Add Program: ; Declarations.device ATmega128.def Addend = r16 ;name registers.def Sum = r17 Init: ldi r18,0b ;setup outputs on PortB for results out DDRB, r18 ldi r18,0b ;set initial values for outputs out PortB, r18 ; turn them all off ldi r26,low(data) ;get low byte of address"result" and put it in Zlow ldi r27,high(data) ;get high byte of address"result" and put it in Zhigh = ;Start Program Start: ldi Sum,0 ; initialize Sum register Next: ld Addend,X+ ; get next number cpi Addend,255 ; see if this is the "end marker" (FF) breq Str ; send sum to LEDs add Sum,Addend ; add numbers jmp Next ; get next number Str: sts result,sum out PortB,Sum ; sends results to Port B and LEDs Stop: rjmp Stop ====== ;Data.dseg data:.db 5, 27, 31, 92, 7, 40, 1, 8, 13, 12 result:.byte 2 The relative jump (rjmp) to itself, effectively halts the program. Actually, the AVR continuously jumps back to this instruction. 1/4/

18 Assembly: If you have not done before now you need to set an assembler option so that a list file is created when the program is assembled Choose Assembler Options from the Project menu

19 Assembly: Make sure that Create List File is checked Click the [OK] button

20 Assembly: Then assemble the file. The program assembled OK It used 34 bytes of the Code Segment (Program Space) It used 12 bytes of the Data Segment: 10 bytes of data to add and two bytes to store the result 1/4/

21 Assembly: The list file has a lst extension. It shows the addresses as well as the op codes for all instructions. At the end of the file: Assembly complete, 0 errors, 0 warnings is shown 1/4/

22 Simulation: The simulator will not load the data into simulated Data Space. You must insert the data manually 1/4/

23 Simulation: The data has been entered. Note also that X has the address $0100. Only the label data was specified, but nothing in the data section specifies $ /4/

24 Simulation: This happens because $0100 is the beginning of Data Space (SRAM) on the ATmega128. The assembler knows this (we specified an ATmega128) and so starts placing data at $ /4/

25 Simulation: The ld Addend,X+ has just been executed 2. The lower byte of X (r26) was incremented (X+: Post-Increment) 3. The data from $0100, the 05 (see note 4) was loaded into r16 (Addend) 5. None of these instructions have affected the status register 1/4/

26 Simulation: The cpi Addend,255 was executed. This instruction compares the current contents of r16 (05) to FF (decimal 255). It compares by subtracting 255 from 5 2. The compare (5 255) or ( ) sets H and C. The Z bit is not set (Z=0) so.. 1/4/

27 Simulation: The program falls through to the add instruction and. 1/4/

28 Simulation: adds the 05 (in Addend) to the 0 (in Sum) and gets a result in Sum (r17) of 05. This result clears all the bits in the status register. 1/4/

29 Simulation: At this point, all the numbers have been added. The result ($EC) is in r17 and the marker ($FF) has been loaded into r16. 1/4/

30 Simulation: The cpi instruction sets the Z bit because FF-FF = 0. Now that the Z bit is set, the program will branch to Str: 1/4/

31 Simulation: The branch was taken and the results were stored in $010A 1/4/

32 Simulation: And then the results ($EC) were output to PortB 1/4/

33 Alternative Program: ; Declarations.device ATmega128.def Addend = r16 ;name registers.def Sum = r17 Init: ldi r18,0b ;setup outputs on PortB for results out DDRB, r18 ldi r18,0b ;set initial values for outputs out PortB, r18 ; turn them all off ldi r26,low(data) ;get low byte of address"result" and put it in Zlow ldi r27,high(data) ;get high byte of address"result" and put it in Zhigh = ;Start Program Start: number of numbers in this case 10. ldi Sum,0 ; initialize Sum register Next: ld Addend,X+ ; get next number cpi r26,0x0a ; see if this is the "end marker" (FF) breq Str ; send sum to LEDs add Sum,Addend ; add numbers jmp Next ; get next number Str: sts result,sum out PortB,Sum ; sends results to Port B and LEDs Stop: rjmp Stop ====== ;Data.dseg data:.db 5, 27, 31, 92, 7, 40, 1, 8, 13, 12 result:.byte 2 You could also write the program so that it just adds the correct To do this, compare the lower byte of the X register to 0x0A to see when the program has added 10 numbers. 1/4/

34 Problem: ; Declarations There is still a problem with this program. Do you know what it is?.device ATmega128.def Addend = r16 ;name registers.def Sum = r17 Init: ldi r18,0b ;setup outputs on PortB for results out DDRB, r18 ldi r18,0b ;set initial values for outputs out PortB, r18 ; turn them all off ldi r26,low(data) ;get low byte of address"result" and put it in Zlow ldi r27,high(data) ;get high byte of address"result" and put it in Zhigh = ;Start Program Start: ldi Sum,0 ; initialize Sum register Next: ld Addend,X+ ; get next number cpi r26,0x0a ; see if this is the "end marker" (FF) breq Str ; send sum to LEDs add Sum,Addend ; add numbers jmp Next ; get next number Str: sts result,sum out PortB,Sum ; sends results to Port B and LEDs Stop: rjmp Stop ====== ;Data.dseg data:.db 5, 27, 31, 92, 7, 40, 1, 8, 13, 12 result:.byte 2 1/4/

35 Problem: 10 numbers are added (whether you end the program by a count or by a marker) The largest number that can be stored in any address is $FF The program should be written to be able to handle any data set If all the numbers were $FF, then the result would have been: $9F6 This program was only concerned with the lower byte If all the data had been $FF, this program s results would have shown: $F6

36 Summary In this topic we: Examined several assembler directives:.dseg /.eseg /.cseg.db.byte Used indirect addressing X register (r26 and r27) Post-increment Stored results in Data Memory Looked at an alternate approach Discussed potential problems 1/4/

Microprocessor Fundamentals. Topic 7 Timing: the Timer/Counter

Microprocessor Fundamentals. Topic 7 Timing: the Timer/Counter Microprocessor Fundamentals Topic 7 Timing: the Timer/Counter Objectives Examine the Timer/Counter Register: TCNT0 Examine the Timer/Counter Control Register: TCCR0 Write a time delay for the previous

More information

CHAPTER 2: AVR ARCHITECTURE & ASSEMBLY LANGUAGE PROGRAMMING

CHAPTER 2: AVR ARCHITECTURE & ASSEMBLY LANGUAGE PROGRAMMING CHAPTER 2: AVR ARCHITECTURE & ASSEMBLY LANGUAGE PROGRAMMING SECTION 2.1: THE GENERAL PURPOSE REGISTERS IN THE AVR 1. 8 2. 8 3. 8 4. 0xFF 5. $28 in R20 6. (a), (c), (d), (e), (g) 7. (c) 8. This is an illegal

More information

Module 8: Atmega32 Stack & Subroutine. Stack Pointer Subroutine Call function

Module 8: Atmega32 Stack & Subroutine. Stack Pointer Subroutine Call function Module 8: Atmega32 Stack & Subroutine Stack Pointer Subroutine Call function Stack Stack o Stack is a section of RAM used by the CPU to store information temporarily (i.e. data or address). o The CPU needs

More information

Lab 2: Basic Assembly Programming and Debugging using AVR Studio. Due: December 13, 2011

Lab 2: Basic Assembly Programming and Debugging using AVR Studio. Due: December 13, 2011 Lab 2: Basic Assembly Programming and Debugging using AVR Studio 1 Outcomes Due: December 13, 2011 Familiarize yourself with the capabilities of the ATMEGA32 embedded microcontroller and AVR Studio Develop

More information

Introduction to Assembly language

Introduction to Assembly language Introduction to Assembly language 1 USING THE AVR MICROPROCESSOR Outline Introduction to Assembly Code The AVR Microprocessor Binary/Hex Numbers Breaking down an example microprocessor program AVR instructions

More information

COMP2121 Introductory Experiment

COMP2121 Introductory Experiment COMP2121 Introductory Experiment Objectives: In this introductory experiment, you will: Learn how to use AVR studio, an Integrated Development Environment (IDE) for developing AVR applications in Windows

More information

EE 308: Microcontrollers

EE 308: Microcontrollers EE 308: Microcontrollers Assmbly Language Part I Aly El-Osery Electrical Engineering Department New Mexico Institute of Mining and Technology Socorro, New Mexico, USA January 30, 2018 Aly El-Osery (NMT)

More information

AVR ISA & AVR Programming (I) Lecturer: Sri Parameswaran Notes by: Annie Guo

AVR ISA & AVR Programming (I) Lecturer: Sri Parameswaran Notes by: Annie Guo AVR ISA & AVR Programming (I) Lecturer: Sri Parameswaran Notes by: Annie Guo 1 Lecture Overview AVR ISA AVR Instructions & Programming (I) Basic construct implementation 2 Atmel AVR 8-bit RISC architecture

More information

AVR ISA & AVR Programming (I) Lecturer: Sri Parameswaran Notes by: Annie Guo

AVR ISA & AVR Programming (I) Lecturer: Sri Parameswaran Notes by: Annie Guo AVR ISA & AVR Programming (I) Lecturer: Sri Parameswaran Notes by: Annie Guo 1 Lecture Overview AVR ISA AVR Instructions & Programming (I) Basic construct implementation 2 Atmel AVR 8-bit RISC architecture

More information

AVR ISA & AVR Programming (I)

AVR ISA & AVR Programming (I) AVR ISA & AVR Programming (I) Lecturer: Sri Parameswaran Notes by: Annie Guo Week 1 1 Lecture Overview AVR ISA AVR Instructions & Programming (I) Basic construct implementation Week 1 2 1 Atmel AVR 8-bit

More information

CN310 Microprocessor Systems Design

CN310 Microprocessor Systems Design CN310 Microprocessor Systems Design Instruction Set (AVR) Nawin Somyat Department of Electrical and Computer Engineering Thammasat University Outline Course Contents 1 Introduction 2 Simple Computer 3

More information

Lab Objectives. 2. Preparations. 3. Signing in. 4. Examining the Host Environment. 5. Part A: Introduction to AVR Studio. 5.

Lab Objectives. 2. Preparations. 3. Signing in. 4. Examining the Host Environment. 5. Part A: Introduction to AVR Studio. 5. Lab 0 1. Objectives Learn how to use AVR studio, an Integrated Development Environment (IDE) for developing AVR applications in Windows environments, to debug and run an AVR assembly program. Understand

More information

Programming Microcontroller Assembly and C

Programming Microcontroller Assembly and C Programming Microcontroller Assembly and C Course Number CLO : 2 Week : 5-7 : TTH2D3 CLO#2 Student have the knowledge to create basic programming for microcontroller [C3] Understand how to program in Assembly

More information

Microcontroller VU

Microcontroller VU 182.694 Microcontroller VU Martin Perner SS 2017 Featuring Today: A Deep Look into the Processor Core Getting Code onto the Microcontroller Chip Weekly Training Objective This week 1.2 Board test 2.1.1

More information

Lecture 20: AVR Programming, Continued. AVR Program Visible State (ones we care about for now)

Lecture 20: AVR Programming, Continued. AVR Program Visible State (ones we care about for now) 18 100 Lecture 20: AVR Programming, Continued S 15 L20 1 James C. Hoe Dept of ECE, CMU April 2, 2015 Today s Goal: You will all be ace AVR hackers! Announcements: Midterm 2 can be picked up in lab and

More information

FIFTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLOGY-MARCH 2014 EMBEDDED SYSTEMS (Common for CT,CM) [Time: 3 hours] (Maximum marks : 100)

FIFTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLOGY-MARCH 2014 EMBEDDED SYSTEMS (Common for CT,CM) [Time: 3 hours] (Maximum marks : 100) (Revision-10) FIFTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLOGY-MARCH 2014 EMBEDDED SYSTEMS (Common for CT,CM) [Time: 3 hours] (Maximum marks : 100) PART-A (Maximum marks : 10) I. Answer all

More information

Register-Level Programming

Register-Level Programming Introduction Register-Level Programming Programming can be considered a set a instructions that are executed in a precise order. A programming simulator can evaluate how instructions store, move and calculate

More information

By: Dr. Hamed Saghaei

By: Dr. Hamed Saghaei By: Dr. Hamed Saghaei The AVR RISC Microcontroller supports powerful and efficient addressing modes for access to the program memory (Flash) and data memory (SRAM). This section describes the different

More information

COMP2121: Microprocessors and Interfacing

COMP2121: Microprocessors and Interfacing Interfacing Lecture 9: Program Control Instructions http://www.cse.unsw.edu.au/~cs2121 Lecturer: Hui Wu Session 1, 2006 Program control instructions in AVR Stacks Overview Sample AVR assembly programs

More information

COMP3221: Microprocessors and Embedded Systems. Lecture 11: Assembly Lecturer: Hui Wu Session 2, 2005

COMP3221: Microprocessors and Embedded Systems. Lecture 11: Assembly  Lecturer: Hui Wu Session 2, 2005 COMP3221: Microprocessors and Embedded Systems Lecture 11: Assembly http://www.cse.unsw.edu.au/~cs3221 Lecturer: Hui Wu Session 2, 2005 Overview Pseudo Instructions Macro Assembly Process 2 Assembly Language

More information

Objectives. I/O Ports in AVR. Topics. ATmega16/mega32 pinout. AVR pin out The structure of I/O pins I/O programming Bit manipulating 22/09/2017

Objectives. I/O Ports in AVR. Topics. ATmega16/mega32 pinout. AVR pin out The structure of I/O pins I/O programming Bit manipulating 22/09/2017 Objectives The AVR microcontroller and embedded systems using assembly and c I/O Ports in AVR List all the ports of the AVR microcontroller Describe the dual role of the AVR pins Code assembly language

More information

AVR. 2. (Assembler directives ) 3. ( Instruction field) 5. (Comment field) 1. (Label field) Assembler. 4. ก (Operands field) (AVR Assembly Language)

AVR. 2. (Assembler directives ) 3. ( Instruction field) 5. (Comment field) 1. (Label field) Assembler. 4. ก (Operands field) (AVR Assembly Language) 3 AVR (AVR Assembly Language). ก ก ก /* * AVRAssembler1.asm * * Created: 9/7/2554 9:40:18 * Author: xp */.org 0 rjmp RESET ;Reset Handle rjmp RESET rjmp RESET RESET: ldi r16, 0b11111111 ;load register

More information

2.2 THE MARIE Instruction Set Architecture

2.2 THE MARIE Instruction Set Architecture 2.2 THE MARIE Instruction Set Architecture MARIE has a very simple, yet powerful, instruction set. The instruction set architecture (ISA) of a machine specifies the instructions that the computer can perform

More information

Module 2: Introduction to AVR ATmega 32 Architecture

Module 2: Introduction to AVR ATmega 32 Architecture Module 2: Introduction to AVR ATmega 32 Architecture Definition of computer architecture processor operation CISC vs RISC von Neumann vs Harvard architecture AVR introduction AVR architecture Architecture

More information

Menu. >Debugging/Simulating in Atmel Studio >Downloading and Debugging/Emulating with the UF-board. Machine Codes 6811: $86 $0A GCPU: $02 $0A

Menu. >Debugging/Simulating in Atmel Studio >Downloading and Debugging/Emulating with the UF-board. Machine Codes 6811: $86 $0A GCPU: $02 $0A Big Picture Assembler Directives Examples using: Menu >Debugging/Simulating in Atmel Studio >Downloading and Debugging/Emulating with the UF-board Look into my... See on web-site: GCPU_to_XMEGA.pdf, Examples:

More information

AVR. (AVR Assembly Language) Assembler . ก ก

AVR. (AVR Assembly Language) Assembler . ก ก AVR (AVR Assembly Language). ก ก Assembler 2 1 ก /* * AVRAssembler1.asm * * Created: 9/7/2554 9:40:18 * Author: xp */.org 0 rjmp RESET ;Reset Handle rjmp RESET rjmp RESET RESET: ldi r16, 0b11111111 ;load

More information

Notes: The Marie Simulator

Notes: The Marie Simulator The Accumulator (AC) is the register where calculations are performed. To add two numbers together, a) load the first number into the accumulator with a Load instruction b) Add the second number to the

More information

COMP3221: Microprocessors and. and Embedded Systems. Instruction Set Architecture (ISA) What makes an ISA? #1: Memory Models. What makes an ISA?

COMP3221: Microprocessors and. and Embedded Systems. Instruction Set Architecture (ISA) What makes an ISA? #1: Memory Models. What makes an ISA? COMP3221: Microprocessors and Embedded Systems Lecture 2: Instruction Set Architecture (ISA) http://www.cse.unsw.edu.au/~cs3221 Lecturer: Hui Wu Session 2, 2005 Instruction Set Architecture (ISA) ISA is

More information

Embedded Systems and Software

Embedded Systems and Software Embedded Systems and Software Potpourri & Notes on Lab 2 Artist's concept of Mars Exploration Rover. Courtesy NASA Lab 2 Notes Slide 1 The AVR Assembler We use the AVRASM2 assembler that comes with AVR

More information

NEWBIE'S GUIDE TO AVR DEVELOPMENT A N IN TR O DU CT I O N I N TE N DE D FO R PEOPL E W I TH NO PRIOR AV R KNOWLE DG E AVRFREAKS.

NEWBIE'S GUIDE TO AVR DEVELOPMENT A N IN TR O DU CT I O N I N TE N DE D FO R PEOPL E W I TH NO PRIOR AV R KNOWLE DG E AVRFREAKS. NEWBIE'S GUIDE TO AVR DEVELOPMENT A N IN TR O DU CT I O N I N TE N DE D FO R PEOPL E W I TH NO PRIOR AV R KNOWLE DG E AVRFREAKS.NET JULY 2002 TABLE OF CONTENTS Newbie's Getting Started Guide...2 Preparing

More information

IAS0430 MICROPROCESSOR SYSTEMS

IAS0430 MICROPROCESSOR SYSTEMS IAS0430 MICROPROCESSOR SYSTEMS Fall 2018 Arduino and assembly language Martin Jaanus U02-308 martin.jaanus@ttu.ee 620 2110, 56 91 31 93 Learning environment : http://isc.ttu.ee Materials : http://isc.ttu.ee/martin

More information

EE 308: Microcontrollers

EE 308: Microcontrollers EE 308: Microcontrollers Review Part I Aly El-Osery Electrical Engineering Department New Mexico Institute of Mining and Technology Socorro, New Mexico, USA February 15, 2018 Aly El-Osery (NMT) EE 308:

More information

ATmega128 Assembly Language Programming

ATmega128 Assembly Language Programming 마이크로프로세서응용 7 ATmega128 Assembly Language Programming Assembly Language g Field Delimiter Field structure a space or colon after a label a space after the operation code a comma between operands in the

More information

BASIC AVR ARITHMATIC v1.1 ADDITION and SUBTRACTION by

BASIC AVR ARITHMATIC v1.1 ADDITION and SUBTRACTION by BASIC AVR ARITHMATIC v1.1 ADDITION and SUBTRACTION by RetroDan@GMail.Com CONTENTS: 1. ADDING AND SUBTRACTING ONE FROM A REGISTER 2. LOADING A REGISTER WITH A CONSTANT 3. ADDING AND SUBTRACTING A CONSTANT

More information

Introduction to AVR-STUDIO

Introduction to AVR-STUDIO DEPARTAMENTO DE TECNOLOGÍA ELECTRÓNICA ESCUELA TÉCNICA SUPERIOR DE INGENIERÍA INFORMÁTICA Introduction to AVR-STUDIO Computer Structure 1.Introduction and goals The goals of this session are the following:

More information

Assembly Programming in Atmel Studio 7 Step by Step Tutorial

Assembly Programming in Atmel Studio 7 Step by Step Tutorial Assembly Programming in Atmel Studio 7 Step by Step Tutorial Sepehr Naimi BIHE University 12/1/2017 Contents Introduction... 2 Downloading and Installing Atmel Studio... 3 Opening Atmel Studio... 3 Creating

More information

Programming Studio #4 ECE 190

Programming Studio #4 ECE 190 Programming Studio #4 ECE 190 Programming Studio #4 Topics this week: Systematic Decomposition Memory Addressing Modes In Studio Assignment LC-3 Programming Assignment Announcements MP1 Due Wednesday,

More information

APPENDIX A FOR SKEE3732 LABORATORY 1 SHEET

APPENDIX A FOR SKEE3732 LABORATORY 1 SHEET APPENDIX A FOR SKEE3732 LABORATORY 1 SHEET Other documents that are referred within this document are located at the link https://www.dropbox.com/sh/s16jri4eol3agl5/aaazn_w3p7fodjs-wi-xcenqa?dl=0 The ATmega32/ATmega2A

More information

ECE 375 Computer Organization and Assembly Language Programming Winter 2018 Solution Set #2

ECE 375 Computer Organization and Assembly Language Programming Winter 2018 Solution Set #2 ECE 375 Computer Organization and Assembly Language Programming Winter 2018 Set #2 1- Consider the internal structure of the pseudo-cpu discussed in class augmented with a single-port register file (i.e.,

More information

[TUT] Newbie's Guide to AVR Interrupts

[TUT] Newbie's Guide to AVR Interrupts This tutorial is about interrupt driven USART receive and transmit routines written in AVR assembly. The hardware is: Arduino Mega2560 Adafruit Ultimate GPS IBM PC Atmel JTAGICE3 Software: Atmel AS6.1

More information

COMP2121: Microprocessors and Interfacing. Instruction Formats and Addressing Modes

COMP2121: Microprocessors and Interfacing. Instruction Formats and Addressing Modes COMP2121: Microprocessors and Interfacing Instruction Formats and Addressing Modes http://www.cse.unsw.edu.au/~cs2121 Lecturer: Hui Wu Session 2, 2017 1 1 Overview Instruction format AVR instruction format

More information

ADD R3, R4, #5 LDR R3, R4, #5

ADD R3, R4, #5 LDR R3, R4, #5 ECE 109 Sections 602 to 605 Exam 2 Fall 2007 Solution 6 November, 2007 Problem 1 (15 points) Data Path In the table below, the columns correspond to two LC/3 instructions and the rows to the six phases

More information

EE 308: Microcontrollers

EE 308: Microcontrollers EE 308: Microcontrollers Timers Aly El-Osery Electrical Engineering Department New Mexico Institute of Mining and Technology Socorro, New Mexico, USA April 2, 2018 Aly El-Osery (NMT) EE 308: Microcontrollers

More information

Introduction to Computer. Chapter 5 The LC-3. Instruction Set Architecture

Introduction to Computer. Chapter 5 The LC-3. Instruction Set Architecture Introduction to Computer Engineering ECE/CS 252, Fall 2010 Prof. Mikko Lipasti Department of Electrical and Computer Engineering University of Wisconsin Madison Chapter 5 The LC-3 Instruction Set Architecture

More information

Microprocessors & Interfacing

Microprocessors & Interfacing Lecture Overview Microprocessors & Interfacing Interrupts (I) Lecturer : Dr. Annie Guo Introduction to Interrupts Interrupt system specifications Multiple sources of interrupts Interrupt priorities Interrupts

More information

APPENDIX D FLOWCHARTS AND PSEUDOCODE OVERVIEW

APPENDIX D FLOWCHARTS AND PSEUDOCODE OVERVIEW APPENDIX D FLOWCHARTS AND PSEUDOCODE OVERVIEW This appendix provides an introduction to writing flowcharts and pseudocode. 689 Flowcharts If you have taken any previous programming courses, you are probably

More information

ECE 375: Computer Organization and Assembly Language Programming

ECE 375: Computer Organization and Assembly Language Programming ECE 375: Computer Organization and Assembly Language Programming SECTION OVERVIEW Lab 4 Data Manipulation & the LCD Complete the following objectives: ˆ Understand the basics of data manipulation in AVR

More information

ECED 3204 Microprocessor Midterm Reference Solution

ECED 3204 Microprocessor Midterm Reference Solution ECED 3204 Microprocessor Midterm Reference Solution Date: October 26 2017 Time: 7:00pm-9:00pm Room: B225, B227, B229 Student name ID 1) Problem one has following two sub problems: a. Write an instruction

More information

Interrupts (I) Lecturer: Sri Notes by Annie Guo. Week8 1

Interrupts (I) Lecturer: Sri Notes by Annie Guo. Week8 1 Interrupts (I) Lecturer: Sri Notes by Annie Guo Week8 1 Lecture overview Introduction to Interrupts Interrupt system specifications Multiple Sources of Interrupts Interrupt Priorities Interrupts in AVR

More information

COMP3221: Microprocessors and Embedded Systems

COMP3221: Microprocessors and Embedded Systems Embedded Systems Lecture 6: Addressing Modes http://www.cse.unsw.edu.au/~cs3221 Lecturer: Hui Wu Session 2, 2005 Addressing Modes Overview Instruction Examples 1 2 Operands Immediate Addressing Instructions

More information

EE 308: Microcontrollers

EE 308: Microcontrollers EE 308: Microcontrollers Interrupts Aly El-Osery Electrical Engineering Department New Mexico Institute of Mining and Technology Socorro, New Mexico, USA March 1, 2018 Aly El-Osery (NMT) EE 308: Microcontrollers

More information

SCRAM Introduction. Philipp Koehn. 19 February 2018

SCRAM Introduction. Philipp Koehn. 19 February 2018 SCRAM Introduction Philipp Koehn 19 February 2018 This eek 1 Fully work through a computer circuit assembly code Simple but Complete Random Access Machine (SCRAM) every instruction is 8 bit 4 bit for op-code:

More information

COMP2121: Microprocessors and Interfacing. Instruction Set Architecture (ISA)

COMP2121: Microprocessors and Interfacing. Instruction Set Architecture (ISA) COMP2121: Microprocessors and Interfacing Instruction Set Architecture (ISA) http://www.cse.unsw.edu.au/~cs2121 Lecturer: Hui Wu Session 2, 2017 1 Contents Memory models Registers Data types Instructions

More information

Microprocessors & Interfacing

Microprocessors & Interfacing Lecture Overview Microprocessors & Interfacing Interrupts (II) Interrupts in AVR External interrupts Internal interrupts Timers/Counters Lecturer : Dr. Annie Guo S2, 2008 COMP9032 Week7 1 S2, 2008 COMP9032

More information

AT90S Bit Microcontroller with 1K bytes Downloadable Flash AT90S1200. Features. Description. Pin Configuration

AT90S Bit Microcontroller with 1K bytes Downloadable Flash AT90S1200. Features. Description. Pin Configuration Features Utilizes the AVR Enhanced RISC Architecture 89 Powerful Instructions - Most Single Clock Cycle Execution 1K bytes of In-System Reprogrammable Downloadable Flash - SPI Serial Interface for Program

More information

Review on Lecture-1. ICT 6641: Advanced Embedded System. Lecture 2 Branch, Call and Delay Loops, AVR I/O port programming

Review on Lecture-1. ICT 6641: Advanced Embedded System. Lecture 2 Branch, Call and Delay Loops, AVR I/O port programming ICT 6641: Advanced Embedded System Lecture 2 Branch, Call and Delay Loops, AVR I/O port programming Prof. S. M. Lutful Kabir Session: April, 2011 Review on Lecture-1 Three parts of a computer : CPU, Memory

More information

APPENDIX B AVR INSTRUCTIONS EXPLAINED OVERVIEW

APPENDIX B AVR INSTRUCTIONS EXPLAINED OVERVIEW APPENDIX B AVR INSTRUCTIONS EXPLAINED OVERVIEW In this appendix, we describe each intruction of the ATmega328. In many cases, a simple code example is given to clarify the instruction. Instructions are

More information

Gates and flip-flops: glue logic, simple FSMs, registers Two-level PLDs: FSMs, muxes, decoders. Programmable logic devices (CSE370, CSE467)

Gates and flip-flops: glue logic, simple FSMs, registers Two-level PLDs: FSMs, muxes, decoders. Programmable logic devices (CSE370, CSE467) Computational hardware Digital logic (CSE370) Gates and flip-flops: glue logic, simple FSMs, registers Two-level PLDs: FSMs, muxes, decoders Programmable logic devices (CSE370, CSE467) Field-programmable

More information

Buses and Parallel Input/Output

Buses and Parallel Input/Output Buses and Parallel Input/Output Lecturer: Sri Parameswaran Notes by: Annie Guo Week7 1 Lecture Overview Buses Computer buses I/O Addressing Memory mapped I/O Separate I/O Parallel input/output AVR examples

More information

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON Prof. Gurindar Sohi TAs: Pradip Vallathol and Junaid Khalid Examination 4 In Class (50 minutes) Wednesday, December 12,

More information

Embedded Systems and Software

Embedded Systems and Software Embedded Systems and Software Timers and Counters F-35 Lightning II Electro-optical Targeting System (EOTS Lecture 1, Slide-1 Timers and Counters Very important peripherals on microcontrollers ATtiny45

More information

AVR Subroutine Basics

AVR Subroutine Basics 1 P a g e AVR Subroutine Basics READING The AVR Microcontroller and Embedded Systems using Assembly and C) by Muhammad Ali Mazidi, Sarmad Naimi, and Sepehr Naimi Chapter 3: Branch, Call, and Time Delay

More information

EE 308: Microcontrollers

EE 308: Microcontrollers EE 308: Microcontrollers Introduction to the Assmbly Language Aly El-Osery Electrical Engineering Department New Mexico Institute of Mining and Technology Socorro, New Mexico, USA January 25, 2018 Aly

More information

ECED3204: Microprocessor Part I--Introduction

ECED3204: Microprocessor Part I--Introduction ECED3204: Microprocessor Part I--Introduction Jason J. Gu Department of 1 Outline i. Computer ii. Processor iii. Embedded System iv. Memory v. Program Execution VI. VII. VIII. IX. AVR AVR Memory AVR CPU

More information

Load -- read data from memory to register. Store -- write data from register to memory. Load effective address -- compute address, save in register

Load -- read data from memory to register. Store -- write data from register to memory. Load effective address -- compute address, save in register Data Movement Instructions Load -- read data from memory to register LD: PC-relative mode LDR: base+offset mode LDI: indirect mode Store -- write data from register to memory ST: PC-relative mode STR:

More information

Addressing Modes Part II AVR Addressing Indirect READING

Addressing Modes Part II AVR Addressing Indirect READING 1 P a g e Addressing Modes Part II AVR Addressing Indirect READING The AVR Microcontroller and Embedded Systems using Assembly and C) by Muhammad Ali Mazidi, Sarmad Naimi, and Sepehr Naimi Chapter 6: AVR

More information

Interrupts (II) Lecturer: Sri Parameswaran Notes by: Annie Guo

Interrupts (II) Lecturer: Sri Parameswaran Notes by: Annie Guo Interrupts (II) Lecturer: Sri Parameswaran Notes by: Annie Guo 1 External Interrupts The external interrupts are triggered by the INT7:0 pins. If enabled, the interrupts will trigger even if the INT7:0

More information

Yuxi Chen CS250 homework

Yuxi Chen CS250 homework Yuxi Chen CS250 homework 1. Implement the boolean function for segment b for a 7-segment decoder. Using four switches w, x, y, z choose the digits 0, 1, 2, 3,4,5,6,7,8,9,A,B,C,D,E,F in the seven segment

More information

LC-3 Instruction Set Architecture. Textbook Chapter 5

LC-3 Instruction Set Architecture. Textbook Chapter 5 LC-3 Instruction Set Architecture Textbook Chapter 5 Instruction set architecture What is an instruction set architecture (ISA)? It is all of the programmer-visible components and operations of the computer

More information

Memory Usage in Programs

Memory Usage in Programs Memory Usage in Programs ECE2893 Lecture 4a ECE2893 Memory Usage in Programs Spring 2011 1 / 17 The Little Computer 3 (LC3) ECE2893 Memory Usage in Programs Spring 2011 2 / 17 The LC3 Instruction Set,

More information

Logistics. IIT CS 350 S '17 - Hale

Logistics. IIT CS 350 S '17 - Hale Logistics Remember: Lab 5 due next week not this week. Finish it early though so you can move on to Lab 6! Lab 2 grades in BB Required reading posted (Patt & Patel Ch. 5) First exam during class next Wednesday

More information

Assembly Language. Assembly language for x86 compatible processors using GNU/Linux operating system

Assembly Language. Assembly language for x86 compatible processors using GNU/Linux operating system Assembly Language Assembly language for x86 compatible processors using GNU/Linux operating system x86 refers to the instruction set architecture in most personal computers Derives from model numbers ending

More information

COMP2121 Experiment 4

COMP2121 Experiment 4 COMP2121 Experiment 4 1. Objectives In this lab, you will learn AVR programming on Parallel input/output; Some typical input/output devices; and Interrupts 2. Preparation Before coming to the laboratory,

More information

UNIVERSITY OF WISCONSIN MADISON

UNIVERSITY OF WISCONSIN MADISON CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON Prof. Gurindar Sohi TAs: Lisa Ossian, Minsub Shin, Sujith Surendran Midterm Examination 3 In Class (50 minutes) Friday,

More information

ECE 30 Introduction to Computer Engineering

ECE 30 Introduction to Computer Engineering ECE 30 Introduction to Computer Engineering Study Problems, Set #3 Spring 2015 Use the MIPS assembly instructions listed below to solve the following problems. arithmetic add add sub subtract addi add

More information

Introduction to Computers - Chapter 4

Introduction to Computers - Chapter 4 Introduction to Computers - Chapter 4 Since the invention of the transistor and the first digital computer of the 1940s, computers have been increasing in complexity and performance; however, their overall

More information

ATmega Interrupts. Reading. The AVR Microcontroller and Embedded Systems using Assembly and C) by Muhammad Ali Mazidi, Sarmad Naimi, and Sepehr Naimi

ATmega Interrupts. Reading. The AVR Microcontroller and Embedded Systems using Assembly and C) by Muhammad Ali Mazidi, Sarmad Naimi, and Sepehr Naimi 1 P a g e ATmega Interrupts Reading The AVR Microcontroller and Embedded Systems using Assembly and C) by Muhammad Ali Mazidi, Sarmad Naimi, and Sepehr Naimi Chapter 10: AVR Interrupt Programming in Assembly

More information

Mechatronics and Microcomputers. Stipendium Hungaricum 2018/2019 Autumn Semester Szilárd Aradi, PhD

Mechatronics and Microcomputers. Stipendium Hungaricum 2018/2019 Autumn Semester Szilárd Aradi, PhD Mechatronics and Microcomputers Stipendium Hungaricum 2018/2019 Autumn Semester Szilárd Aradi, PhD ATmega128 CPU Single-level pipelining Egyciklusú ALU működés Reg. reg., reg. konst. közötti műveletek

More information

LC-3 ISA - II. Lecture Topics. Lecture materials. Homework. Machine problem. Announcements. ECE 190 Lecture 10 February 17, 2011

LC-3 ISA - II. Lecture Topics. Lecture materials. Homework. Machine problem. Announcements. ECE 190 Lecture 10 February 17, 2011 LC- ISA - II Lecture Topics LC- data movement instructions LC- control instructions LC- data path review Lecture materials Textbook 5. - 5.6 Textbook Appendix A. Homework HW due Wednesday February 2 at

More information

Embedded Systems Programming. ETEE 3285 Topic HW3: Coding, Compiling, Simulating

Embedded Systems Programming. ETEE 3285 Topic HW3: Coding, Compiling, Simulating Embedded Systems Programming ETEE 3285 Topic HW3: Coding, Compiling, Simulating 1 Assignment Write the Chasing Lights Program in C Use Codevision AVR to compile the program and remove all syntax errors

More information

2 Basic operations with AT90S1200 and TINY12

2 Basic operations with AT90S1200 and TINY12 2 Basic operations with AT90S1200 and TINY12 The best way to learn is through example and by doing things yourself. For the rest of the book we will cover example projects, many of which will be largely

More information

Embedded Systems. PIC16F84A Internal Architecture. Eng. Anis Nazer First Semester

Embedded Systems. PIC16F84A Internal Architecture. Eng. Anis Nazer First Semester Embedded Systems PIC16F84A Internal Architecture Eng. Anis Nazer First Semester 2017-2018 Review Computer system basic components? CPU? Memory? I/O? buses? Instruction? Program? Instruction set? CISC,

More information

October 24. Five Execution Steps

October 24. Five Execution Steps October 24 Programming problems? Read Section 6.1 for November 5 How instructions execute Test Preview Ask Questions! 10/24/2001 Comp 120 Fall 2001 1 Five Execution Steps Instruction Fetch Instruction

More information

Embedded Systems and Software

Embedded Systems and Software Embedded Systems and Software Lab 4 Considerations Formatting for LCD Slide 1 Lab 4 Issues Displaying the Frequency and Duty Cycle on the LCD Formatting for LCD Slide 2 F = 2 5 H z D C = 7 5. 6 % Formatting

More information

DESIGN NOTE #032. AVR Boot Loader. Introduction. Overview AUTHOR: MARIANO BARRÓN RUIZ KEYWORDS: BOOT LOADER, SPM, SELF-PROGRAMMING

DESIGN NOTE #032. AVR Boot Loader. Introduction. Overview AUTHOR: MARIANO BARRÓN RUIZ KEYWORDS: BOOT LOADER, SPM, SELF-PROGRAMMING DESIGN NOTE AUTHOR: #032 MARIANO BARRÓN RUIZ ISPBARUM@SB.EHU.ES KEYWORDS: BOOT LOADER, SPM, SELF-PROGRAMMING This document is originally distributed by AVRfreaks.net, and may be distributed, reproduced,

More information

FAKULTI KEJURUTERAAN ELEKTRIK FAKULTI KEJURUTERAAN ELEKTRIK UNIVERSITI TEKNOLOGI MALAYSIA KAMPUS SKUDAI JOHOR SKEE 3732 MICROPROCESSOR LABORATORY

FAKULTI KEJURUTERAAN ELEKTRIK FAKULTI KEJURUTERAAN ELEKTRIK UNIVERSITI TEKNOLOGI MALAYSIA KAMPUS SKUDAI JOHOR SKEE 3732 MICROPROCESSOR LABORATORY Fakulti: Nama Matapelajaran: Kod Matapelajaran : SKEE 3732 FAKULTI KEJURUTERAAN ELEKTRIK Semakan Tarikh Keluaran Pindaan Terakhir No. Prosedur : 1 : September 2016 : September 2017 : PKUTMFKE(0)10 FAKULTI

More information

CSE 351 Midterm - Winter 2015 Solutions

CSE 351 Midterm - Winter 2015 Solutions CSE 351 Midterm - Winter 2015 Solutions February 09, 2015 Please read through the entire examination first! We designed this exam so that it can be completed in 50 minutes and, hopefully, this estimate

More information

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING COMPUTER SCIENCES DEPARTMENT UNIVERSITY OF WISCONSIN-MADISON

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING COMPUTER SCIENCES DEPARTMENT UNIVERSITY OF WISCONSIN-MADISON CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING COMPUTER SCIENCES DEPARTMENT UNIVERSITY OF WISCONSIN-MADISON Prof. Mark D. Hill & Prof. Mikko H. Lipasti TAs Sanghamitra Roy, Eric Hill, Samuel Javner,

More information

Exam I Review February 2017

Exam I Review February 2017 Exam I Review February 2017 Binary Number Representations Conversion of binary to hexadecimal and decimal. Convert binary number 1000 1101 to hexadecimal: Make groups of 4 bits to convert to hexadecimal,

More information

ECE 109 Sections 602 to 605 Final exam Fall December, 2007

ECE 109 Sections 602 to 605 Final exam Fall December, 2007 ECE 109 Sections 602 to 605 Final exam Fall 2007 13 December, 2007 This is a closed book and closed notes exam. Calculators, PDA's, cell phones, and any other electronic or communication devices may not

More information

11. A Computing Machine

11. A Computing Machine COMPUTER SCIENCE S E D G E W I C K / W A Y N E Computer Science Including Programming in Java 11. A Computing Machine Section 5.1 http://introcs.cs.princeton.edu COMPUTER SCIENCE S E D G E W I C K / W

More information

acret Ameya Centre for Robotics & Embedded Technology Syllabus for Diploma in Embedded Systems (Total Eight Modules-4 Months -320 Hrs.

acret Ameya Centre for Robotics & Embedded Technology Syllabus for Diploma in Embedded Systems (Total Eight Modules-4 Months -320 Hrs. acret Ameya Centre for Robotics & Embedded Technology Syllabus for Diploma in Embedded Systems (Total Eight Modules-4 Months -320 Hrs.) Module 0 Introduction Introduction to Embedded Systems, Real Time

More information

LC-3 Assembly Language

LC-3 Assembly Language Chapter 7 LC-3 Assembly Language CS Reality You ve got to know assembly Chances are, you ll never write program in assembly Compilers are much better & more patient than you are Understanding assembly

More information

ECE 375: Computer Organization and Assembly Language Programming

ECE 375: Computer Organization and Assembly Language Programming ECE 375: Computer Organization and Assembly Language Programming SECTION OVERVIEW Lab 5 Large Number Arithmetic Complete the following objectives: ˆ Understand and use arithmetic/alu instructions. ˆ Manipulate

More information

Module 10: System Integration & Planning. Introduction to I/O Elementary I/O in AVR MSI devices

Module 10: System Integration & Planning. Introduction to I/O Elementary I/O in AVR MSI devices Module 10: System Integration & Planning Introduction to I/O Elementary I/O in AVR MSI devices Introduction Introduction o There are five types of project complexity possibilities: o Purely software o

More information

The Assembly Language of the Boz 5

The Assembly Language of the Boz 5 The Assembly Language of the Boz 5 The Boz 5 uses bits 31 27 of the IR as a five bit opcode. Of the possible 32 opcodes, only 26 are implemented. Op-Code Mnemonic Description 00000 HLT Halt the Computer

More information

CHW 469 : Embedded Systems

CHW 469 : Embedded Systems CHW 469 : Embedded Systems Instructor: Dr. Ahmed Shalaby http://bu.edu.eg/staff/ahmedshalaby4# I/O Ports in AVR The AVR microcontroller and embedded systems using assembly and c Topics AVR pin out The

More information

ก AVR Microcontrollers

ก AVR Microcontrollers ก AVR Microcontrollers. ก ก AVR Microcontrollers Architecture 1 Instruction Execution Timing The Parallel Instruction Fetches and Instruction Executions Single Cycle ALU Operation AVR Microcontrollers

More information

ECE/CS 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

ECE/CS 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON ECE/CS 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON Prof. Mikko Lipasti & Prof. Gurindar S. Sohi TAs: Felix Loh, Daniel Chang, Philip Garcia, Sean Franey, Vignyan Kothinti

More information

Program Development. Chapter 5

Program Development. Chapter 5 Chapter 5 Program Development Expected Outcomes Distinguish between various codes in the programming language Explain the role of assembler and compiler Distinguish between different data types Use directive

More information