Model Answer Microcontrollers. MCQ Problems Total Q1 Q2

Similar documents
Q1 Q2 Q3 Q4 Q5 Q6 Total /7.5 /5 /10 /5 /7.5 /5 /40

PIC 16F84A programming (II)

Lecture (03) PIC16F84 (2)

Lecture (04) PIC 16F84A programming I

NH-67, TRICHY MAIN ROAD, PULIYUR, C.F , KARUR DT. DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING COURSE MATERIAL

Lesson 14. Title of the Experiment: Introduction to Microcontroller (Activity number of the GCE Advanced Level practical Guide 27)

CHAPTER 6 CONCLUSION AND SCOPE FOR FUTURE WORK

Lecture (04) PIC16F84A (3)

Embedded System Design

which means that writing to a port implies that the port pins are first read, then this value is modified and then written to the port data latch.

DERTS Design Requirements (1): Microcontroller Architecture & Programming

EEE111A/B Microprocessors

Chapter 5 Sections 1 6 Dr. Iyad Jafar

LAB WORK 2. 1) Debugger-Select Tool-MPLAB SIM View-Program Memory Trace the program by F7 button. Lab Work

Chapter 2 Sections 1 8 Dr. Iyad Jafar

UNIVERSITY OF ULSTER UNIVERSITY EXAMINATIONS : 2001/2002. Semester 2. Year 2 MICROCONTROLLER SYSTEMS. Module Code: EEE305J2. Time allowed: 3 Hours

Dept. of Computer Engineering Final Exam, First Semester: 2016/2017

ME 515 Mechatronics. A microprocessor

Assembly Language Instructions

ME 6405 Introduction to Mechatronics

SOLAR TRACKING SYSTEM USING PIC16F84A STEPPER MOTOR AND 555TIMER

Lecture (09) PIC16F84A LCD interface LCD. Dr. Ahmed M. ElShafee

Embedded Systems. PIC16F84A Sample Programs. Eng. Anis Nazer First Semester

PIC Discussion. By Eng. Tamar Jomaa

Lecture (02) PIC16F84 (I)

Week1. EEE305 Microcontroller Key Points

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

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING. EE6008 Microcontroller based system design

University of Jordan Faculty of Engineering and Technology Department of Computer Engineering Embedded Systems Laboratory

Midrange 8b PIC Microcontrollers. ECE Senior Design 14 February 2017

UNIVERSITY OF ULSTER UNIVERSITY EXAMINATIONS : 2001/2002 RESIT. Year 2 MICROCONTROLLER SYSTEMS. Module Code: EEE305J1. Time allowed: 3 Hours

1 Introduction to Computers and Computer Terminology Programs Memory Processor Data Sheet Example Application...

1 Introduction to Computers and Computer Terminology Programs Memory Processor Data Sheet... 4

Chapter 4 Sections 1 4, 10 Dr. Iyad Jafar

Computer Hardware Requirements for ERTSs: Microprocessors & Microcontrollers

Micro II and Embedded Systems

Mechatronics and Measurement. Lecturer:Dung-An Wang Lecture 6

AVR Microcontrollers Architecture

PIC16F87X. 28/40-pin 8-Bit CMOS FLASH Microcontrollers. Devices Included in this Data Sheet: Pin Diagram PDIP. Microcontroller Core Features:

APPLICATION NOTE Wire Communication with a Microchip PICmicro Microcontroller

EE 361L Digital Systems and Computer Design Laboratory

Outline. Micriprocessor vs Microcontroller Introduction to PIC MCU PIC16F877 Hardware:

Microcontrollers. Introduction to the PIC 8-bit Midrange Family. ECE Senior Design 15 February 2017

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING. EE Microcontroller Based System Design

EE6008-Microcontroller Based System Design Department Of EEE/ DCE

Explanation of PIC 16F84A processor data sheet Part 1: overview of the basics

ME 475 Lab2 Introduction of PIC and Programming. Instructor: Zhen Wang

Chapter 3 BRANCH, CALL, AND TIME DELAY LOOP

