Microcontroller Basics A microcontroller is a small, low-cost computer-on-a-chip which usually includes:

Size: px
Start display at page:

Download "Microcontroller Basics A microcontroller is a small, low-cost computer-on-a-chip which usually includes:"

Transcription

1 Microcontroller Basics A microcontroller is a small, low-cost computer-on-a-chip which usually includes: An 8 or 16 bit microprocessor (CPU). A small amount of RAM. Programmable ROM and/or flash memory. Parallel and/or serial I/O. Timers and signal generators. Analog to Digital (A/D) and/or Digital to Analog (D/A) conversion. Often used to run dedicated code that controls one or more tasks in the operation of a device or a system. Also called embedded controllers, because the microcontroller and support circuits are often built into, or embedded in, the devices they control. Devices that utilize microcontrollers include car engines, consumer electronics (VCRs, microwaves, cameras, pagers, cell phones.. ), computer peripherals (keyboards, printers, modems.. ), test/measurement equipment (signal generators, multimeters, oscilloscopes ). Microcontrollers usually must have low-power requirements (~ W as opposed to ~10-50 W for general purpose desktop CPUs) since many devices they control are battery-operated. #1 Lec # 20 Winter

2 Microcontroller Components From sensors To actuators Displays, keyboard etc. Single Chip RAM, EPROM, EEPROM, flash Examples: Motorola s 68HC11, 68HC12, AMD 29K, Zilog s Z8, Z80, Intel s 8052, Microchip s PIC Low-power, embedded versions of desktop CPUs: e.g Intel s #2 Lec # 20 Winter

3 A Typical Microcontroller Application: Speed Measurement Car Cruise Control #3 Lec # 20 Winter

4 The Motorola 68HC12 Microcontroller A Typical 68HC12 has the following components on the chip: A 16-bit central processing unit (CPU12): 20-Bit ALU. Instruction Queue. Enhanced Indexed Addressing. Fuzzy Logic Instructions. 32-Kbyte Flash EEPROM with 2-Kbyte Erase-Protected Boot Block. 768-Byte EEPROM. 1-Kbyte RAM with Single-Cycle Access for Aligned or Misaligned Read/Write. 8-Channel, 8-Bit Analog-to-Digital (A/D) Converter. 8-Channel Timer. 16-Bit Pulse Accumulator: External Event Counting, Gated Time Accumulation. Pulse-Width Modulator: 8-Bit, 4-Channel or 16-Bit, 2-Channel Separate Control for Each Pulse Width and Duty Cycle #4 Lec # 20 Winter

5 A Typical 68HC12 Chip Pin-Out MC68HC912B32 #5 Lec # 20 Winter

6 M68EVB912B32 Evaluation Board Layout #6 Lec # 20 Winter

7 Motorola 68HC12 16-bit Memory Address Space 0x0800 0x08FF 0x0900 0x09FF User Program Memory: 256 bytes User Data Memory: 256 bytes #7 Lec # 20 Winter

8 68HC12 Programming Model: Registers #8 Lec # 20 Winter

9 68HC12 Registers A 8-bit Accumulator A B 8-bit Accumulator B D 16-bit Double accumulator D (A : B) X 16-bit Index register X Y 16-bit Index register Y SP 16-bit Stack pointer PC 16-bit Program Counter CCR Condition code register: S STOP instruction control bit X Non-maskable interrupt control bit H Half-carry status bit I Maskable interrupt control bit N Negative status bit Z Zero status bit V Two s complement overflow status bit C Carry/Borrow status bit #9 Lec # 20 Winter

10 68HC12 Data Types The HC12 uses the following types of data: Bits. 5-bit signed integers. 8-bit signed and unsigned integers. 8-bit, 2-digit binary coded decimal (BCD) numbers. 9-bit signed integers. 16-bit signed and unsigned integers. 16-bit effective addresses. 32-bit signed and unsigned integers. 5-bit and 9-bit signed integers are used only as offsets for indexed addressing modes. 16-bit effective addresses are formed during addressing mode computations. 32-bit integer dividends are used by extended division instructions. Extended multiply and extended multiply-and-accumulate instructions produce 32-bit products. #10 Lec # 20 Winter

11 68HC12 Addressing Modes Inherent Addressing Mode (INH). Immediate Addressing Mode (IMM). Direct Addressing Mode (DIR). Extended Addressing Mode (EXT). Indexed Addressing Modes: 5-Bit Constant Offset Indexed Addressing (IDX). Auto Pre/Post Decrement/Increment Indexed Addressing (IDX) Accumulator Offset Indexed Addressing (IDX). 9-Bit Constant Offset Indexed Addressing (IDX1). 16-Bit Constant Offset Indexed Addressing (IDX2). Indirect Indexed Addressing: 16-Bit Constant Offset Indexed Addressing [IDX2]. Accumulator D Indirect Indexed Addressing [D, IDX]. #11 Lec # 20 Winter

12 68HC12 Addressing Modes Inherent Addressing Mode (INH): Instructions that use this addressing mode either have no operands or all operands are in internal CPU registers. Examples: NOP CLRA ABA ASRA ; this instruction has no operands ; clear A ; add A to B result in A ; arithmetic shift right A Immediate Addressing Mode (IMM): Examples: LDAA #$55 ; load A with the 8-bit value $55 LDX #$1234 ; load index register X with 16-bit address $1234 LDY #$67 ; load index register Y with 16-bit address $0067 ADDA #$17 ; add the value $17 to register A, result in A #12 Lec # 20 Winter

13 68HC12 Addressing Modes Direct Addressing Mode (DIR): Used to access operands in the memory address range $0000 through $00FF Examples: LDAA $55 ; load register A with 8-bit value in memory address $0055 LDX $20 ; load index register X with 16-bit value in $0020, $0021 STY $50 ; store value of Y to memory addresses $0050, $0051 Extended Addressing Mode (EXT): Used to access operands in the full 16-bit address of the memory. Examples: LDAA $F03B ; load register A with 8-bit value from address $F03B LDX $0900 ; load index register X with 16-bit value in $0900, $0901 #13 Lec # 20 Winter

