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

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

EEE111A/B Microprocessors

Lecture (04) PIC16F84A (3)

PIC 16F84A programming (II)

Assembly Language Instructions

PIC16F87X 13.0 INSTRUCTION SET SUMMARY INSTRUCTIONS DESCRIPTIONS

Instuction set

Chapter 4 Sections 1 4, 10 Dr. Iyad Jafar

Semester 1. Module Code: EEE305J1. Module Title: MICROCONTROLLER SYSTEMS

SOLUTIONS!! DO NOT DISTRIBUTE!!

UNIVERSITY OF ULSTER UNIVERSITY EXAMINATIONS 2008/9. Semester One

Week1. EEE305 Microcontroller Key Points

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

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

CENG 336 INT. TO EMBEDDED SYSTEMS DEVELOPMENT. Spring 2006

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

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

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

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

PIC16F8X 18-pin Flash/EEPROM 8-Bit Microcontrollers

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

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

Chapter 13. PIC Family Microcontroller

PIC16F84A 7.0 INSTRUCTION SET SUMMARY INSTRUCTIONS DESCRIPTIONS

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.

EE6008-Microcontroller Based System Design Department Of EEE/ DCE

DERTS Design Requirements (1): Microcontroller Architecture & Programming

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

PIC16C63A/65B/73B/74B

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

ECE Test #1: Name

Embedded System Design

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

ME 6405 Introduction to Mechatronics

PTK8756B 8 Bit Micro-controller Data Sheet

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

Section 11. Timer0. Timer0 HIGHLIGHTS. This section of the manual contains the following major topics:

16.317: Microprocessor Systems Design I Fall 2013 Exam 3 Solution

Fortune. Semiconductor Corporation 富晶半導體股份有限公司. 8-bit MCU with 1k program ROM, 64-byte RAM, 1 R2F module and 3 13 LCD driver. TD Rev. 1.

Learning Objectives:

CENG-336 Introduction to Embedded Systems Development. Timers

PIC16C432 OTP 8-Bit CMOS MCU with LIN bus Transceiver

PIC Discussion. By Eng. Tamar Jomaa

PIC16F8X PIC16F8X. 18-pin Flash/EEPROM 8-Bit Microcontrollers

Section 4. Architecture

16.317: Microprocessor-Based Systems I Spring 2012

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)

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

PIC Discussion By Eng. Tamar Jomaa

Micro II and Embedded Systems

16.317: Microprocessor-Based Systems I Summer 2012

Chapter 5 Sections 1 6 Dr. Iyad Jafar

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

movwf prevcod ; a new button is pressed - rcnt=3 movwf (mtx_buffer+1) movlw 3 movwf rcnt

Section 31. Instruction Set

SOLUTIONS!! DO NOT DISTRIBUTE PRIOR TO EXAM!!

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

EECE.3170: Microprocessor Systems Design I Summer 2017 Homework 5 Solution

CONNECT TO THE PIC. A Simple Development Board

TM57PA20/ TM57PA40. 8 Bit Microcontroller. User Manual. Tenx reserves the right to change or discontinue this product without notice.

Chapter 3: Further Microcontrollers

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

Section 13. Timer0 HIGHLIGHTS. Timer0. This section of the manual contains the following major topics:

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

D:\PICstuff\PartCounter\PartCounter.asm

A Better Mouse Trap. Consumer Appliance, Widget, Gadget APPLICATION OPERATION: Ontario, Canada

To Our Valued Customers

PART TWO LISTING 8 PROGRAM TK3TUT8 MOVF PORTA,W ANDLW B ADDWF COUNT,F MOVF COUNT,W MOVWF PORTB GOTO LOOP

PIC16F870/ /40-Pin, 8-Bit CMOS FLASH Microcontrollers. Devices Included in this Data Sheet: Pin Diagram. Microcontroller Core Features:

/* PROGRAM FOR BLINKING LEDs CONEECTED TO PORT-D */

EE 361L Digital Systems and Computer Design Laboratory

PIC16C62X Data Sheet. EPROM-Based 8-Bit CMOS Microcontrollers Microchip Technology Inc. DS30235J

ABOV SEMICONDUCTOR 8-BIT SINGLE-CHIP MICROCONTROLLERS MC71PD506. USER S MANUAL (Ver. 1.0)

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

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

