Introduction to Assembly language
|
|
- Marvin Simon
- 6 years ago
- Views:
Transcription
1 Introduction to Assembly language 1 USING THE AVR MICROPROCESSOR
2 Outline Introduction to Assembly Code The AVR Microprocessor Binary/Hex Numbers Breaking down an example microprocessor program AVR instructions overview Compiling and downloading assembly code Running and debugging assembly code 2
3 A really simple program Some variables (i,j) Set variables to initial values A loop Check a condition to see if we are finished Do some arithmetic Output some information Increment the loop counter 3 int main(void) { char i; char j; i=0; j=0; while (i<10) { j = j + i; PORTB = j; PORTB = i; i++; } return 0; }
4 Running a program on a microprocessor When you want to turn your program into something which runs on a microprocessor you typically compile the program This creates a program in the machine language of the microprocessor A limited set of low level instructions which can be executed directly by the microprocessor We can also program in this language using an assembler We can have a look at the assembly language the c compiler generates for our simple program to understand how this works 4
5 Translating our program into assembly language int main(void) { } char i; char j; i=0; j=0; while (i<10) { j = j + i; PORTB = j; PORTB = i; i++; } return 0; be <main>: be: 80 e0 ldi r24, 0x00 ; 0 c0: 90 e0 ldi r25, 0x00 ; 0 c2: 98 0f add r25, r24 c4: 92 bb out 0x18, r25 ; 18 c6: 82 bb out 0x18, r24 ; 18 c8: 8f 5f subi r24, 0xFF ; 255 ca: 8a 30 cpi r24, 0x0A ; 10 cc: d1 f7 brne.-12 ; 0xc2 <main+0x4> ce: 80 e0 ldi r24, 0x00 ; 0 d0: 90 e0 ldi r25, 0x00 ; 0 d2: ret Location in program memory (Address) Opcodes the program code The Assembly language equivalent of the opcodes
6 AVR Microprocessor architecture Program Memory Your code goes here 6 Registers Storage for numbers the processer will perform arithmetic on Input/Output Interface to the outside world Arithmetic Logic Unit (ALU) The heart of the processor which handles logic/math
7 Numbers on a microprocessor 7 We ve seen that our program is converted into a series of numbers for execution on the microprocessor Numbers are stored in a microprocessor in memory They can be moved in an out of registers and memory Calculations can be done Numbers can be sent to Output devices and read from Input devices The numbers are stored internally in binary representations. We will study precisely how this is done shortly, and even build some simple memory devices.
8 Binary/Hexadecimal Numbers A Bit can be a 0 or 1 The value is set using transistors in the hardware Bits are organized into groups to represent numbers 4 Bits is a Nybble Can store numbers Bits is a Byte Can store numbers Bits is a word Can store numbers Hexadecimal is a very handy representation for binary numbers Each 4 bits maps onto a HEX number Can quickly convert from HEX to binary 8 Binary Hex Decimal A B C D E F 15
9 Binary Representation This representation is based on powers of 2. Any number can be expressed as a string of 0s and 1s 9 Example: 5 = = 1* * *2 0 Example: 9 = = 1* * * *2 0 Exercise: Convert the numbers 19, 38, 58 from decimal to binary. (use an envelope, a calculator or C program)
10 Hexadecimal Representation 10 This representation is based on powers of 16. Any number can be expressed in terms of: 0,1,2,,9,A,B,C,D,E,F (0,1,2,,9,10,11,12,13,14,15) Example: 256 = = 1* * *16 0 Example: 1002 = 3EA 16 = 3* * *16 0 Exercise: Convert the numbers 1492, 3481, 558 from decimal to hex. (use calculator or maths package)
11 HEX/Binary Conversion Converting HEX/Binary to Decimal is a bit painful, but converting HEX/Binary is trivial We often use the notations 0x or $ to represent a HEX number Example 0x15AB for the HEX number 15AB In assember language we see the notation $A9 for the HEX number A9 11 Exercise: Convert the numbers 0xDEAD 0xBEEF from Hex to binary. Now convert them to Decimal
12 8 Bit Microprocessors 12 The AVR microprocessor we will be using is an 8 bit processor The operations the processor performs work on 8 bit numbers Data is copied from memory into the processors internal registers 8 bits at a time Operations (addition/subtraction/etc..) can be performed on the 8 bit registers We can of course do calculation with bigger numbers, but we will have to do this as a sequence of operations on 8 bit numbers We will see how to do this later using a carry bit
13 Operations The processor can perform several operations Including Boolean algebra Operation Register A Register B Result Add A,B Not A OR A,B ShiftL A ShiftR A AND A,B Exercise: (1) Find NOT(AAA) (2) Find OR(AAA; 555) (3) Find AND (AEB123; FFF000) Why is shift important? Try ShiftR(011) ShiftL(011) (what do SHIFTR and ShiftL do in base 10?)
14 What About Subtraction: Negative Numbers 14 With 4 bits, you can represent 0 to to + 7 There are three ways to represent these negative numbers Sign/Magnitude: Set the top bit to 1 1 s complement : Take the complement of the number 2 s complement : Take the complement of the number and then add 1 Integer Sign Magnitude 1 s complement (-0) 0111(??) s complement
15 What About Subtraction: Negative Numbers There is a good reason to use a 2 s complement representation 15 Binary addition of a two s complement numbers just works whether the numbers are positive or negative = 0111 = 1111 = 0001 = 1001 (7) (-1) (+1) (-7) Exercise: Fill out the same table using sign magnitude numbers. Do you understand now why 2 s complement is a useful representation!
16 8 Bit representations 8 bits can be used to represent any 256 different symbols The numbers The numbers -128 to Part of a longer number A Character Hence char in c This is a bit out of date Unicode uses 16 bits 16
17 Back to our program be <main>: be: 80 e0 ldi r24, 0x00 ; 0 c0: 90 e0 ldi r25, 0x00 ; 0 c2: 98 0f add r25, r24 c4: 92 bb out 0x18, r25 ; 18 c6: 82 bb out 0x18, r24 ; 18 c8: 8f 5f subi r24, 0xFF ; 255 ca: 8a 30 cpi r24, 0x0A ; 10 cc: d1 f7 brne.-12 ; 0xc2 <main+0x4> ce: 80 e0 ldi r24, 0x00 ; 0 d0: 90 e0 ldi r25, 0x00 ; 0 d2: ret The program is stored in program memory There are 64Kilobytes of program memory (2^16 bytes) Each location stores an 8 bit number The location is specified with a 16 bit Address (0x0000-0xFFFF) Address 00BE 80 00BF Value E0 00C C1 E0 00C C3 0F 00C4 92
18 18 Registers on the AVR There are 32 General purpose registers on the AVR microprocessor (R0-R31) AVR Registers where the numerical work is done in a program Each of these can hold an 8 bit number R26:R27 is also a 16 bit register called X R28:R29 is Y R30:R31 is Z You can perform calculations on these registers very quickly
19 Back to our program: Loading a register be <main>: be: 80 e0 ldi r24, 0x00 ; 0 c0: 90 e0 ldi r25, 0x00 ; 0 c2: 98 0f add r25, r24 c4: 92 bb out 0x18, r25 ; 18 c6: 82 bb out 0x18, r24 ; 18 c8: 8f 5f subi r24, 0xFF ; 255 ca: 8a 30 cpi r24, 0x0A ; 10 cc: d1 f7 brne.-12 ; 0xc2 <main+0x4> ce: 80 e0 ldi r24, 0x00 ; 0 d0: 90 e0 ldi r25, 0x00 ; 0 d2: ret The first instruction is loading a value of 0x00 into register r24 This instruction is encoded in the 16 bit opcode stored at address 00BE The Assembler code is ldi r24,0x00 LoaD Immediate r24 with 0x00 Address 00BE 80 00BF Value E0 00C C1 E0 00C C3 0F 00C4 92
20 Decoding an Opcode 20 be: 80 e0 ldi r24, 0x00 Words are stored little endian Read into the processor as E080 E080= dddd: 1000=8 -> 16+8 = r24 KKKKKKKK=0x00 Exercise: what is the opcode for ldi r19, 0x3F
21 Back to our program: Loading a register be <main>: be: 80 e0 ldi r24, 0x00 ; 0 c0: 90 e0 ldi r25, 0x00 ; 0 c2: 98 0f add r25, r24 c4: 92 bb out 0x18, r25 ; 18 c6: 82 bb out 0x18, r24 ; 18 c8: 8f 5f subi r24, 0xFF ; 255 ca: 8a 30 cpi r24, 0x0A ; 10 cc: d1 f7 brne.-12 ; 0xc2 <main+0x4> ce: 80 e0 ldi r24, 0x00 ; 0 d0: 90 e0 ldi r25, 0x00 ; 0 d2: ret The second instruction is loading a value of 0x00 into register r25 This adds r24 to r25 and stores the result into register r25 The next instructions output r24 and r25 (we ll learn where later) This is subtracting a value of 0xFF from register r24 This is the compiler cleverly adding 1 This instruction is comparing the value 0x0A to register r24 If they are not equal, the next instruction will branch back to location 0xC2 that is loop back if they are equal it continues on (and returns from main)
22 Compare assembly language to c int main(void) { } char i; char j; i=0; j=0; while (i<10) { j = j + i; PORTB = j; PORTB = i; i++; } return 0; be <main>: be: 80 e0 ldi r24, 0x00 ; 0 c0: 90 e0 ldi r25, 0x00 ; 0 c2: 98 0f add r25, r24 c4: 92 bb out 0x18, r25 ; 18 c6: 82 bb out 0x18, r24 ; 18 c8: 8f 5f subi r24, 0xFF ; 255 ca: 8a 30 cpi r24, 0x0A ; 10 cc: d1 f7 brne.-12 ; 0xc2 <main+0x4> ce: 80 e0 ldi r24, 0x00 ; 0 d0: 90 e0 ldi r25, 0x00 ; 0 d2: ret Here the variables are stored in registers r24, r25 Pretty easy to see how this program is translated More complex programs quickly become very complicated to understand in assembly language
23 Programming in this course We will be programming exclusively in assembler Allows us to understand precisely what the microprocessor is going to do and how long it will take to do so important for time critical applications Full access to all functions of the microprocessor With care can make very efficient use of resources Sometimes very important for small microprocessors Programming in assembler requires some discipline Code can be very difficult to understand The code is very low level 23 Line by line comments very important
24 The AVR instruction set We ve seen a few sample instructions which cover most of the basic type of operations Arithmetic and Logic instructions (ADD, SUB, AND, OR, EOR, COM, INC, DEC, ) Branch Instructions Jump to a different location depending on a test Data transfer instructions 24 Move data to/from Registers and memory Bit setting and testing operations Manipulate and test bits in registers
25 Arithmetic and Logic Instructions 25 Addition add r20,r21 R20 ß r20+r21 Increment inc r20 R20 ß r20+1 Subtraction subi r20,$22 R20 ß r20-$22 sub r20,r21 R20 ß r20-r21 Logic and r20,r24 R20 ß AND(r20,r24) Many instructions work either with two registers, or with immediate data values (stored in the opcode)
26 Arithmetic and Logic Instructions The full set 26
27 The Status Register 27 Every time the processor performs an operation it sets bits in the Status Register (SREG) Example cpi r01,$77 This register is in the I/O region SREG can be examined/set with the in and out instructions in r17,sreg out SREG,r22 The status bits are also tested by branch instructions to decide whether or not to jump to a different location
28 Branch Instructions Branch breq label1 Branch if equal to location label1 brlo label2 Branch if lower to location label2 If the Branch test fails the next line of code is executed If the Branch test is successful, the program jumps to the location specified Jump jmp label3 Jump to label3 no information about where we jumped from is saved. This is a one way trip 28 Call, Return rcall mysub ret Call subroutine mysub. The program saves information about where it currently is executing and then jumps to the code at mysub. When the subroutine is finished it calls ret, which then returns to where the rcall was made.
29 All Branch Instructions 29
30 Data Transfer Instructions 30 Load ldi r20,$73 R20 ß $73 ld r20,x R20 ß (X) Input in r20,pind R20 ß PIND Copy Register mov r20,r21 R20 ß r21 Output out PORTD,r24 PORTD ß r24 There are a few quirks about loading and storing to memory. We will cover this in detail soon.
31 Data transfer reference 31
32 32 The Atmega128 The microprocessor you will be using has several input and output ports Some of these are already connected to switches or LEDs on the boards we are using Others will be available to you to connect to various devices. It is time to make some lights blink!
33 Setting up the Input/Output ports: 33 For the ports we are using we set the Data Direction Register (DDR) which has a bit for each bit of I/O (1 for input, 0 for output) We can then set the initial value of the data bits at the I/O port PortB is connected to LEDs on our board PortD is connected to the blue switches ; ******* Port B Setup Code **** ldi r16, $FF ; all bits out out DDRB, r16 ; Port B Direction Register ldi r16, $FF ; Init value out PORTB, r16 ; Port B value ; ******* Port D Setup Code **** ldi r16, $00 ; all bits in out DDRD, r16 ; Port D Direction Register ldi r16, $FF ; Init value out PORTD, r16 ; Port D value
34 The ATmega128 Microprocessor 34 In this course you will be using the ATmega128 processor mounted on an ATMEL programming board (STK300)
35 Where the I/O ports are connected 35 PORTD Switches PORTB LEDs PORT connectors
36 Setting up a code directory Create a directory on your H: drive where you will store your code 36 Download the file Simple.asm onto your computer from the course web page (Assembler Codes):
37 Getting Started with STUDIO 7: Go to Start à Programs à ATMEL Studio 7.0 à ATMEL Studio 7.0 Select advanced mode 37 Select New Project
38 Getting Started with STUDIO 7: You should now see the window: 38 Pick Assembler Click this and navigate to your code directory. Put on H: drive! Create new folder Pick a name for your project At the end
39 Getting Started with STUDIO 4: 39 You should now see the window: Select ATmega 128 At the end
40 Getting started with Studio 7: 40 Navigate to and open downloaded Simple.asm Your file Main edit window M. Neil- Microprocessor Course
41 Getting started with Studio 7: 41 Paste into your file main.asm Close Simple.asm Copy code from Simple.asm M. Neil- Microprocessor Course
42 Building and Running your Program : 42 Click to open project properties Save then close Select Simulator
43 Building and Running your Program : 43 Click on Build Output window appears showing a successful build or other wise!
44 Building and Running your Program : 44 Some new files have been generated
45 Building and Running your Program : 45 Hit Start debugging and break button Current point in code Click to open other monitoring windows Memory window
46 Open monitoring Windows: 46 IO window shows many others Processor Status window shows many processor resources Open as required for detailed view
47 Stepping in the simulator 47 More comands available through Debug menu Current point in program Click this to step through programme Here to run without display Here to pause Here to reset M. Neil- Microprocessor Course Arrange monitoring windows in main window as you desire
48 Exercising the ATmega128 commands: Download the program Simple.asm, assemble it and run it in the simulator Step through the program and make sure you understand what is happening after each instruction Try changing the number of times the loop is executed and make sure you understand the outputs on PORTB 48
49 Programming the board 49 Power connector and switch ISP interface: Programming only Connect gold box ICE programmer from computer USB to JTAG interface JTAG interface: Programming and debugging
50 What is the In Circuit Emulator/Debugger doing? JTAG (Joint Test Action Group) connector provides an interface to your microprocessor that lets you Download from main computer to microprocessor device memory (programme and data) 50 Control execution of code in microprocessor (start/stop/step) Read device memory and register contents back to computer ICE is a useful tool not just for its ability to programme your microprocessor but also to let you see how your programme is working on the device in its particular application environment
51 Running the in circuit programmer/debugger 51 Save then close Click to open project properties Select Atmel- ICE and JTAG interface M. Neil- Microprocessor Course
52 Stepping through with the ICE 52 Current point in program Click this to step through programme Here to run without display Here to pause Here to reset Click here to change bits in regiisters M. Neil- Microprocessor Course You are now running on the microprocessor!
53 Programs to write I: 53 Download the program simple.asm, assemble it download it to the board and run it. What do you see on the LEDs? Do you know why (note that a dark LED è 1)? change the code so that output on the LEDs has a lit LED for a 1 (think about using the com instruction) Modify the program so that it changes the number of times the loop is run depending on which switch button is pushed Use the instruction in Rxx,PIND to get the state of the buttons Make sure that the LED output makes sense when you push the different buttons
54 Programs to write II: 54 Make a counter from 0 FF, output the values to PORTB and look with your scope probe at the LSB (PB0). How long does it take to make an addition? Why does the B0 bit toggle with a frequency that is twice that of B1? (check this using two scope probes; one on B0 and another on B1) In the documentation you will find how many clock counts are required to perform an instruction in your program. The ATmega128 has an 8 MHz clock. Predict the time it takes to do an addition and compare with your measurement using the scope.
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 informationAVR 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 informationAVR 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 informationModule 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 informationCN310 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 informationIAS0430 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 informationModule 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 informationCS 261 Fall Binary Information (convert to hex) Mike Lam, Professor
CS 261 Fall 2018 Mike Lam, Professor 3735928559 (convert to hex) Binary Information Binary information Topics Base conversions (bin/dec/hex) Data sizes Byte ordering Character and program encodings Bitwise
More informationBy: 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 informationLab 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 informationLecture 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 informationM1 Computers and Data
M1 Computers and Data Module Outline Architecture vs. Organization. Computer system and its submodules. Concept of frequency. Processor performance equation. Representation of information characters, signed
More informationMicroprocessor Fundamentals. Topic 8 Binary Addition
Microprocessor Fundamentals Topic 8 Binary Addition Objectives Examine several assembler directives:.dseg /.eseg /.cseg.db.byte Use indirect addressing X register (r26 and r27) Post-increment Store results
More informationMicroprocessor 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 informationCOMP2121 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 informationComputer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2
Computer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2 Instructor: Rob Bergen Applied Computer Science University of Winnipeg Announcements Website is up
More informationAT90S 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 informationCOMP2121: 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 informationECE 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 informationCOMP2121: Microprocessors and Interfacing. I/O Devices (II)
COMP2121: Microprocessors and Interfacing I/O Devices (II) http://www.cse.unsw.edu.au/~cs2121 Lecturer: Hui Wu Session 2, 2017 1 Overview Keyboard LCD (Liquid Crystal Display) 2 2 Input Switches (1/2)
More informationMark II Aiken Relay Calculator
Introduction to Embedded Microcomputer Systems Lecture 6.1 Mark II Aiken Relay Calculator 2.12. Tutorial 2. Arithmetic and logical operations format descriptions examples h 8-bit unsigned hexadecimal $00
More informationLogic Instructions and Programs READING
1 P a g e Logic Instructions and Programs READING The AVR Microcontroller and Embedded Systems using Assembly and C) by Muhammad Ali Mazidi, Sarmad Naimi, and Sepehr Naimi Chapter 5: Arithmetic, Logic
More informationLab 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 informationSOME ASSEMBLY REQUIRED
SOME ASSEMBLY REQUIRED Assembly Language Programming with the AVR Microcontroller TIMOTHY S. MARGUSH CRC Press Taylor & Francis Group CRC Press is an imprint of the Taylor & Francis Croup an Informa business
More informationEmbedded programming, AVR intro
Applied mechatronics, Lab project Embedded programming, AVR intro Sven Gestegård Robertz Department of Computer Science, Lund University 2017 Outline 1 Low-level programming Bitwise operators Masking and
More informationEE292: Fundamentals of ECE
EE292: Fundamentals of ECE Fall 2012 TTh 10:00-11:15 SEB 1242 Lecture 22 121115 http://www.ee.unlv.edu/~b1morris/ee292/ 2 Outline Review Binary Number Representation Binary Arithmetic Combinatorial Logic
More informationSurvey. Motivation 29.5 / 40 class is required
Survey Motivation 29.5 / 40 class is required Concerns 6 / 40 not good at examination That s why we have 3 examinations 6 / 40 this class sounds difficult 8 / 40 understand the instructor Want class to
More informationFIFTH 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 informationProgramming. A. Assembly Language Programming. A.1 Machine Code. Machine Code Example: Motorola ADD
A. Assembly Language Programming Programming of a computer system: Machine code direct execution Assembly language tool: assembler High level programming language tool: interpreter tool: compiler Programming
More informationAVR. 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 informationRobosoft Systems in association with JNCE presents. Swarm Robotics
Robosoft Systems in association with JNCE presents Swarm Robotics What is a Robot Wall-E Asimo ABB Superior Moti ABB FlexPicker What is Swarm Robotics RoboCup ~ 07 Lets Prepare for the Robotics Age The
More informationAVR. (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 informationRegister-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 informationCHAPTER 1 Numerical Representation
CHAPTER 1 Numerical Representation To process a signal digitally, it must be represented in a digital format. This point may seem obvious, but it turns out that there are a number of different ways to
More informationInstruction : A command to the microprocessor to perform a given task on specified data. Each instruction has two parts
Lecture 4 Instruction : A command to the microprocessor to perform a given task on specified data. Each instruction has two parts One part is the task to be performed, called operation code or opcode in
More informationAssembly Language Programming of 8085
Assembly Language Programming of 8085 Topics 1. Introduction 2. Programming model of 8085 3. Instruction set of 8085 4. Example Programs 5. Addressing modes of 8085 6. Instruction & Data Formats of 8085
More informationAssembly Language Programming of 8085
Assembly Language Programming of 8085 1. Introduction A microprocessor executes instructions given by the user Instructions should be in a language known to the microprocessor Microprocessor understands
More information;Compiler Options.NOLIST.INCLUDE "C:\Program Files (x86)\atmel\avr Tools\AvrAssembler2\Appnotes\m8515def.inc"
;* CharTest.asm ;* ;* Created: 28/06/2017 9:37 p.m. ;* Author: ob1 ;ST7820 128 x 64 graphics mode character display 8 lines x 21 characters ;Modification and redistribution under provisions of GNU general
More informationAn FPGA Implementation of 8-bit RISC Microcontroller
An FPGA Implementation of 8-bit RISC Microcontroller Krishna Kumar mishra 1, Vaibhav Purwar 2, Pankaj Singh 3 1 M.Tech scholar, Department of Electronic and Communication Engineering Kanpur Institute of
More informationChapter 4: Atmel s AVR 8-bit Microcontroller Part 1 Assembly Programming
Chapter 4: Atmel s AVR 8-bit Microcontroller Part 1 Assembly Programming Prof. Ben Lee Oregon State University School of Electrical Engineering and Computer Science Chapter Goals Understand how to program
More informationNumber Representations
Simple Arithmetic [Arithm Notes] Number representations Signed numbers Sign-magnitude, ones and twos complement Arithmetic Addition, subtraction, negation, overflow MIPS instructions Logic operations MIPS
More informationPage 1. Structure of von Nuemann machine. Instruction Set - the type of Instructions
Structure of von Nuemann machine Arithmetic and Logic Unit Input Output Equipment Main Memory Program Control Unit 1 1 Instruction Set - the type of Instructions Arithmetic + Logical (ADD, SUB, MULT, DIV,
More informationAVR Logical and Bitwise Instructions
AVR Logical and Bitwise Instructions Assembly Language Programming SDSMT Dr. Randy C. Hoover Boolean Logic An algebraic system for Boolean data Set: {false, true) Operations: and, or, not The operations
More information8051 Overview and Instruction Set
8051 Overview and Instruction Set Curtis A. Nelson Engr 355 1 Microprocessors vs. Microcontrollers Microprocessors are single-chip CPUs used in microcomputers Microcontrollers and microprocessors are different
More informationBeginning C Programming for Engineers
Beginning Programming for Engineers R. Lindsay Todd Lecture 6: Bit Operations R. Lindsay Todd () Beginning Programming for Engineers Beg 6 1 / 32 Outline Outline 1 Place Value Octal Hexadecimal Binary
More informationEmbedded Systems and Software
Embedded Systems and Software Lecture 11 Interrupts Interrupts Slide 1 Interrupts One way to think of interrupts is that they are hardwaregenerated functions calls Internal Hardware When timer rolls over,
More informationCopyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Review Topics. parameter passing, memory model)
Final Exam Review Original slides from Gregory Byrd, North Carolina State University Modified slides by C. Wilcox, S. Rajopadhye Colorado State University Review Topics! Number Representation & Arithmetic!
More informationAVR MICROCONTROLLER ARCHITECTURTE
AVR MICROCONTROLLER ARCHITECTURTE AVR MICROCONTROLLER AVR- Advanced Virtual RISC. The founders are Alf Egil Bogen Vegard Wollan RISC AVR architecture was conceived by two students at Norwegian Institute
More informationTopic Notes: Bits and Bytes and Numbers
Computer Science 220 Assembly Language & Comp Architecture Siena College Fall 2010 Topic Notes: Bits and Bytes and Numbers Binary Basics At least some of this will be review, but we will go over it for
More informationdata within a computer system are stored in one of 2 physical states (hence the use of binary digits)
Binary Digits (bits) data within a computer system are stored in one of 2 physical states (hence the use of binary digits) 0V and 5V charge / NO charge on a transistor gate ferrite core magnetised clockwise
More informationCSIS1120A. 10. Instruction Set & Addressing Mode. CSIS1120A 10. Instruction Set & Addressing Mode 1
CSIS1120A 10. Instruction Set & Addressing Mode CSIS1120A 10. Instruction Set & Addressing Mode 1 Elements of a Machine Instruction Operation Code specifies the operation to be performed, e.g. ADD, SUB
More informationComputer Architecture /
Computer Architecture 02-201 / 02-601 The Conceptual Architecture of a Computer PC CPU register 0 register 1 register 2 registers hold small amounts of data for processing by the CPU Reading / writing
More informationDebugging embedded HW/SW systems differs greatly from debugging software or hardware alone. Key steps to debugging: 1
Debugging embedded HW/SW systems differs greatly from debugging software or hardware alone. Key steps to debugging: 1 Make the bug repeatable Observe its behavior and gather information on it Create a
More informationEE 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 informationTopic Notes: Bits and Bytes and Numbers
Computer Science 220 Assembly Language & Comp Architecture Siena College Fall 2011 Topic Notes: Bits and Bytes and Numbers Binary Basics At least some of this will be review for most of you, but we start
More informationCN310 Microprocessor Systems Design
CN310 Microprocessor Systems Design Microcontroller Nawin Somyat Department of Electrical and Computer Engineering Thammasat University Outline Course Contents 1 Introduction 2 Simple Computer 3 Microprocessor
More informationGrading: 3 pts each part. If answer is correct but uses more instructions, 1 pt off. Wrong answer 3pts off.
Department of Electrical and Computer Engineering University of Wisconsin Madison ECE 552 Introductions to Computer Architecture Homework #2 (Suggested Solution) 1. (10 points) MIPS and C program translations
More informationInf2C - Computer Systems Lecture 2 Data Representation
Inf2C - Computer Systems Lecture 2 Data Representation Boris Grot School of Informatics University of Edinburgh Last lecture Moore s law Types of computer systems Computer components Computer system stack
More informationProgramming (1.0hour)
COMPETITOR S INSTRUCTION:- Attempt all questions: Where applicable circle the letter that indicates the correct answer. Otherwise answer questions as instructed D1.1 Embedded code is used widely in modern
More informationCSCI 2212: Intermediate Programming / C Chapter 15
... /34 CSCI 222: Intermediate Programming / C Chapter 5 Alice E. Fischer October 9 and 2, 25 ... 2/34 Outline Integer Representations Binary Integers Integer Types Bit Operations Applying Bit Operations
More informationChapter 2 Number System
Chapter 2 Number System Embedded Systems with ARM Cortext-M Updated: Tuesday, January 16, 2018 What you should know.. Before coming to this class Decimal Binary Octal Hex 0 0000 00 0x0 1 0001 01 0x1 2
More informationGrundlagen Microcontroller Processor Core. Günther Gridling Bettina Weiss
Grundlagen Microcontroller Processor Core Günther Gridling Bettina Weiss 1 Processor Core Architecture Instruction Set Lecture Overview 2 Processor Core Architecture Computes things > ALU (Arithmetic Logic
More informationEE 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 informationCSCI 2121 Computer Organization and Assembly Language PRACTICE QUESTION BANK
CSCI 2121 Computer Organization and Assembly Language PRACTICE QUESTION BANK Question 1: Choose the most appropriate answer 1. In which of the following gates the output is 1 if and only if all the inputs
More informationPhysics 335 Intro to MicroControllers and the PIC Microcontroller
Physics 335 Intro to MicroControllers and the PIC Microcontroller May 4, 2009 1 The Pic Microcontroller Family Here s a diagram of the Pic 16F84A, taken from Microchip s data sheet. Note that things are
More informationReview 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 informationE3940 Microprocessor Systems Laboratory. Introduction to the Z80
E3940 Microprocessor Systems Laboratory Introduction to the Z80 Andrew T. Campbell comet.columbia.edu/~campbell campbell@comet.columbia.edu E3940 Microprocessor Systems Laboratory Page 1 Z80 Laboratory
More informationProblem Set 1 Solutions
CSE 260 Digital Computers: Organization and Logical Design Jon Turner Problem Set 1 Solutions 1. Give a brief definition of each of the following parts of a computer system: CPU, main memory, floating
More informationELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-2700: Digital Logic Design Winter Notes - Unit 4. hundreds.
UNSIGNED INTEGER NUMBERS Notes - Unit 4 DECIMAL NUMBER SYSTEM A decimal digit can take values from to 9: Digit-by-digit representation of a positive integer number (powers of ): DIGIT 3 4 5 6 7 8 9 Number:
More informationCOS 140: Foundations of Computer Science
COS 140: Foundations of Computer Science CPU Organization and Assembly Language Fall 2018 CPU 3 Components of the CPU..................................................... 4 Registers................................................................
More informationDRAM uses a single capacitor to store and a transistor to select. SRAM typically uses 6 transistors.
Data Representation Data Representation Goal: Store numbers, characters, sets, database records in the computer. What we got: Circuit that stores 2 voltages, one for logic 0 (0 volts) and one for logic
More informationCPE300: Digital System Architecture and Design
CPE300: Digital System Architecture and Design Fall 2011 MW 17:30-18:45 CBC C316 Number Representation 09212011 http://www.egr.unlv.edu/~b1morris/cpe300/ 2 Outline Recap Logic Circuits for Register Transfer
More informationChapter 1. Microprocessor architecture ECE Dr. Mohamed Mahmoud.
Chapter 1 Microprocessor architecture ECE 3130 Dr. Mohamed Mahmoud The slides are copyright protected. It is not permissible to use them without a permission from Dr Mahmoud http://www.cae.tntech.edu/~mmahmoud/
More informationCS 33. Data Representation, Part 1. CS33 Intro to Computer Systems VII 1 Copyright 2017 Thomas W. Doeppner. All rights reserved.
CS 33 Data Representation, Part 1 CS33 Intro to Computer Systems VII 1 Copyright 2017 Thomas W. Doeppner. All rights reserved. Number Representation Hindu-Arabic numerals developed by Hindus starting in
More informationCOMP2121: 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 informationECED3204: 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 informationSISTEMI EMBEDDED. Basic Concepts about Computers. Federico Baronti Last version:
SISTEMI EMBEDDED Basic Concepts about Computers Federico Baronti Last version: 20170307 Embedded System Block Diagram Embedded Computer Embedded System Input Memory Output Sensor Sensor Sensor SENSOR CONDITIONING
More informationCSE 351 Midterm - Winter 2015
CSE 351 Midterm - Winter 2015 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 will prove
More informationCS/ECE 5780/6780: Embedded System Design
CS/ECE 5780/6780: Embedded System Design John Regehr Lecture 2: 68HC12 Architecture & Lab 1 Introduction Duff s Device void foo (int x, int *y, int *z) { switch (x % 8) { case 0: do { *y++ = *z++; case
More informationSlide Set 1. for ENEL 339 Fall 2014 Lecture Section 02. Steve Norman, PhD, PEng
Slide Set 1 for ENEL 339 Fall 2014 Lecture Section 02 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary Fall Term, 2014 ENEL 353 F14 Section
More informationCOMP2121: Microprocessors and Interfacing
nterfacing Overview Arithmetic and Logic nstructions in AR ample AR Assembly Programs Using AL instructions Lecture 8: Arithmetic and logic nstructions http://www.cse.unsw.edu.au/~cs2121 Lecturer: ui Wu
More informationCOMP3221: Microprocessors and Embedded Systems
Embedded ystems Overview Arithmetic and Logic nstructions in AR ample AR Assembly Programs Using AL instructions Lecture 7: Arithmetic and logic nstructions http://www.cse.unsw.edu.au/~cs3221 Lecturer:
More informationLAB A Translating Data to Binary
LAB A Translating Data to Binary Create a directory for this lab and perform in it the following groups of tasks: LabA1.java 1. Write the Java app LabA1 that takes an int via a command-line argument args[0]
More informationIntroduction 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 informationAVR 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 informationCOMP2121: 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 informationCOMP2121: Microprocessors and Interfacing. Number Systems
COMP2121: Microprocessors and Interfacing Number Systems http://www.cse.unsw.edu.au/~cs2121 Lecturer: Hui Wu Session 2, 2017 1 1 Overview Positional notation Decimal, hexadecimal, octal and binary Converting
More informationMicrocomputers. Outline. Number Systems and Digital Logic Review
Microcomputers Number Systems and Digital Logic Review Lecture 1-1 Outline Number systems and formats Common number systems Base Conversion Integer representation Signed integer representation Binary coded
More informationBinary Representations and Arithmetic
Binary Representations and Arithmetic 9--26 Common number systems. Base : decimal Base 2: binary Base 6: hexadecimal (memory addresses) Base 8: octal (obsolete computer systems) Base 64 (email attachments,
More informationET-BASE AVR ATmega64/128
ET-BASE AVR ATmega64/128 ET-BASE AVR ATmega64/128 which is a Board Microcontroller AVR family from ATMEL uses MCU No.ATmega64 and ATmega128 64PIN. Board ET-BASE AVR ATmega64/128 uses MCU s resources on
More informationMechatronics 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 informationCSE 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 informationGoals for this Week. CSC 2400: Computer Systems. Bits, Bytes and Data Types. Binary number system. Finite representations of binary integers
CSC 2400: Computer Systems Bits, Bytes and Data Types 1 Goals for this Week Binary number system Why binary? Converting between decimal and binary and octal and hexadecimal number systems Finite representations
More informationNumber Systems for Computers. Outline of Introduction. Binary, Octal and Hexadecimal numbers. Issues for Binary Representation of Numbers
Outline of Introduction Administrivia What is computer architecture? What do computers do? Representing high level things in binary Data objects: integers, decimals, characters, etc. Memory locations (We
More informationPractical Malware Analysis
Practical Malware Analysis Ch 4: A Crash Course in x86 Disassembly Revised 1-16-7 Basic Techniques Basic static analysis Looks at malware from the outside Basic dynamic analysis Only shows you how the
More informationCSE 351 Midterm - Winter 2017
CSE 351 Midterm - Winter 2017 February 08, 2017 Please read through the entire examination first, and make sure you write your name and NetID on all pages! We designed this exam so that it can be completed
More informationELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-278: Digital Logic Design Fall Notes - Unit 4. hundreds.
ECE-78: Digital Logic Design Fall 6 UNSIGNED INTEGER NUMBERS Notes - Unit 4 DECIMAL NUMBER SYSTEM A decimal digit can take values from to 9: Digit-by-digit representation of a positive integer number (powers
More informationSample Exam I PAC II ANSWERS
Sample Exam I PAC II ANSWERS Please answer questions 1 and 2 on this paper and put all other answers in the blue book. 1. True/False. Please circle the correct response. a. T In the C and assembly calling
More informationThe Design of C: A Rational Reconstruction"
The Design of C: A Rational Reconstruction 1 Goals of this Lecture Help you learn about: The decisions that were available to the designers of C The decisions that were made by the designers of C and thereby
More informationAPPENDIX 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