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

Similar documents
Module 2: Introduction to AVR ATmega 32 Architecture

AVR Microcontrollers Architecture

Department of Electronics and Instrumentation Engineering Question Bank

BASIC INTERFACING CONCEPTS

Microprocessors/Microcontrollers

ECED3204: Microprocessor Part I--Introduction

Lecture 14. Ali Karimpour Associate Professor Ferdowsi University of Mashhad

Ali Karimpour Associate Professor Ferdowsi University of Mashhad

Automation Engineers AB Pvt Ltd, NOIDA Job-Oriented Course on Embedded Microcontrollers & Related Software Stack

EE 308: Microcontrollers

2011 Pearson Higher Education, Mazidi, Naimi, and Naimi Pearson Higher Education, 2011 Pearson Higher Education,

Ali Karimpour Associate Professor Ferdowsi University of Mashhad

Microcontrollers. Microcontroller

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

Microprocessors And Microcontroller


Diploma in Embedded Systems

Question Bank Microprocessor and Microcontroller

MICROPROCESSOR BASED SYSTEM DESIGN


Chapter 1. Microprocessor architecture ECE Dr. Mohamed Mahmoud.

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

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

8051 Microcontrollers

Lecture Objectives. Introduction to Computing Chapter 0. Topics. Numbering Systems 04/09/2017

UNIT V MICRO CONTROLLER PROGRAMMING & APPLICATIONS TWO MARKS. 3.Give any two differences between microprocessor and micro controller.

Overview of Microcontroller and Embedded Systems

SYLLABUS UNIT - I 8086/8088 ARCHITECTURE AND INSTRUCTION SET

ATmega128. Introduction

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

AVR MICROCONTROLLER ARCHITECTURTE

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: 8051 Architecture Module No: CS/ES/5 Quadrant 1 e-text

Microcontroller basics

AVR ISA & AVR Programming (I)

Microcontroller systems Lec 2 PIC18LF8722 Microcontroller s s core

EE 308: Microcontrollers

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

PIC Microcontroller and

ELEG3924 Microprocessor

EC 6504 MICROPROCESSOR AND MICROCONTROLLER

1. INTRODUCTION TO MICROPROCESSOR AND MICROCOMPUTER ARCHITECTURE:

Understanding the basic building blocks of a microcontroller device in general. Knows the terminologies like embedded and external memory devices,

8051 microcontrollers

Microcontrollers. Principles and Applications. Ajit Pal +5 V 2K 8. 8 bit dip switch. P2 8 Reset switch Microcontroller AT89S52 100E +5 V. 2.

Computer Hardware Requirements for ERTSs: Microprocessors & Microcontrollers

Microprocessor and Microcontroller question bank. 1 Distinguish between microprocessor and microcontroller.

AVR XMEGA Product Line Introduction AVR XMEGA TM. Product Introduction.

Embedded Systems. Software Development & Education Center. (Design & Development with Various µc)

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

Microcontroller & Interfacing

Microcontroller and Embedded Systems:

8051 Overview and Instruction Set

Introduction to Microcontroller Apps for Amateur Radio Projects Using the HamStack Platform.

CN310 Microprocessor Systems Design

Introduction to 8051 microcontrollers

3. (a) Explain the steps involved in the Interfacing of an I/O device (b) Explain various methods of interfacing of I/O devices.

THE AVR MICROCONTROLLER AND EMBEDDED SYSTEMS. Using Assembly and С

CHAPTER ASSEMBLY LANGUAGE PROGRAMMING

Introduction to Computers - Chapter 4

Infineon C167CR microcontroller, 256 kb external. RAM and 256 kb external (Flash) EEPROM. - Small single-board computer (SBC) with an

Description of the Simulator

Embedded Systems Lab Lab 1 Introduction to Microcontrollers Eng. Dalia A. Awad

UNIVERSITY OF MORATUWA CS2052 COMPUTER ARCHITECTURE. Time allowed: 2 Hours 10 min December 2018

COMP2121: Microprocessors and Interfacing

MicroProcessor. MicroProcessor. MicroProcessor. MicroProcessor

Programming in the MAXQ environment

Control Unit: The control unit provides the necessary timing and control Microprocessor resembles a CPU exactly.