PIC Microcontroller Introduction

Flow Charts and Assembler Programs

CONNECT TO THE PIC. A Simple Development Board

DESIGN AND FABRICATION OF FARE METER OF TAXICAB USING MICROCONTROLLER

Hardware Interfacing. EE25M Introduction to microprocessors. Part V. 15 Interfacing methods. original author: Feisal Mohammed

SOLUTIONS!! DO NOT DISTRIBUTE!!

Timer2 Interrupts. NDSU Timer2 Interrupts September 20, Background:

M PIC16F84A. 18-pinEnhanced FLASH/EEPROM 8-Bit Microcontroller. High Performance RISC CPU Features: Pin Diagrams. Peripheral Features:

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

PIC16C84. 8-bit CMOS EEPROM Microcontroller PIC16C84. Pin Diagram. High Performance RISC CPU Features: CMOS Technology: Peripheral Features:

Input/Output Ports and Interfacing

Embedded Systems Programming and Architectures

Outlines. PIC Programming in C and Assembly. Krerk Piromsopa, Ph.D. Department of Computer Engineering Chulalongkorn University

PIC16F84A. 18-pin Enhanced Flash/EEPROM 8-Bit Microcontroller. Devices Included in this Data Sheet: Pin Diagrams. High Performance RISC CPU Features:

EXPERIMENT 4: Parallel Input/Output. Objectives Introduction to the Parallel Input/Output (I/O) Familiarization to Interfacing

Mod-5: PIC 18 Introduction 1. Module 5

Laboratory: Introduction to Mechatronics

Microcontroller Overview

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

Laboratory 10. Programming a PIC Microcontroller - Part II

EE 367 Introduction to Microprocessors Homework 6

Embedded Systems Design (630470) Lecture 4. Memory Organization. Prof. Kasim M. Al-Aubidy Computer Eng. Dept.

Physics 335 Intro to MicroControllers and the PIC Microcontroller

When JP1 is cut, baud rate is Otherwise, baud rate is Factory default is that JP1 is shorted. (JP1 is jumper type in some model)

PIC16C52. EPROM-Based 8-Bit CMOS Microcontroller PIC16C52. Pin Diagrams. Feature Highlights. High-Performance RISC CPU. Peripheral Features

CENG 336 INT. TO EMBEDDED SYSTEMS DEVELOPMENT. Spring 2006

PIC16C432 OTP 8-Bit CMOS MCU with LIN bus Transceiver

Section 8. Reset. Reset HIGHLIGHTS. This section of the manual contains the following topics:

Learning Objectives:

Documentation Design File Formats

Instuction set

Chapter 10 Sections 1,2,9,10 Dr. Iyad Jafar

Hong Kong Institute of Vocational Education Digital Electronics & Microcontroller. 8. Microcontroller

Jordan University of Science and Technology Electrical Engineering Department Microcontrollers and Embedded Systems Spring 2011

LCD. Configuration and Programming

Laboratory: Introduction to Mechatronics. Instructor TA: Edgar Martinez Soberanes Lab 2. PIC and Programming

PIC16F8X. 8-Bit CMOS Flash/EEPROM Microcontrollers PIC16F8X PIC16CR8X. Pin Diagram. Devices Included in this Data Sheet:

Real Time Embedded Systems. Lecture 1 January 17, 2012

PIC16F8X 18-pin Flash/EEPROM 8-Bit Microcontrollers

TOPIC 3 INTRODUCTION TO PIC ASSEMBLY LANGUAGE. E4160 Microprocessor & Microcontroller System. Prepared by : Puziah Yahaya JKE, POLISAS / DEC 2010

Section 8. Reset HIGHLIGHTS. Reset. This section of the manual contains the following major topics:

Section 30. In-Circuit Serial Programming (ICSP )

16.317: Microprocessor-Based Systems I Spring 2012

SOLUTIONS!! DO NOT DISTRIBUTE PRIOR TO EXAM!!

ECE Test #1: Name

CENG-336 Introduction to Embedded Systems Development. Timers