PIC Discussion By Eng. Tamar Jomaa

These 3 registers contain enable, priority,

PIC16F Pin, 8-Bit Flash Microcontroller. Processor Features: Microcontroller Features: CMOS Technology: Peripheral Features:

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

Performance & Applications

PIC16F818/819 Data Sheet

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

Hi Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan

PIC16F630/676 Data Sheet

PIC Microcontroller Embedded Systems Hadassah College Spring 2012 PIC Microcontroller Dr. Martin Land

PIC PROGRAMMING START. The next stage is always the setting up of the PORTS, the symbol used to indicate this and all Processes is a Rectangle.

/ 40 Q3: Writing PIC / 40 assembly language TOTAL SCORE / 100 EXTRA CREDIT / 10

16.317: Microprocessor-Based Systems I Fall 2012

Introduction to PIC Programming

PIC16F Pin, 8-Bit Flash Microcontroller. Processor Features: extreme Low-Power (XLP) Features. Microcontroller Features: Peripheral Features:

Arithmetic,logic Instruction and Programs

PIC12F629/675 Data Sheet

PIC10F200/202/204/206 Data Sheet

Input/Output Ports and Interfacing

PIC10F200/202/204/206

PIC16C Pin, 8-Bit CMOS Microcontroller. Device included in this Data Sheet: Special Microcontroller Features: High-Performance RISC CPU:

Application Note - PIC Source Code v1.1.doc

Chapter 2 Sections 1 8 Dr. Iyad Jafar

PIC12C5XX. 8-Pin, 8-Bit CMOS Microcontroller. CMOS Technology: Devices included in this Data Sheet: High-Performance RISC CPU: Pin Diagram

ECE 354 Introduction to Lab 2. February 23 rd, 2003

Transcription:

UNIVERSITY OF ULSTER UNIVERSITY EXAMINATIONS : 2001/2002 Semester 2 Year 2 MICROCONTROLLER SYSTEMS Module Code: EEE305J2 Time allowed: 3 Hours Answer as many questions as you can. Not more than TWO questions from Section B will contribute to the final mark. Use separate answer books for each section. A PIC16 FXXX instruction set appears at the end of this paper A CCS C compiler reference card appears at the end of this paper Module Co-Ordinator: Dr S J Katzen 1/9

SECTION A Q.A1 A certain TV panel game has eight contestants who will answer questions posed by the compère. Each contestant has a single push switch he/she closes if ready to respond. A single common cathode 7-segment display is to be used to indicate which contestant responded first. A single buzzer sounds for nominally one second to alert the compère that there has been some response. After the buzzer has sounded, there is to be a nominal 20-second delay to lock out any further contestant switch activity. The intelligence of this logic system is to be implemented using a PIC16F87X-based system which is to read the eight switches and drive the 7-segment display and single buzzer. Pertinent hardware details are: A closed switch gives a logic 0. The single common-cathode 7-segment display requires a nominal current of 20 ma for each segment. The buzzer requires 5 volts to activate. The PIC is clocked using a 4 MHz crystal and uses a 5V power supply. You are asked to design both input and output interface circuitry and software for the system to implement the following scheme. Questions (1), (2) and (3) should be illustrated and any software port configuration shown at this point. (1) The input interface for the eight contestant switches, including any necessary resistors. [6 marks] (2) The output interface to the single common-cathode 7-segment display. Determine the value of the seven current limiting resistors. [8 marks] (3) A single output line to drive the buzzer. [2 marks] (4) An algorithm and assembly-level code as listed below, assuming that file registers between 20h and 2Fh are free. (a) A main endless loop to: (i) Initialise the system; 2/9

(ii) (iii) (iv) (v) loop to scan and count the eight contestant switches looking for a closure; breaking out of the loop on a closed switch and calling up subroutine (b) below to convert the contestant number of 7-segment code and activate the display; sound the buzzer for nominally one second using subroutine (c); wait for a further 19 seconds using subroutine (c), clear the display and repeat forever. [26 marks] (b) (c) A subroutine converting a 4-bit binary code 0000 through 1000, in the working register to active-high 7-segment code. [8 marks] A subroutine that gives a nominal n-100 ms (0.1s) delay, where n is an Integer passed to the subroutine in the working register. [10 marks] For bonus marks: (5) What additional software and hardware resources would be needed to extend your system to cope with up to twelve contestants. [4 marks] (6) Write a main ( ) function in C to implement the code of 4 (a) above. You can assume that functions svnseg(n) and delay_ms(n) are already available to implement 4 (b) and 4 (c). [18 marks] 3/9