VALLIAMMAI ENGINEERING COLLEGE

EEE3410 Microcontroller Applications Department of Electrical Engineering Lecture 4 The 8051 Architecture

Microcomputer Architecture and Programming

ELEG3923 Microprocessor Ch.2 Assembly Language Programming

1 MALP ( ) Unit-1. (1) Draw and explain the internal architecture of 8085.

INDUSTRIAL TRAINING:6 MONTHS PROGRAM TEVATRON TECHNOLOGIES PVT LTD

Computer Organization and Microprocessors SYLLABUS CHAPTER - 1 : BASIC STRUCTURE OF COMPUTERS CHAPTER - 3 : THE MEMORY SYSTEM

Embedded World Television, Radio, CD player, Washing Machine Microwave Oven Card readers, Palm devices

538 Lecture Notes Week 5

Microprocessors and Interfacng. Question bank

EE 308: Microcontrollers

WIZTECH AUTOMATION SOLUTIONS (P) LTD., An ISO 9001:2000 and IAO certified company

8051 Microcontroller

SECURE DIGITAL ACCESS SYSTEM USING IBUTTON

ARM Cortex-M4 Architecture and Instruction Set 1: Architecture Overview

SANKALCHAND PATEL COLLEGE OF ENGINEERING, VISNAGAR. ELECTRONICS & COMMUNICATION DEPARTMENT Question Bank- 1

DERTS Design Requirements (1): Microcontroller Architecture & Programming

Module I. Microcontroller can be classified on the basis of their bits processed like 8bit MC, 16bit MC.

Chapter 1: Basics of Microprocessor [08 M]

538 Lecture Notes Week 5

Lab 1 Introduction to Microcontroller

ARDUINO MEGA INTRODUCTION

ME 515 Mechatronics. A microprocessor

Introduction to general architectures of 8 and 16 bit micro-processor and micro-controllers

Chapter 1 : Introduction

CPU ARCHITECTURE. QUESTION 1 Explain how the width of the data bus and system clock speed affect the performance of a computer system.

Microcontroller: CPU and Memory

Interrupt/Timer/DMA 1

The Microcontroller. Lecture Set 3. Major Microcontroller Families. Example Microcontroller Families Cont. Example Microcontroller Families

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


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

DHANALAKSHMI COLLEGE OF ENGINEERING DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING YEAR : III SEM : VI

Transcription:

(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 questions in one or two sentences. Each question carries two marks. 1. Give the size of on-chip program ROM and Data RAM in ATmega32. ATmega32 has Program ROM (Flash memory) of 32KB and Data RAM of 2KB. 2. The largest number that can be loaded into the GPR is...in hex. $FF, because each GPR in AVR is of 8bit size. 3. On power up, to which address SP points to? On power up, the SP register contains the value 0, which is the address of R0. 4. Write a program in C, to toggle all bits of PORTC. LDI R20, 0X55 OUT PORTC, R20 L1: COM R20 OUT PORTC, R20 JMP L1 5. How many single ended inputs are available on the ATmega32 ADC? 10 PART B II. Answer any five questions. Each question carries 6 marks. 1. Discuss the data RAM memory space allocation in AVR microcontroller. The data memory of AVR is composed of 3 parts: GPRs: General Purpose Registers I/O Memory Internal data SRAM Size of AVR Data Memory = Size of GPRs + Size of I/O Memory+ Size of Internal SRAM

The General Purpose Registers in the AVR AVR microcontrollers have many registers for arithmetic and logic operations. In the CPU, registers are used to store information temporarily. Information could be a byte of data to be processed, or an address pointing to the data to be fetched. The majority of AVR registers are 8-bit. In AVR, there are 32 GPRs (R0-R32)., and located in the lowest location of memory. Same as accumulators in microprocessor, and used for all arithmetic and logic operations. I/O Memory (SFRs) I/O memory is dedicated to specific functions such as status register, timers, serial communication, I/O ports, ADC, etc. The function of each I/O memory is fixed by the CPU designer at the time of design. Made of 8-bit registers. No. of locations in the data memory set aside for data memory depends on the pin numbers and peripheral functions of the chip. All of the AVR have at least 64 bytes of I/O memory locations. This section is called Standard I/O memory. In AVRs with more than 32 pins(eg: ATmega128, ATmega64,..), there is also an Extended memory, which contains the registers for controlling the extra ports and the extra peripherals.

In other microcontrollers, the I/O registers are called SFRs(Special Function Registers), since each one is dedicated to specific functions. In contrast to SFRs, GPRs do not have any specific function and used for general storing. Internal Data SRAM Used for storing data and parameters by AVR programmers and C compilers. Generally, this is called Scratch pad. Each location of the SRAM can be accessed directly by its address. Each location is 8-bit wide and can be used to store any data of 8-bit size. The size of SRAM can vary from chip to chip, even if its same family. 2. Compare and contrast microcontroller with general purpose microprocessor. Microprocessor Micro Controller Microprocessor is heart of Computer system. It is just a processor. Memory and I/O components have to be connected externally Since memory and I/O has to be connected externally, the circuit becomes large. Cannot be used in compact systems and hence inefficient Cost of the entire system is high. Due to external components, the entire power consumption is high. Hence it is not suitable to use with devices running on stored power like batteries. Micro Controller is heart of embedded system. Micro controller has processor along with internal memory and I/O components Since memory and I/O are present internally, the circuit is small. Can be used in compact systems and hence it is an efficient technique Cost of the entire system is low Since external components are low, total power consumption is less and can be used with devices running on stored power like batteries. Most of the microprocessors do not have power saving features. Most of the micro controllers have power saving modes like idle mode and power saving mode.

Since memory and I/O components are all external, each instruction will need external operation, hence it is relatively slower. Microprocessor have less number of registers, hence more operations are memory based. Microprocessors are based on von Neumann model/architecture where program and data are stored in same memory module Mainly used in personal computers Since components are internal, most of the operations are internal instruction, hence speed is fast. Micro controller have more number of registers, hence the programs are easier to write. Micro controllers are based on Harvard architecture where program memory and Data memory are separate Used mainly in embedded systems like washing machine, MP3 players, printer. 3. Explain three unconditional branch instructions. 3 unconditional branch instructions: 1. JMP (Jump) 2. RJMP (Relative Jump) 3. IJMP (Indirect Jump)

4. Discuss the methods used in AVR to increase the processing power. 3 Ways to increase processing power of CPU: 1. Increase the clock frequency of the chip. Drawback: Higher the frequency, more heat and power dissipation; problem for hand-held devices. 2. Use Harvard architecture by increasing the number of buses to bring more information (code and data) into the CPU to be processed. 3. Change the internal architecture of CPU and use RISC architecture. 5. With necessary diagram explain ATmega 32 connection to RS232. RS232 (DB-25 Connector) An interfacing std that provides compatibility among data communication equipment (DCE). Not compatible with TTL logic To connect any microcontroller system to a RS232, use Voltage convertors like MAX232. MAX232 is commonly referred to as Line drivers. ATmega32 Connection to RS232 RS232 is not TTL compatible, so a line driver MAX232 chip is required to convert RS232 voltage levels to TTL levels. RX and TX pins of ATmega32 Pins used specifically for transferring and receiving data serially. They are part of PORT D group (PD0 and PD1) of the pin package. Pin 15 of ATmega32 assigned to TX Pin 14 of ATmega32 assigned to RX

These are TTL compatible, so they require a line driver to make them compatible with RS232 such as MAX232 MAX232 From Maxim. Corp Converts from RS232 voltage level to TTL voltage level. One advantage of MAX232 chip is that it uses +5V power source, which is same as the source voltage for the AVR. So no need of dual voltage supply for AVR and MAX232. MAX232 has 2 sets of line drivers for transferring and receiving data. 6. List the features of built in ADC in ATmega 32. 7. Distinguish between fast PWM mode and phase correct PWM mode.

The ATmega32 has 3 timers, which can be used as wave generators. The advantage of using the built-in PWM feature of the AVR is that it gives us the option of programming the period and duty cycle, there for load of CPU is reduced. i. Fast PWM mode: In the Fast PWM mode, the counter counts like it does in the Normal mode. After the timer is started, it starts to count up until it reaches its limit of 0XFF. When it rolls over from 0XFF to 00, it sets the HIGH the TOV0 flag. ii. Phase correct PWM mode: In the Phase correct PWM, the TCNT0 goes up and down like a yo-yo. First it counts up until it reaches the top value, then it counts down until it reaches zero. III. PART-C (Maximum marks: 60) (Answer one full question from each unit. Each question carries 15 marks) UNIT--I a) Discuss various criteria for choosing a microcontroller for various applications. 8 Three criteria in choosing a microcontroller: i. Meeting the computing needs of the task at hand efficiently and cost effectively: considers speed, packaging, power consumption, amount of RAM and ROM on the chip, ease of upgrade to higher or lower versions, cost. ii. Availability of software and hardware development tools such as compilers, assemblers, and emulators: how easy to develop products around it. iii. Wide availability and reliable sources of microcontroller. b) Explain the bit format of status register in AVR. 7