n/a PIC12F629-I/P (RC) n/a PIC12F629-I/SN (RC) n/a PIC12F675-I/P (RC) n/a PIC12F675-I/SN MICROCONTROLLER (RC)

Introduction to Embedded Systems

University of Dayton. Electrical & Computer Engineering. ECE 536 Microprocessor Applications. Dr. Ralph Barrera. Assignment (4)

APPLICATION NOTE 2361 Interfacing an SPI-Interface RTC with a PIC Microcontroller

Chapter 11: Interrupt On Change

BME 4900 Page 1 of 2. Meeting 2: Personal Progress Report 12/2/09 Team 12 with Drew Seils. Semester One Week Two

Transcription:

Model Answer Course name: Microcontrollers Exam numer: Midterm - Fall 2017 Course Code: ECE401 Exam Date: Nov 2016 Lecturer: Dr. Ahmed ElShafee Time Allowed: 60 minutes ID:... Name:.... MCQ Prolems Total Q1 Q2 20 5 5 30-1 / 16 -

Part 1: MCQ Highlight your answer in the following tale (Answer only 02 questions) # A B C D E F G 1 a 2 d 3 4 5 c 6 7 a 8 9 a 10 11 c 12 13 d 14 c 15 c 16 c 17 c 18 a 19 20 c 21 d 22 c 23 24 25-2 / 16 -

(Answer only 20 questions) # 1 How many clock pulses are confined y each machine cycle of Peripheral-Interface Controllers? a. 4. 8 c. 12 d. 16 2 Which flags are more likely to get affected in status registers y Arithmetic and Logical Unit (ALU) of PIC 16F84 on the asis of instructions execution? a. Carry (C) Flags. Zero (Z) Flags c. Digit Carry (DC) Flags d. All of the aove 3 What is the execution speed of instructions in PIC especially while operating at the maximum value of clock rate, considering that used crystal is 20MHz? a. 0.1 μs. 0.2 μs c. 0.4 μs d. 0.8 μs 4 Which operational feature of PIC allows it to reset especially when the power supply drops the voltage elow 4V? a. Built-in Power-on-reset. Brown-out reset c. Both a & d. None of the aove 5 Which timer/s possess an aility to prevent an endless loop hanging condition of PIC along with its own on-chip RC oscillator y contriuting to its reliale operation? a d c a. Power-Up Timer (PWRT). Oscillator Start-Up Timer (OST) c. Watchdog Timer (WDT) d. crystal oscillator (XT) - 3 / 16 -

6 Which among the CPU registers of PIC 16C6X/7X is not 8-it wide? a. Status Register. Program Counter Latch (PCLATH) Register c. Program Counter Low Byte (PCL) Register d. File Selection Register (FSR) 7 Which register/s is/are mandatory to get loaded at the eginning efore loading or transferring the contents to corresponding destination registers? a. W. INDF c. PCL d. All of the aove 8 How many RPO status its are required for the selection of two register anks? a. 1. 2 c. 8 d. 16 9 The RPO status register it has the potential to determine the effective address of a. Direct Addressing Mode. Indirect Addressing Mode c. Immediate Addressing Mode d. Indc. Watchdog Timer (WDT) exed Addressing Mode 10 Which status its exhiit carry from lower 4 its during 8-it addition and are especially eneficial for BCD addition? a. Carry it (C). Digits Carry it (DC) c. Both a & d. None of the aove 11 Where do the contents of PCLATH get transferred in the higher location of program counter while writing in PCL (Program Counter Latch)? a a c a. 11th it. 12th it c. 13th it d. 14th it - 4 / 16 -

12 Which condition/s of MCLR (master clear) pin allow to reset the PIC? a. High. Low c. Moderate d. All of the aove 13 Which significant feature/s of crystal source contriute/s to its maximum predilection and utility as compared to other clock sources? a. High accuracy. Proficiency in time generation c. Applicaility in real-time operations d. All of the aove 14 How many its are required for addressing 2K & 4K program memories of PIC 16f84 respectively? a. 4 & 8 its. 8 & 16 its c. 11 & 12 its d. 12 & 16 its 15 When do the special address 004H get automatically loaded into the program counter? d c c a. After the execution of RESET action in program counter. After the execution of goto start instruction in the program memory (start @ org 0000) c. At the occurrence of interrupt into the program counter d. At the clearance of program counter with no value - 5 / 16 -