14 68HC12 Indexed Addressing Modes 5-Bit Constant Offset Indexed Addressing (IDX): Uses an 5-bit signed offset (range -16 to 15) which is added to the base index register (X, Y, SP, or PC) to form the effective address: Examples: LDAA 12,X ; load A with the byte at memory address (X) + 12 STAB 8,Y ; store the byte in B at address (Y) - 8 ADDA 5,X ; add A to the byte at (X) + 5, result in A 9-Bit Constant Offset Indexed Addressing (IDX1): Uses an 9-bit signed offset (range -256 to 255) which is added to the base index register (X, Y, SP, or PC) to form the effective address: Examples: LDAA $FF,X ; load A with the byte at memory address (X) + $FF STAB 20,Y ; store the byte in B at address (Y) Bit Constant Offset Indexed Addressing (IDX2): Uses an 16-bit offset which is added to the base index register (X, Y, SP, or PC) to form the effective address. This allows access to any address in the 64-Kbyte address space. #14 Lec # 20 Winter

15 Auto Pre/Post Decrement/Increment Indexed Addressing (IDX) Predecrement and preincrement versions of the addressing mode adjust the value of the index register before accessing the memory location affected by the instruction: STAA 1, SP STX 2, SP ;equivalent to PSHA ;equivalent to PSHX Post-decrement and postincrement versions of the addressing mode use the initial value in the index register to access the memory location affected by the instruction, then change the value of the index register. LDX 2,SP+ LDAA 1,SP+ ;equivalent to PULX ;equivalent to PULA #15 Lec # 20 Winter

16 Indexed Addressing Modes Accumulator Offset Indexed Addressing (IDX): In this indexed addressing mode, the effective address is the sum of the values in the base index register (X, Y, SP, or PC) and an unsigned offset in one of the accumulators (8bit A, B or 16-bit D). Example: LDAA B,X This instruction internally adds B to X to form the address from which A will be loaded. #16 Lec # 20 Winter

17 Indirect Indexed Addressing 16-Bit Constant Offset Indexed Addressing [IDX] : Adds a 16-bit instruction-supplied offset to the base index register to form the address of a memory location that contains a pointer to the memory location affected by the instruction. Example: LDAA [10,X] In this example, X holds the base address of a table of pointers. Assume that X has an initial value of $1000, and that the value $2000 is stored at addresses $100A and $100B. The instruction first adds the value 10 to the value in X to form the address $100A. Next, an address pointer ($2000) is fetched from memory at $100A. Then, the byte value stored in location $2000 is read and loaded into the A accumulator. #17 Lec # 20 Winter

18 Indirect Indexed Addressing Accumulator D Indirect Indexed Addressing [D,IDX]: Adds the value in the D accumulator to the value in the base index register to form the address of a memory location that contains a pointer to the memory location affected by the instruction. The square brackets distinguish this addressing mode from D accumulator offset indexing. Example: JMP GO1 DC.W GO2 DC.W GO3 DC.W [D,PC] PLACE1 PLACE2 PLACE3 Assume that the value in D is $0002. The JMP instruction adds the values in D and PC to form the address of GO2. Next the CPU reads the address PLACE2 from memory at GO2 and jumps to PLACE2. #18 Lec # 20 Winter

19 68HC12 Load & Store Instructions #19 Lec # 20 Winter

20 68HC12 Transfer & Exchange Instructions #20 Lec # 20 Winter

21 68HC12 Move Instructions #21 Lec # 20 Winter

22 68HC12 Addition & Subtraction Instructions #22 Lec # 20 Winter

23 68HC12 BCD Instructions #23 Lec # 20 Winter

24 HC12 Increment & Decrement Instructions #24 Lec # 20 Winter

25 HC12 Compare & Test Instructions #25 Lec # 20 Winter

26 HC12 Logic Instructions #26 Lec # 20 Winter

27 HC12 Clear, Complement & Negate Instructions #27 Lec # 20 Winter

28 HC12 Multiplication & Division Instructions #28 Lec # 20 Winter

29 Multiply and Accumulate Instruction EMACS The EMACS instruction multiplies two 16-bit operands stored in memory and accumulates the 32-bit result in a third memory location. Often used to implement simple digital filters. #29 Lec # 20 Winter

30 HC12 Bit Test & Manipulation Instructions #30 Lec # 20 Winter

31 HC12 Logical Shifts Instructions #31 Lec # 20 Winter

32 HC12 Arithmetic Shifts Instructions #32 Lec # 20 Winter

33 HC12 Rotate Instructions #33 Lec # 20 Winter

34 HC12 Short Branch Instructions The numeric range of short branch offset values is $80 ( 128) to $7F (127) #34 Lec # 20 Winter

35 HC12 Short Branch Instructions The numeric range of short branch offset values is $80 ( 128) to $7F (127) #35 Lec # 20 Winter

36 HC12 Long Branch Instructions The numeric range of long branch offset values is $8000 ( 32,768) to $7FFF (32,767) #36 Lec # 20 Winter

37 HC12 Long Branch Instructions The numeric range of long branch offset values is $8000 ( 32,768) to $7FFF (32,767) #37 Lec # 20 Winter

38 HC12 Decrement/Branch Instructions #38 Lec # 20 Winter

39 HC12 Jump & Subroutine Instructions #39 Lec # 20 Winter

40 HC12 Interrupt Instructions #40 Lec # 20 Winter

41 HC12 Stack Related Instructions #41 Lec # 20 Winter

42 HC12 Stack Related Instructions #42 Lec # 20 Winter

43 HC12 Condition Codes Instructions #43 Lec # 20 Winter

44 HC12 Example: Addition of Two Values USER_STACKTOP equ $0a00 org $0800 Main lds #USER_STACKTOP ;load stacktop ldaa #FIRST ;load first byte in A adda #SECOND ;add second value to A result in A staa ANSWER ;store result in answer End bra End ;done with program org $0900 FIRST dc.b #$01 ;first value to add SECOND dc.b #$02 ;second value to add ANSWER dc.b #$00 ;addition result #44 Lec # 20 Winter