Like all microprocessor, the AVR has a flag register to indicate arithmetic conditions such as the carry bit. The flag register in AVR is called as Status register (SReg). The status register is an 8-bit register., also referred to as the Flag register. The bits C,Z, N, V, S and H are called Conditional flags, thats they indicate some conditions that result after an instruction is executed., and each of them can be used to perform a conditional branch (jump). IV. Flag bits of the status register: C, the carry flag: This flag is set when there is a carry out from the D7 bit. Its affected after an 8-bit addition or subtraction. Z, the zero flag: Reflects the result of an arithmetic or logic operation. If the result is zero, then Z=1, else Z=0. N, the negative flag: Binary representation of signed numbers uses D7 as the sign bit. The negative flag reflects the results of signed number s arithmetic operation. If the D7 bit of the result is zero, then N=0 and the result is positive. If, D7=1, then N=1, and result is negative. V, the overflow flag: Set whenever the result of a signed no. operation is too large, causing the high-order bit to overflow into signed bit. Overflow flag is used to detect errors in signed arithmetic operations. S, the Sign bit: This flag is the result of the Exclusive-ORing of N and V flags. H, the Half carry bit: If there is a carry from D3 to D4 during an ADD and SUB operation, this bit is set, otherwise its cleared. Used by instructions using BCD (Binary Coded Decimal) operations. In some microprocessors, this is called AC flag(auxiliary Carry). (OR) a) Draw the simplified diagram of AVR. Explain each block. 7

AVR microcontroller program ROM: First microcontroller to use on-chip flash memory (can be erased in sec) for program storage. In microcontroller, the ROM is used to store program, so its called Program or Code ROM. AVR has 8MB of program ROM space., and can vary from 1K to 256K depending on the family member. AVR microcontroller data RAM and EEPROM: The RAM space is for data storage., max 64KB. The data RAM space has 3 components: 32 general purpose registers I/O memory Internal SRAM (size varies from chip to chip). A small amount of EEPROM stores critical data that does not need to be changed very often. AVR microcontroller I/O pins: Have 3 to 86 pins for I/O. No. of I/O pins depends on no. of pins in I/O package(from 8 to 100) In 8-pin AT90S2323, we have 3 I/O pins and in 100-pin ATmega1280, 86 I/O pins. AVR microcontroller peripherals: ADC (Analog-to-digital converter): The ADC is 10 bit and the number of ADC channels in AVR chips varies and can be up to 16. Timers: The AVR can have 6 timers besides the watchdog timer. USART (Universal Synchronous Asynchronous Receiver Transmitter ): The USART Peripheral allows us to connect the AVR based system to serial ports such as COM port of the x86 IBM PC. Most of the AVR family has SPI (Serial Peripheral Interface) and I²C (Inter- Integrated Circuit) buses, and some have USB or CAN bus. b) Explain the various families of AVR and its features 8