16 Which registers are adopted y CPU and peripheral modules so as to control and handle the operation of device a. General Purpose Register. Special Purpose Register c. Special Function Registers d. All of the aove 17 Which register acts as an input-output control as well as data direction register for PORTA in ank 1 of RFS? a. INDF (80H). TRISB (85H) c. TRISA (85H) d. PCLATH (8A) 18 When does it ecome possile for a it to get accessed from ank 0 in the direct addressing mode of PICs? a. Only when RPO it is set zero. Only when RPO it is set 1 c. Only when RPO it is utilized along with 7 lower its of instruction code d. Cannot Predict 19 Which instruction is applicale to set any it while performing itwise operation settings? a. cf. sf c. Both a & d. None of the aove 20 Where is the result stored after an execution of increment and decrement operations over the special function registers in PIC? c c a c a. File Register. Working Register c. Both a & d. None of the aove - 6 / 16 -

21 Which flags of status register are most likely to get affected y the single-cycle increment and decrement instructions? a. P Flags. C Flags c. OV Flags d. Z Flags 22 Where is the result stored after an execution of addition and sutraction operations over the special function registers in PIC? a. File Register. Working Register c. Both a & d. None of the aove 23 Where is the result stored after an execution of addition and sutraction operations over literal value in PIC? a. File Register. Working Register c. Both a & d. None of the aove 24 For the following C code For(int n=0;n<7;n++) { // do something To uild this code in assemly, the most equivalent instruction to e used to implement that loop is a) incfsz ) decfsz d) goto c) call d c - 7 / 16 -

25 The following code BSF STATUS,RP0 MOVLW H'11' MOVWF TRISB Used for a) write high on 1st and 5th pins of port ) enale input at 1st and 5th pins of port c) read values on 1st and 5th pins of port d) write low on 1st and 5th pins of port - 8 / 16 -

Part 2: prolems: Q1 A 220V AC lamp is placed on the top of telecommunication tower in to alert plans during the night, this lamp is called Beacon Lamp. You are required to uild a control oard uses 16F84A microcontroller to drive an 220 V AC eacon lamp. MC is connected to photocell (photo resistor LDR ) to surrounded detect light intensity. Microcontroller will monitor the feedack from photocell (daylight = 0, night=1), it will turn off the eacon lamp in the presence of daylight, and eacon will flash (delay 1 sec) during the night. Write a C program that implements Beacon Controller. Consider the following MC pin RA0 RA1 Interfaced to Photocell Beacon Lamp Status MC input Day light 0 Night 1 Status MC output Beacon on 1 Beacon off 0-9 / 16 -

#include <xc.h> #include <pic16f84a.h> void main(void) { // RA0 : PhotoCell // RA1 : Beacon // configure porta TRISA=0x01; //endless loop while(1) { // check photo cell for daylight if(ra0==0) { // turn eacon off RA1=0; // check photo cell for night else { // turn photo cell on RA1=1; // delay _delay(1000000); // turn photo cell off RA1=0; // delay _delay(1000000); - 10 / 16 -

- 11 / 16 -

Q2 for the following schematic PIC16f84A microcontroller, write a C program that make leds (D0 D7shift left when pressing P1, and shift right when pressing P2-12 / 16 -

#include <xc.h> #include <pic16f84a.h> void main(void) { // RA2 : up // RA3 : down // configure porta TRISA= 00001100 ; // configure port TRISB=0xff; while(1) { if(ra2==0) { If(port<0x80) portb=portb<<1; Else if(ra3==0) { If(port>0x01) portb=portb<<1; _delay(100000); - 13 / 16 -

- 14 / 16 -

- 15 / 16 -

- 16 / 16 -