45 USER_STACKTOP equ $0a00 org $0800 HC12 Loop Example Main: lds #USER_STACKTOP ;load stacktop ldaa #ITER ;load number of iterations to perform ldab #COUNT ;load number of iterations performed already loop: deca ;decrement Acc A incb ;increment Acc B cmpa #$00 ;Is Acc A = 0? bne loop ;No, continue with loop stab COUNT ;Otherwise, save the count End: bra End ;done with program org $0900 ITER dc.b #$08 ;Number of loop iterations to perform COUNT dc.b #$00 ;Number of loop iterations performed #45 Lec # 20 Winter

46 HC12 Data Table Example ; This program takes a table of data, and creates a new table ; which is the original table divided by 2 prog: equ $0800 ;put program at address 0x0800 data: equ $0900 ;put data at address 0x0900 count: equ 10 ;number of entries in table org prog ;set program counter to 0x0800 ldx #table1 ;Reg X points to entry to process in table 1 ldy #table2 ;Reg Y points to entry to write to table 2 ldab #count ;ACC B holds number of entries left to process repeat: ldaa 1,x+ ;Get table1 entry into ACC A; inc X to next entry asra ;Divide by 2 staa 1,y+ ;Save in table2; inc Y to next entry in table2 dbne b,repeat ;Decrement number left to process; ;If not done, process next table1 entry swi ;Done -- Exit org data ;initialize table1 (COUNT bytes long) table1: dc.b $07,$ae,$4a,$f3,$6c,$30,$7f,$12,$67,$cf table2: ds.b count ;reserve count bytes for table2. #46 Lec # 20 Winter

Lecture 3 Addressing Modes, Instruction Samples, Machine Code, Instruction Execution Cycle

Lecture 3 Addressing Modes, Instruction Samples, Machine Code, Instruction Execution Cycle Lecture 3 Addressing Modes, Instruction Samples, Machine Code, Instruction Execution Cycle Contents 3.1. Register Transfer Notation... 2 3.2. HCS12 Addressing Modes... 2 1. Inherent Mode (INH)... 2 2.

More information

M6800. Assembly Language Programming

M6800. Assembly Language Programming M6800 Assembly Language Programming 1 3. MC6802 MICROPROCESSOR MC6802 microprocessor runs in 1MHz clock cycle. It has 64 Kbyte memory address capacity using 16-bit addressing path (A0-A15). The 8-bit data

More information

Introduction to Microcontrollers

Introduction to Microcontrollers Introduction to Microcontrollers Motorola M68HC11 Specs Assembly Programming Language BUFFALO Topics of Discussion Microcontrollers M68HC11 Package & Pinouts Accumulators Index Registers Special Registers

More information

HC12 Assembly Language Programming

HC12 Assembly Language Programming HC12 Assembly Language Programming Programming Model Addressing Modes Assembler Directives HC12 Instructions Flow Charts 1 Assembler Directives In order to write an assembly language program it is necessary

More information

The stack and the stack pointer

The stack and the stack pointer The stack and the stack pointer If you google the word stack, one of the definitions you will get is: A reserved area of memory used to keep track of a program's internal operations, including functions,

More information

Programmer s Model = model of µc useful to view hardware during execution of software instructions

Programmer s Model = model of µc useful to view hardware during execution of software instructions HC12/S12 Programmer s Model Programmer s Model = model of µc useful to view hardware during execution of software instructions Recall: General Microcontroller/Computer Architecture note: Control Unit &

More information

MICROPROCESSOR AND MICROCOMPUTER BASICS

MICROPROCESSOR AND MICROCOMPUTER BASICS Introduction MICROPROCESSOR AND MICROCOMPUTER BASICS At present there are many types and sizes of computers available. These computers are designed and constructed based on digital and Integrated Circuit

More information

Programming the Motorola MC68HC11 Microcontroller

Programming the Motorola MC68HC11 Microcontroller Programming the Motorola MC68HC11 Microcontroller CONTENTS: COMMON PROGRAM INSTRUCTIONS WITH EXAMPLES MEMORY LOCATIONS PORTS SUBROUTINE LIBRARIES PARALLEL I/O CONTROL REGISTER (PIOC) COMMON PROGRAM INSTRUCTIONS

More information

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC6504 - Microprocessor & Microcontroller Year/Sem : II/IV

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC6504 - Microprocessor & Microcontroller Year/Sem : II/IV DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC6504 - Microprocessor & Microcontroller Year/Sem : II/IV UNIT I THE 8086 MICROPROCESSOR 1. What is the purpose of segment registers

More information

MICROPROCESSOR. Exclusive for IACE Students www.iace.co.in iacehyd.blogspot.in Ph: 9700077455/422 Page 1

MICROPROCESSOR. Exclusive for IACE Students www.iace.co.in iacehyd.blogspot.in Ph: 9700077455/422 Page 1 MICROPROCESSOR A microprocessor incorporates the functions of a computer s central processing unit (CPU) on a single Integrated (IC), or at most a few integrated circuit. It is a multipurpose, programmable

More information

CHAPTER 7: The CPU and Memory

CHAPTER 7: The CPU and Memory CHAPTER 7: The CPU and Memory The Architecture of Computer Hardware, Systems Software & Networking: An Information Technology Approach 4th Edition, Irv Englander John Wiley and Sons 2010 PowerPoint slides

More information