SECTION B Q.B2 (a) An analogue-to-digital (A/D) converter is to be used to capture digitised speech signals which have been band limited to a range of 300 Hz to 3000 Hz. Choose a suitable type of A/D converter and with the aid of a block diagram and circuit waveforms, explain the operation of the converter. [12 marks] (b) (c) Comment on the speed of conversion of the A/D converter chosen in Q.2a and comment on its noise immunity and resolution when compared with one other type of A/D converter with which you are familiar. [3 marks] Digitising the video signal obtained from a television camera requires a special type of A/D converter, due to the relatively high frequency of the signal. Briefly describe a digital-to-analogue conversion technique which could be used in this situation. [5 marks] Q.B3 (a) The terms single-ended and balanced-differential are sometimes used to describe the standards for serial interfaces between microcomputer systems. Using simple diagrams, describe two industry standards for these types of interfaces and compare and contrast their performance. [10 marks] (b) (c) Explain when and why it becomes necessary to consider the transmission-line characteristics of an interconnecting line for a serial interface. What are the problems encountered? [8 marks] How can the effects of some of the problems mentioned in Q.3b be reduced by suitable choice of connecting cables? [2 marks] 4/9

Q.B4 (a) With reference to Fig. Q.B4, explain the operation of Timer 0 detailing the function of each register and configuration bit. [10 marks] (b) Write a subroutine to use Timer 0 to create a fixed delay of 208 ms. You may assume that the crystal frequency is 4 MHz. Your answer should show how you would configure Timer 0 using a pre-scaler ratio of frequency divide ratio of 4. [10 marks] F /4 osc File 1 TMR0 Synch 1 0 Prescaler 256 128 64 32 16 8 4 2 110 101 100 011 010 001 0 F /4 osc RA4 1 T0CKI Timer 0 111 000 PS0 0 PS1 1 PS2 2 Overflow 2 INTCON T0IF File 0B h T0SE 4 T0CS 5 PSA 3 OPTION_REG File 81 h Fig. Q.B4 5/9

14-bit 16CXX Dest CCR op-code Instruction Mnemonic WFZD C Operation summary 11 1110 LLLL LLLL ADD Literal to W addlw LL w <- w + #LL 00 0111 dfff ffff ADD W and F addwf f,d d <- w + f 11 1110 LLLL LLLL AND Literal to W andlw LL w <- w #LL 00 0101 dfff ffff ANDWtoF andwf f,d d <- w f 01 00nn nfff ffff Bit Clear File bit n bcf f,n 01 01nn nfff ffff Bit Set File bit n bsf f,n 01 10nn nfff ffff Bit Test File bit n & Skip if Clear btfsc f,n 01 11nn nfff ffff Bit Test File bit n & Skip if Set btfss f,n fn <- 0 fn <- 1 pc++ IF fn == 0 pc++ IF fn == 1 10 0aaa aaaa aaaa CALL (jump to) subroutine call aaa TOS <- pc, pc <- aaa 00 0001 1fff ffff CLeaR File clrf f f <- 00 00 0001 0000 0011 CLeaR Working register clrw d <- 00 00 0000 0000 0100 CLeaR Watch Dog Timer clrwdt wdt <- 00 00 1001 dfff ffff COMplement File comf f,d d <- f 00 0011 dfff ffff DECrement File decf f,d d <- f-- 00 1011 dfff ffff DECrement File & Skip on Zero decfsz f,d d <- f--, pc++ IF f == 0 10 1aaa aaaa aaaa GOTO (jump to) aaa goto aaa pc <- aaa 00 1010 dfff ffff INCrement File incf f,d d <- f++ 00 1111 dfff ffff INCrement File & Skip on Zero incfsz f,d d <- f++, pc++ IF f == 0 11 1000 LLLL LLLL Inclusive OR Literal to W iorlw LL w <- w + #LL 00 0100 dfff ffff Inclusive OR W to F iorwf f,d d <- w + f 00 1000 dfff ffff MOVe in File (load) movf f,d d <- f 11 0000 LLLL LLLL MOVe Literal into W movlw LL w <- #LL 00 0000 1fff ffff MOVe W out to File (store) movwf f f <- w 00 0000 0000 0000 No OPeration nop Do nothing 11 0100 LLLL LLLL RETurn from subroutine with L in W retlw w <- #LL, pc <- TOS 00 0000 0000 1000 RETURN from subroutine return pc <- TOS 00 0000 0000 1001 RETurn From IntErrupt retfie GIE <- 1, pc <- TOS 00 1101 dfff ffff Rotate Left File rlf f,d b7 C 7 file 0 00 1100 dfff ffff Rotate Right File rrf f,d b0 7 file 0 C 00 0000 0110 0011 Sleep mode on sleep wdt <- 0, Clock off 11 1100 LLLL LLLL SUB W from Literal sublw LL w <- #LL - w 00 0010 dfff ffff SUBtract W from F subwf f,d d <- f - w 00 1110 dfff ffff SWAP File nybbles swapf f,d d <- f[7:4] <--> f[3:0] 11 1010 LLLL LLLL exclusive OR Literal to W xorlw LL w <- w #LL 00 0110 dfff ffff exclusive OR W to F xorwf f,d d <- w f : Flag operates in the normal manner : Not affected a : Address d : Destination; 0=w,1=f f : File register f n : File bit n L : Literal data pc : Program Counter w : Working register wdt : Watch Dog Timer/prescaler TOS : Top Of Stack pc++ : Jump over next instruction == : Equivalent to ++ : Add one -- : Subtract one GIE : Global Interrupt Enable mask # : Constant S.J. Katzen L A T E X2ε Version 2.1.0 November 13, 2001 pic_ins14.tex 6/9