Various AVR families: 1. Classic AVR (AT90Sxxxx): Original AVR chip, replaced by newer AVR Not recommended for new designs Program Memory: 2K to 4K bytes. Package: 28 pins. Eg: AT90S2313, AT90s2323, etc. 2. Mega AVR (ATmegaxxxx): Powerful microcontroller with more than 120 instructions-extended instruction set. Extensive peripheral set, which can be used in different design. Program memory: 4K to 256K bytes. Package: 28 to 100 pins. Eg: ATmega8, ATmega16, etc 3. Tiny AVR (ATtinyxxxx): Have less instruction or limited instruction set. Eg: Some of them do not have the multiply instruction. Smaller package: 8 to 28 pins. Program memory: 1K to 8K bytes Limited peripheral set. Used to design low cost systems with low power consumption. Eg: ATtiny13, ATtiny25, etc. 4. Special purpose AVR: ICs of this group can be considered as a subset of other groups. Their special capabilities are made for designing specific applications. Special capabilities are: USB controller, CAN controller, LCD controller, Zigbee, Ethernet controller, FPGA and PWM. Eg: AT90CAN128, AT90USB1287, etc. V. UNIT II a) Explain the need for initializing the stack pointer. Give an example for initializing the stack pointer. 8

VI. b) Write a program in Assembly language to add 45A7H and 3C9AH and store the result in memory locations 0X60 and 0X61. 7 Here 45A7H and 3C9AH are 16bit Hexadecimal numbers, so we need two registers to load each number (Since GPRs of AVR are 8bit). LDI R16, 45H LDI R17, A7H LDI R18, 3CH LDI R19, 9AH ADD R17, R19 ; Add LSB of both numbers (A7+9A) ADC R16, R18 ; Add with carry (45+3C+Carry) STS 0x60, R16 STS 0x61, R17 (OR) a) Write a program to convert the packed BCD 35H into ASCII and store the result in R21 and R22. 7 LDI R20, 0X35 MOV R21, R20 ANDI R21, 0X0F ORI R21, 0X30 MOV R22, R20 SWAP R22 ANDI R22, 0X0F ORI R22, 0X30 HERE: JMP HERE

b) Show how AVR represent -38H. 4 Steps: 1. 0011 1000 38H in binary 2. 1100 0111 Invert each bit 3. 1100 1000 Add 1 (Which is C8 in hex) Therefore, -38 = C8H, the signed number representation in 2 s compliment for 38H. The D7=N=1, indicates the number is negative. c) What are the conditions to set OV flag in AVR? 4 V, the overflow flag: VII. UNIT III a) Draw the block diagram of timer 0 and show how it work on normal and CTC mode. 9 WGM01:00- Mode selection bits of timer Different modes of Timer0: 1. 00:Normal mode 2. 01:Phase correct PWM mode 3. 10:CTC mode 4. 11:Fast PWM mode

Normal Mode: In this mode, the content of the timer increments with each clock. It counts until it reaches a maximum value 0xFF. When it rolls over from 0xFF to 0x00, it sets high a flag bit called TOV0 (Timer Overflow) CTC Mode (Compare Match): The OCR0 register is used with the CTC mode. In the CTC mode, the timer is incremented with each clock pulse. But it counts up until the content of TCNT0 register becomes equal to the content of OCR0 register (compare match occurs). Then the timer will be cleared, and OCF0 flag will be set with next clock pulse. The OCF0 flag locates in TIFR (Timer Interrupt Flag Register).

b) Give the steps in programming the AVR to transfer data serially. 6 Data Serialization in C: VIII. OR a) Explain the following terms: i. Interrupt priority ii. Interrupt latency. 8 i. ii. Interrupt latency: The time from the moment an interrupt is activated to the moment the CPU starts executing the task. During this time, the PC register is pushed onto the stack and the I bit of the status register is cleared, causing all the register to be disabled. Interrupt latency duration can be affected by: Type of instruction that the cpu is executing when the interrupt comes in. b) A door sensor is connecter to the PORTB pin 1, and an LED is connected to PORTC 7. Write an AVR C program to monitor the door sensor and when it opens, turn on the LED. 7

UNIT IV IX. a) Explain the steps in sending data and command to LCD. 7

b) Explain the interfacing of DAC0808 with ATmega 32. 8

X. OR a) Explain the steps involved in scanning a matrix keyboard using AVR. 7

b) Draw the interfacing of temperature sensor with AVR and write a program in C to read the sensor and displays it on PORT D. 8 LM34 and LM35 are linear temperature sensor devices available in market.