How To Write A Microsoft Microsoft 8D (Droid) (Program) (Powerbook) (I386) (Microsoft) (Donga) (Opera) And (Dungeo) (Dugeo

How To Write A Microsoft Microsoft 8D (Droid) (Program) (Powerbook) (I386) (Microsoft) (Donga) (Opera) And (Dungeo) (Dugeo CPU08 Central Processor Unit Reference Manual M68HC08 Microcontrollers CPU08RM Rev. 02/2006 freescale.com CPU08 Central Processor Unit Reference Manual To provide the most up-to-date information, the

More information

150127-Microprocessor & Assembly Language

150127-Microprocessor & Assembly Language Chapter 3 Z80 Microprocessor Architecture The Z 80 is one of the most talented 8 bit microprocessors, and many microprocessor-based systems are designed around the Z80. The Z80 microprocessor needs an

More information

PART B QUESTIONS AND ANSWERS UNIT I

PART B QUESTIONS AND ANSWERS UNIT I PART B QUESTIONS AND ANSWERS UNIT I 1. Explain the architecture of 8085 microprocessor? Logic pin out of 8085 microprocessor Address bus: unidirectional bus, used as high order bus Data bus: bi-directional

More information

MACHINE ARCHITECTURE & LANGUAGE

MACHINE ARCHITECTURE & LANGUAGE in the name of God the compassionate, the merciful notes on MACHINE ARCHITECTURE & LANGUAGE compiled by Jumong Chap. 9 Microprocessor Fundamentals A system designer should consider a microprocessor-based

More information

Microprocessor/Microcontroller. Introduction

Microprocessor/Microcontroller. Introduction Microprocessor/Microcontroller Introduction Microprocessor/Microcontroller microprocessor - also known as a CU or central processing unit - is a complete computation engine that is fabricated on a single

More information

CHAPTER 6: Computer System Organisation 1. The Computer System's Primary Functions

CHAPTER 6: Computer System Organisation 1. The Computer System's Primary Functions CHAPTER 6: Computer System Organisation 1. The Computer System's Primary Functions All computers, from the first room-sized mainframes, to today's powerful desktop, laptop and even hand-held PCs, perform

More information

How It All Works. Other M68000 Updates. Basic Control Signals. Basic Control Signals

How It All Works. Other M68000 Updates. Basic Control Signals. Basic Control Signals CPU Architectures Motorola 68000 Several CPU architectures exist currently: Motorola Intel AMD (Advanced Micro Devices) PowerPC Pick one to study; others will be variations on this. Arbitrary pick: Motorola

More information

6800 Basics. By Ruben Gonzalez

6800 Basics. By Ruben Gonzalez 6800 Basics By Ruben Gonzalez 6800 Processor Uses 8 bit words Has addressable main memory of 64k Has Memory Mapped I/O and interrupts The 6800 has the following main registers: 8- bit Accumulator A (AccA)

More information

Microprocessor or Microcontroller?

Microprocessor or Microcontroller? Microprocessor or Microcontroller? A little History What is a computer? [Merriam-Webster Dictionary] one that computes; specifically : programmable electronic device that can store, retrieve, and process

More information

How To Understand All Instructions In The Power12 Program

How To Understand All Instructions In The Power12 Program Module Introduction PURPOSE: The intent of this module is to present all CPU12 instructions to better prepare you to write short routines in assembly language. OBJECTIVES: - Discuss all CPU12 instruction

More information

Microcontrollers A Brief History of Microprocessors

Microcontrollers A Brief History of Microprocessors Microcontrollers A Brief History of Microprocessors The first microprocessor was developed by what was then a small company called Intel (short for Integrated Electronics) in the early 1970s. The client,

More information

Z80 Instruction Set. Z80 Assembly Language

Z80 Instruction Set. Z80 Assembly Language 75 Z80 Assembly Language The assembly language allows the user to write a program without concern for memory addresses or machine instruction formats. It uses symbolic addresses to identify memory locations

More information

Chapter 13. PIC Family Microcontroller

Chapter 13. PIC Family Microcontroller Chapter 13 PIC Family Microcontroller Lesson 01 PIC Characteristics and Examples PIC microcontroller characteristics Power-on reset Brown out reset Simplified instruction set High speed execution Up to

More information

Lecture N -1- PHYS 3330. Microcontrollers

Lecture N -1- PHYS 3330. Microcontrollers Lecture N -1- PHYS 3330 Microcontrollers If you need more than a handful of logic gates to accomplish the task at hand, you likely should use a microcontroller instead of discrete logic gates 1. Microcontrollers

More information

1 Classical Universal Computer 3

1 Classical Universal Computer 3 Chapter 6: Machine Language and Assembler Christian Jacob 1 Classical Universal Computer 3 1.1 Von Neumann Architecture 3 1.2 CPU and RAM 5 1.3 Arithmetic Logical Unit (ALU) 6 1.4 Arithmetic Logical Unit

More information

Section 44. CPU with Extended Data Space (EDS)

Section 44. CPU with Extended Data Space (EDS) Section 44. CPU with Extended Data Space (EDS) HIGHLIGHTS This section of the manual contains the following topics: 44.1 Introduction... 44-2 44.2 Programmer s Model... 44-5 44.3 Software Stack Pointer...

More information

MICROPROCESSOR BCA IV Sem MULTIPLE CHOICE QUESTIONS

MICROPROCESSOR BCA IV Sem MULTIPLE CHOICE QUESTIONS MICROPROCESSOR BCA IV Sem MULTIPLE CHOICE QUESTIONS 1) Which is the microprocessor comprises: a. Register section b. One or more ALU c. Control unit 2) What is the store by register? a. data b. operands

More information

Interrupts and the Timer Overflow Interrupts Huang Sections 6.1-6.4. What Happens When You Reset the HCS12?

Interrupts and the Timer Overflow Interrupts Huang Sections 6.1-6.4. What Happens When You Reset the HCS12? Interrupts and the Timer Overflow Interrupts Huang Sections 6.1-6.4 o Using the Timer Overflow Flag to interrupt a delay o Introduction to Interrupts o How to generate an interrupt when the timer overflows

More information

Microprocessor and Microcontroller Architecture

Microprocessor and Microcontroller Architecture Microprocessor and Microcontroller Architecture 1 Von Neumann Architecture Stored-Program Digital Computer Digital computation in ALU Programmable via set of standard instructions input memory output Internal

More information

Microcontrollers and the Freescale/Motorola HC11

Microcontrollers and the Freescale/Motorola HC11 Microcontrollers and the Freescale/Motorola HC11 Summer 2008 What is a microcontroller? A computer on a chip used to control electronic devices A microprocessor Usually not cutting edge (4-bit to 32-bit)

More information

Management Challenge. Managing Hardware Assets. Central Processing Unit. What is a Computer System?

Management Challenge. Managing Hardware Assets. Central Processing Unit. What is a Computer System? Management Challenge Managing Hardware Assets What computer processing and storage capability does our organization need to handle its information and business transactions? What arrangement of computers

More information

Call Subroutine (PC<15:0>) TOS, (W15)+2 W15 (PC<23:16>) TOS, Process data. Write to PC NOP NOP NOP NOP