PIC16F83/84 Special-Purpose Register file summary File Name 7 6 5 4 3 2 1 0 Power-on All other address Reset Resets Bank 0 00h INDF Uses contents of this to address Data memory (not a physical register) 01h TMR0 8-bit real-time clock/counter XXXX XXXX UUUU UUUU 02h PCL 1 Lower-order 8 bits of the Program Counter 0000 00000 0000 0000 03h STATUS 1 IRP RP1 RP0 TO PD Z DC C 0001 1XXX 000??UUU 04h FSR Indirect Data memory address pointer 0 XXXX XXXX UUUU UUUU 05h PORTA RA4 RA3 RA2 RA1 RA0 X XXXX U UUUU 06h PORTB RB7 RB6 RB5 RB4 RB3 RB2 RB1 RB0 XXXX XXXX UUUU UUUU 08h EEDATA Data EEPROM Data register XXXX XXXX UUUU UUUU 09h EEADR Data EEPROM Address register XXXX XXXX UUUU UUUU 0Ah PCLATH Write buffer for top 5 PC bits 0 0000 0 0000 0Bh INTCON GIE EEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000X 0000 000U Bank 1 80h INDF Uses contents of this to address Data memory (not a physical register) 81h OPTION RBPU INTEDG T0CS T0SE PSA PS2 PS1 PS0 1111 1111 1111 1111 82h PCL 1 Lower-order 8 bits of the Program Counter 0000 00000 0000 0000 83h STATUS 1 IRP RP1 RP0 TO PD Z DC C 0001 1XXX 000??UUU 84h FSR Indirect Data memory address pointer 0 XXXX XXXX UUUU UUUU 85h TRISA Port A Direction Register 1 1111 1 1111 86h TRISB Port B Data Direction Register 1111 1111 1111 1111 88h EECON1 Data EEPROM Data register XXXX XXXX UUUU UUUU 89h EECON2 EEPROM Control register (not a physical register) 8Ah PCLATH Write buffer for top 5 PC bits 0 0000 0 0000 8Bh INTCON GIE EEIE T0IE INTE RBIE T0IF INTF RBIF 0000 000X 0000 000U X Not known U Unchanged? Value depends on whether a Watchdog Reset and if in Sleep mode before Reset. Unimplemented; reads as 0. Note 1: Next instruction address if PIC in Sleep mode. S.J. Katzen L A T E X2ε Version 2.1.1 November 13, 2001 pic_ins14.tex 7/9

8/9

9/9