Call Subroutine (PC<15:0>) TOS, (W15)+2 W15 (PC<23:16>) TOS, Process data. Write to PC NOP NOP NOP NOP Section 3. Descriptions CALL Call Subroutine Syntax: {label:} CALL lit23 CALL.S Operands: lit23 [0... 8388606] (PC)+4 PC, (PC) TOS, (W15)+2 W15 (PC) TOS, (W15)+2 W15 lit23 PC, NOP Register.

More information

The AVR Microcontroller and C Compiler Co-Design Dr. Gaute Myklebust ATMEL Corporation ATMEL Development Center, Trondheim, Norway

The AVR Microcontroller and C Compiler Co-Design Dr. Gaute Myklebust ATMEL Corporation ATMEL Development Center, Trondheim, Norway The AVR Microcontroller and C Compiler Co-Design Dr. Gaute Myklebust ATMEL Corporation ATMEL Development Center, Trondheim, Norway Abstract High Level Languages (HLLs) are rapidly becoming the standard

More information

ASSEMBLY LANGUAGE PROGRAMMING (6800) (R. Horvath, Introduction to Microprocessors, Chapter 6)

ASSEMBLY LANGUAGE PROGRAMMING (6800) (R. Horvath, Introduction to Microprocessors, Chapter 6) ASSEMBLY LANGUAGE PROGRAMMING (6800) (R. Horvath, Introduction to Microprocessors, Chapter 6) 1 COMPUTER LANGUAGES In order for a computer to be able to execute a program, the program must first be present

More information

U:\montages\dominique\servo\moteur_AV_AR\program\moteur_AV_AR.asm jeudi 28 avril 2011 10:32

U:\montages\dominique\servo\moteur_AV_AR\program\moteur_AV_AR.asm jeudi 28 avril 2011 10:32 Norton Junior Moteur PWM AV - AR pour SLE BRESSUIRE PORTA ------------------------------------------------------- 0 = Entrée Servo 1 = PWM moteur 2 = Strap mode 3 = 4 = 5 = Relay AV - AR $Include 'C:\pemicro\ics08qtqyz\qtqy_registers.inc'

More information

Computer Organization and Architecture

Computer Organization and Architecture Computer Organization and Architecture Chapter 11 Instruction Sets: Addressing Modes and Formats Instruction Set Design One goal of instruction set design is to minimize instruction length Another goal

More information

8-Bit Flash Microcontroller for Smart Cards. AT89SCXXXXA Summary. Features. Description. Complete datasheet available under NDA

8-Bit Flash Microcontroller for Smart Cards. AT89SCXXXXA Summary. Features. Description. Complete datasheet available under NDA Features Compatible with MCS-51 products On-chip Flash Program Memory Endurance: 1,000 Write/Erase Cycles On-chip EEPROM Data Memory Endurance: 100,000 Write/Erase Cycles 512 x 8-bit RAM ISO 7816 I/O Port

More information

8085 INSTRUCTION SET

8085 INSTRUCTION SET DATA TRANSFER INSTRUCTIONS Opcode Operand Description 8085 INSTRUCTION SET INSTRUCTION DETAILS Copy from source to destination OV Rd, Rs This instruction copies the contents of the source, Rs register

More information

8051 hardware summary

8051 hardware summary 8051 hardware summary 8051 block diagram 8051 pinouts + 5V ports port 0 port 1 port 2 port 3 : dual-purpose (general-purpose, external memory address and data) : dedicated (interfacing to external devices)

More information

UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering. EEC180B Lab 7: MISP Processor Design Spring 1995

UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering. EEC180B Lab 7: MISP Processor Design Spring 1995 UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering EEC180B Lab 7: MISP Processor Design Spring 1995 Objective: In this lab, you will complete the design of the MISP processor,

More information

An Overview of Stack Architecture and the PSC 1000 Microprocessor

An Overview of Stack Architecture and the PSC 1000 Microprocessor An Overview of Stack Architecture and the PSC 1000 Microprocessor Introduction A stack is an important data handling structure used in computing. Specifically, a stack is a dynamic set of elements in which

More information

EMBEDDED SYSTEM BASICS AND APPLICATION

EMBEDDED SYSTEM BASICS AND APPLICATION EMBEDDED SYSTEM BASICS AND APPLICATION TOPICS TO BE DISCUSSED System Embedded System Components Classifications Processors Other Hardware Software Applications 2 INTRODUCTION What is a system? A system

More information

Z80 Microprocessors Z80 CPU. User Manual UM008006-0714. Copyright 2014 Zilog, Inc. All rights reserved. www.zilog.com

Z80 Microprocessors Z80 CPU. User Manual UM008006-0714. Copyright 2014 Zilog, Inc. All rights reserved. www.zilog.com Z80 Microprocessors Z80 CPU UM008006-0714 Copyright 2014 Zilog, Inc. All rights reserved. www.zilog.com ii Warning: DO NOT USE THIS PRODUCT IN LIFE SUPPORT SYSTEMS. LIFE SUPPORT POLICY ZILOG S PRODUCTS

More information

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2 Lecture Handout Computer Architecture Lecture No. 2 Reading Material Vincent P. Heuring&Harry F. Jordan Chapter 2,Chapter3 Computer Systems Design and Architecture 2.1, 2.2, 3.2 Summary 1) A taxonomy of

More information

The string of digits 101101 in the binary number system represents the quantity

The string of digits 101101 in the binary number system represents the quantity Data Representation Section 3.1 Data Types Registers contain either data or control information Control information is a bit or group of bits used to specify the sequence of command signals needed for

More information

Chapter 2 Logic Gates and Introduction to Computer Architecture

Chapter 2 Logic Gates and Introduction to Computer Architecture Chapter 2 Logic Gates and Introduction to Computer Architecture 2.1 Introduction The basic components of an Integrated Circuit (IC) is logic gates which made of transistors, in digital system there are

More information

Instruction Set Design

Instruction Set Design Instruction Set Design Instruction Set Architecture: to what purpose? ISA provides the level of abstraction between the software and the hardware One of the most important abstraction in CS It s narrow,

More information

Chapter 5, The Instruction Set Architecture Level

Chapter 5, The Instruction Set Architecture Level Chapter 5, The Instruction Set Architecture Level 5.1 Overview Of The ISA Level 5.2 Data Types 5.3 Instruction Formats 5.4 Addressing 5.5 Instruction Types 5.6 Flow Of Control 5.7 A Detailed Example: The

More information

Central Processing Unit (CPU)

Central Processing Unit (CPU) Central Processing Unit (CPU) CPU is the heart and brain It interprets and executes machine level instructions Controls data transfer from/to Main Memory (MM) and CPU Detects any errors In the following

More information

LABORATORY MANUAL EE0310 MICROPROCESSOR & MICROCONTROLLER LAB

LABORATORY MANUAL EE0310 MICROPROCESSOR & MICROCONTROLLER LAB LABORATORY MANUAL EE0310 MICROPROCESSOR & MICROCONTROLLER LAB DEPARTMENT OF ELECTRICAL & ELECTRONICS ENGINEERING FACULTY OF ENGINEERING & TECHNOLOGY SRM UNIVERSITY, Kattankulathur 603 203 1 LIST OF EXEPRIMENTS

More information

PROBLEMS (Cap. 4 - Istruzioni macchina)

PROBLEMS (Cap. 4 - Istruzioni macchina) 98 CHAPTER 2 MACHINE INSTRUCTIONS AND PROGRAMS PROBLEMS (Cap. 4 - Istruzioni macchina) 2.1 Represent the decimal values 5, 2, 14, 10, 26, 19, 51, and 43, as signed, 7-bit numbers in the following binary

More information

CHAPTER 4 MARIE: An Introduction to a Simple Computer

CHAPTER 4 MARIE: An Introduction to a Simple Computer CHAPTER 4 MARIE: An Introduction to a Simple Computer 4.1 Introduction 195 4.2 CPU Basics and Organization 195 4.2.1 The Registers 196 4.2.2 The ALU 197 4.2.3 The Control Unit 197 4.3 The Bus 197 4.4 Clocks

More information

CPU Organization and Assembly Language

CPU Organization and Assembly Language COS 140 Foundations of Computer Science School of Computing and Information Science University of Maine October 2, 2015 Outline 1 2 3 4 5 6 7 8 Homework and announcements Reading: Chapter 12 Homework:

More information

================================================================

================================================================ ==== ==== ================================================================ DR 6502 AER 201S Engineering Design 6502 Execution Simulator ================================================================

More information

(Refer Slide Time: 00:01:16 min)

(Refer Slide Time: 00:01:16 min) Digital Computer Organization Prof. P. K. Biswas Department of Electronic & Electrical Communication Engineering Indian Institute of Technology, Kharagpur Lecture No. # 04 CPU Design: Tirning & Control

More information

Digital Systems Based on Principles and Applications of Electrical Engineering/Rizzoni (McGraw Hill

Digital Systems Based on Principles and Applications of Electrical Engineering/Rizzoni (McGraw Hill Digital Systems Based on Principles and Applications of Electrical Engineering/Rizzoni (McGraw Hill Objectives: Analyze the operation of sequential logic circuits. Understand the operation of digital counters.

More information

A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc

A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc Other architectures Example. Accumulator-based machines A single register, called the accumulator, stores the operand before the operation, and stores the result after the operation. Load x # into acc

More information

Today. Binary addition Representing negative numbers. Andrew H. Fagg: Embedded Real- Time Systems: Binary Arithmetic

Today. Binary addition Representing negative numbers. Andrew H. Fagg: Embedded Real- Time Systems: Binary Arithmetic Today Binary addition Representing negative numbers 2 Binary Addition Consider the following binary numbers: 0 0 1 0 0 1 1 0 0 0 1 0 1 0 1 1 How do we add these numbers? 3 Binary Addition 0 0 1 0 0 1 1

More information

ADVANCED PROCESSOR ARCHITECTURES AND MEMORY ORGANISATION Lesson-17: Memory organisation, and types of memory

ADVANCED PROCESSOR ARCHITECTURES AND MEMORY ORGANISATION Lesson-17: Memory organisation, and types of memory ADVANCED PROCESSOR ARCHITECTURES AND MEMORY ORGANISATION Lesson-17: Memory organisation, and types of memory 1 1. Memory Organisation 2 Random access model A memory-, a data byte, or a word, or a double

More information

An Introduction to the ARM 7 Architecture

An Introduction to the ARM 7 Architecture An Introduction to the ARM 7 Architecture Trevor Martin CEng, MIEE Technical Director This article gives an overview of the ARM 7 architecture and a description of its major features for a developer new

More information

MACHINE INSTRUCTIONS AND PROGRAMS

MACHINE INSTRUCTIONS AND PROGRAMS CHAPTER 2 MACHINE INSTRUCTIONS AND PROGRAMS CHAPTER OBJECTIVES In this chapter you will learn about: Machine instructions and program execution, including branching and subroutine call and return operations

More information

Chapter 4 Register Transfer and Microoperations. Section 4.1 Register Transfer Language

Chapter 4 Register Transfer and Microoperations. Section 4.1 Register Transfer Language Chapter 4 Register Transfer and Microoperations Section 4.1 Register Transfer Language Digital systems are composed of modules that are constructed from digital components, such as registers, decoders,

More information

A+ Guide to Managing and Maintaining Your PC, 7e. Chapter 1 Introducing Hardware

A+ Guide to Managing and Maintaining Your PC, 7e. Chapter 1 Introducing Hardware A+ Guide to Managing and Maintaining Your PC, 7e Chapter 1 Introducing Hardware Objectives Learn that a computer requires both hardware and software to work Learn about the many different hardware components

More information

2011, The McGraw-Hill Companies, Inc. Chapter 3

2011, The McGraw-Hill Companies, Inc. Chapter 3 Chapter 3 3.1 Decimal System The radix or base of a number system determines the total number of different symbols or digits used by that system. The decimal system has a base of 10 with the digits 0 through

More information

Instruction Set Architecture

Instruction Set Architecture Instruction Set Architecture Consider x := y+z. (x, y, z are memory variables) 1-address instructions 2-address instructions LOAD y (r :=y) ADD y,z (y := y+z) ADD z (r:=r+z) MOVE x,y (x := y) STORE x (x:=r)

More information

M68HC05 Family. Understanding Small Microcontrollers. Freescale Semiconductor, I. For More Information On This Product, Go to: www.freescale.

M68HC05 Family. Understanding Small Microcontrollers. Freescale Semiconductor, I. For More Information On This Product, Go to: www.freescale. nc. M68HC05TB/D Rev. 2.0 HC 5 M68HC05 Family Understanding Small Microcontrollers nc. nc. Acknowledgment JamesM.Sibigtroth,aprincipalmemberofthetechnicalstaff at Motorola, is author of this text book.

More information

Microcontrollers in Practice

Microcontrollers in Practice M. Mitescu I. Susnea Microcontrollers in Practice With 117 Figures, 34 Tables and CD-Rom 4y Springer Contents Resources of Microcontrollers, 1 1.1 In this Chapter 1 1.2 Microcontroller Architectures 1

More information

Introduction to Microcontrollers

Introduction to Microcontrollers Introduction to Microcontrollers Courses 182.064 & 182.074 Vienna University of Technology Institute of Computer Engineering Embedded Computing Systems Group February 26, 2007 Version 1.4 Günther Gridling,

More information

1 Computer hardware. Peripheral Bus device "B" Peripheral device. controller. Memory. Central Processing Unit (CPU)

1 Computer hardware. Peripheral Bus device B Peripheral device. controller. Memory. Central Processing Unit (CPU) 1 1 Computer hardware Most computers are organized as shown in Figure 1.1. A computer contains several major subsystems --- such as the Central Processing Unit (CPU), memory, and peripheral device controllers.

More information

Logical Operations. Control Unit. Contents. Arithmetic Operations. Objectives. The Central Processing Unit: Arithmetic / Logic Unit.

Logical Operations. Control Unit. Contents. Arithmetic Operations. Objectives. The Central Processing Unit: Arithmetic / Logic Unit. Objectives The Central Processing Unit: What Goes on Inside the Computer Chapter 4 Identify the components of the central processing unit and how they work together and interact with memory Describe how

More information

Keil Debugger Tutorial

Keil Debugger Tutorial Keil Debugger Tutorial Yifeng Zhu December 17, 2014 Software vs Hardware Debug There are two methods to debug your program: software debug and hardware debug. By using the software debug, you do not have

More information

Computer organization

Computer organization Computer organization Computer design an application of digital logic design procedures Computer = processing unit + memory system Processing unit = control + datapath Control = finite state machine inputs

More information

what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored?

what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored? Inside the CPU how does the CPU work? what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored? some short, boring programs to illustrate the

More information

CSE2102 Digital Design II - Topics CSE2102 - Digital Design II

CSE2102 Digital Design II - Topics CSE2102 - Digital Design II CSE2102 Digital Design II - Topics CSE2102 - Digital Design II 6 - Microprocessor Interfacing - Memory and Peripheral Dr. Tim Ferguson, Monash University. AUSTRALIA. Tel: +61-3-99053227 FAX: +61-3-99053574

More information

The Central Processing Unit:

The Central Processing Unit: The Central Processing Unit: What Goes on Inside the Computer Chapter 4 Objectives Identify the components of the central processing unit and how they work together and interact with memory Describe how

More information

Timer A (0 and 1) and PWM EE3376

Timer A (0 and 1) and PWM EE3376 Timer A (0 and 1) and PWM EE3376 General Peripheral Programming Model Each peripheral has a range of addresses in the memory map peripheral has base address (i.e. 0x00A0) each register used in the peripheral

More information

AUTOMATIC NIGHT LAMP WITH MORNING ALARM USING MICROPROCESSOR

AUTOMATIC NIGHT LAMP WITH MORNING ALARM USING MICROPROCESSOR AUTOMATIC NIGHT LAMP WITH MORNING ALARM USING MICROPROCESSOR INTRODUCTION This Project "Automatic Night Lamp with Morning Alarm" was developed using Microprocessor. It is the Heart of the system. The sensors

More information

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan Chapter 2 Basic Structure of Computers Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan Outline Functional Units Basic Operational Concepts Bus Structures Software

More information

Chapter 6. Inside the System Unit. What You Will Learn... Computers Are Your Future. What You Will Learn... Describing Hardware Performance

Chapter 6. Inside the System Unit. What You Will Learn... Computers Are Your Future. What You Will Learn... Describing Hardware Performance What You Will Learn... Computers Are Your Future Chapter 6 Understand how computers represent data Understand the measurements used to describe data transfer rates and data storage capacity List the components

More information

Computer Performance. Topic 3. Contents. Prerequisite knowledge Before studying this topic you should be able to:

Computer Performance. Topic 3. Contents. Prerequisite knowledge Before studying this topic you should be able to: 55 Topic 3 Computer Performance Contents 3.1 Introduction...................................... 56 3.2 Measuring performance............................... 56 3.2.1 Clock Speed.................................

More information

İSTANBUL AYDIN UNIVERSITY

İSTANBUL AYDIN UNIVERSITY İSTANBUL AYDIN UNIVERSITY FACULTY OF ENGİNEERİNG SOFTWARE ENGINEERING THE PROJECT OF THE INSTRUCTION SET COMPUTER ORGANIZATION GÖZDE ARAS B1205.090015 Instructor: Prof. Dr. HASAN HÜSEYİN BALIK DECEMBER

More information

Embedded Software Development: Spottbillige Hardware + OSS = Zum Spielen zu Schade!

Embedded Software Development: Spottbillige Hardware + OSS = Zum Spielen zu Schade! Embedded Software Development: Spottbillige Hardware + OSS = Zum Spielen zu Schade! Gregor Hohpe www.eaipatterns.com OOP 2012 1 Microcontrollers CPU core, memory, and I/O (analog, digital) on one chip

More information

Instruction Set Architecture. or How to talk to computers if you aren t in Star Trek

Instruction Set Architecture. or How to talk to computers if you aren t in Star Trek Instruction Set Architecture or How to talk to computers if you aren t in Star Trek The Instruction Set Architecture Application Compiler Instr. Set Proc. Operating System I/O system Instruction Set Architecture

More information

Keil C51 Cross Compiler

Keil C51 Cross Compiler Keil C51 Cross Compiler ANSI C Compiler Generates fast compact code for the 8051 and it s derivatives Advantages of C over Assembler Do not need to know the microcontroller instruction set Register allocation

More information

SECTION C [short essay] [Not to exceed 120 words, Answer any SIX questions. Each question carries FOUR marks] 6 x 4=24 marks

SECTION C [short essay] [Not to exceed 120 words, Answer any SIX questions. Each question carries FOUR marks] 6 x 4=24 marks UNIVERSITY OF KERALA First Degree Programme in Computer Applications Model Question Paper Semester I Course Code- CP 1121 Introduction to Computer Science TIME : 3 hrs Maximum Mark: 80 SECTION A [Very

More information

Open Architecture Design for GPS Applications Yves Théroux, BAE Systems Canada

Open Architecture Design for GPS Applications Yves Théroux, BAE Systems Canada Open Architecture Design for GPS Applications Yves Théroux, BAE Systems Canada BIOGRAPHY Yves Théroux, a Project Engineer with BAE Systems Canada (BSC) has eight years of experience in the design, qualification,

More information

Chapter 02: Computer Organization. Lesson 04: Functional units and components in a computer organization Part 3 Bus Structures

Chapter 02: Computer Organization. Lesson 04: Functional units and components in a computer organization Part 3 Bus Structures Chapter 02: Computer Organization Lesson 04: Functional units and components in a computer organization Part 3 Bus Structures Objective: Understand the IO Subsystem and Understand Bus Structures Understand

More information

CS101 Lecture 26: Low Level Programming. John Magee 30 July 2013 Some material copyright Jones and Bartlett. Overview/Questions

CS101 Lecture 26: Low Level Programming. John Magee 30 July 2013 Some material copyright Jones and Bartlett. Overview/Questions CS101 Lecture 26: Low Level Programming John Magee 30 July 2013 Some material copyright Jones and Bartlett 1 Overview/Questions What did we do last time? How can we control the computer s circuits? How

More information

C Programming. for Embedded Microcontrollers. Warwick A. Smith. Postbus 11. Elektor International Media BV. 6114ZG Susteren The Netherlands

C Programming. for Embedded Microcontrollers. Warwick A. Smith. Postbus 11. Elektor International Media BV. 6114ZG Susteren The Netherlands C Programming for Embedded Microcontrollers Warwick A. Smith Elektor International Media BV Postbus 11 6114ZG Susteren The Netherlands 3 the Table of Contents Introduction 11 Target Audience 11 What is

More information

AN2183. Using FLASH as EEPROM on the MC68HC908GP32. Introduction. Semiconductor Products Sector Application Note

AN2183. Using FLASH as EEPROM on the MC68HC908GP32. Introduction. Semiconductor Products Sector Application Note Order this document by /D Semiconductor Products Sector Application Note Using FLASH as EEPROM on the MC68HC908GP32 By Derrick H.J. Klotz Field Applications Engineer Toronto, Canada Introduction This application

More information

CPU Organisation and Operation

CPU Organisation and Operation CPU Organisation and Operation The Fetch-Execute Cycle The operation of the CPU 1 is usually described in terms of the Fetch-Execute cycle. 2 Fetch-Execute Cycle Fetch the Instruction Increment the Program

More information

a storage location directly on the CPU, used for temporary storage of small amounts of data during processing.

a storage location directly on the CPU, used for temporary storage of small amounts of data during processing. CS143 Handout 18 Summer 2008 30 July, 2008 Processor Architectures Handout written by Maggie Johnson and revised by Julie Zelenski. Architecture Vocabulary Let s review a few relevant hardware definitions:

More information

OVERVIEW OF MICROPROCESSORS

OVERVIEW OF MICROPROCESSORS C HAPTER 1 OVERVIEW OF MICROPROCESSORS 1.1 GENERAL A microprocessor is one of the most exciting technological innovations in electronics since the appearance of the transistor in 1948. This wonder device

More information

Faculty of Engineering Student Number:

Faculty of Engineering Student Number: Philadelphia University Student Name: Faculty of Engineering Student Number: Dept. of Computer Engineering Final Exam, First Semester: 2012/2013 Course Title: Microprocessors Date: 17/01//2013 Course No:

More information

Chapter 2: Elements of Java

Chapter 2: Elements of Java Chapter 2: Elements of Java Basic components of a Java program Primitive data types Arithmetic expressions Type casting. The String type (introduction) Basic I/O statements Importing packages. 1 Introduction

More information

ELEG3924 Microprocessor Ch.7 Programming In C

ELEG3924 Microprocessor Ch.7 Programming In C Department of Electrical Engineering University of Arkansas ELEG3924 Microprocessor Ch.7 Programming In C Dr. Jingxian Wu wuj@uark.edu OUTLINE 2 Data types and time delay I/O programming and Logic operations

More information

1 The Java Virtual Machine

1 The Java Virtual Machine 1 The Java Virtual Machine About the Spec Format This document describes the Java virtual machine and the instruction set. In this introduction, each component of the machine is briefly described. This

More information

2.0 Command and Data Handling Subsystem

2.0 Command and Data Handling Subsystem 2.0 Command and Data Handling Subsystem The Command and Data Handling Subsystem is the brain of the whole autonomous CubeSat. The C&DH system consists of an Onboard Computer, OBC, which controls the operation

More information

M68HC05. Microcontrollers MC68HC705J1A MC68HRC705J1A MC68HSC705J1A MC68HSR705J1A. Technical Data WWW.MOTOROLA.COM/SEMICONDUCTORS

M68HC05. Microcontrollers MC68HC705J1A MC68HRC705J1A MC68HSC705J1A MC68HSR705J1A. Technical Data WWW.MOTOROLA.COM/SEMICONDUCTORS MC68HC705J1A MC68HRC705J1A MC68HSC705J1A MC68HSR705J1A Technical Data M68HC05 Microcontrollers MC68HC705J1A/D Rev. 4, 5/2002 WWW.MOTOROLA.COM/SEMICONDUCTORS MC68HC705J1A MC68HRC705J1A MC68HSC705J1A MC68HSR705J1A

More information