The University of Texas at Arlington Lecture 21_Review

Similar documents
ELCT 912: Advanced Embedded Systems

EE6008-Microcontroller Based System Design Department Of EEE/ DCE

These 3 registers contain enable, priority,

EET203 MICROCONTROLLER SYSTEMS DESIGN Serial Port Interfacing

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

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

Department of Electronics and Instrumentation Engineering Question Bank

CENG-336 Introduction to Embedded Systems Development. Timers

CHAPTER TIMER PROGRAMMING

8051 Microcontroller

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

Interrupts on PIC18F252 Part 2

Section 14. Timer1 HIGHLIGHTS. Timer1. This section of the manual contains the following major topics:

8051 Peripherals. On-Chip Memory Timers Serial Port Interrupts. Computer Engineering Timers

Capture Mode of Pic18F252

Ali Karimpour Associate Professor Ferdowsi University of Mashhad

ELE492 Embedded System Design

Using Timers of Microchip PIC18F Microcontrollers

Interrupts on PIC18F252 Part 2. Interrupts Programming in C Language

MCS-51 Serial Port A T 8 9 C 5 2 1

Embedded Systems Programming and Architectures

Mod-5: PIC 18 Introduction 1. Module 5

PIC Microcontroller Introduction

Ali Karimpour Associate Professor Ferdowsi University of Mashhad

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

Lab 6 RS-232 Communication The following routines are provided for devices with a single USART peripheral:

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

Micro-Controller: PIC16C74 < Part 5: Interrupt >

The Atmel ATmega168A Microcontroller

e-pg Pathshala Subject: Computer Science Paper: Embedded System Module: Interrupt Programming in Embedded C Module No: CS/ES/20 Quadrant 1 e-text

8051 Microcontroller memory Organization and its Applications

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: Interrupt Handling Module No: CS/ES/13 Quadrant 1 e-text

Interrupts. Embedded Systems Interfacing. 08 September 2011

Interrupts. ELEC 330 Digital Systems Engineering Dr. Ron Hayne. Images Courtesy of Ramesh Gaonkar and Delmar Learning

Microcontroller and Embedded Systems:

Microprocessors B (17.384) Spring Lecture Outline

8051SERIAL PORT PROGRAMMING

The 8051 microcontroller has two 16-bit timers/counters called T0 and T1.

8051 Timers and Serial Port

Mod-3: Interrupts,Timer operation,serial communication 1

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

UNIVERSITY OF BOLTON SCHOOL OF ENGINEERING B.ENG (HONS) ELECTRICAL AND ELECTRONIC ENGINEERING EXAMINATION SEMESTER /2016

Section 21. Addressable USART

More Fun with Timer Interrupts

CPEG300 Embedded System Design. Lecture 8 Timer

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

Performance & Applications

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

Timer programming

The Atmel ATmega328P Microcontroller

Asynchronous Transmission. Asynchronous Serial Communications & UARTS

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

Embedded systems. Exercise session 3. Microcontroller Programming Lab Preparation

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

CHAPTER 11 INTERRUPTS PROGRAMMING

Experiment 7:The USART

8051 Microcontroller

DERTS Design Requirements (1): Microcontroller Architecture & Programming

8051 Microcontrollers

ME 515 Mechatronics. A microprocessor

EE251: Tuesday December 4

EEE394 Microprocessor and Microcontroller Laboratory Lab #6

Embedded System Design

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

Chapter 13. PIC Family Microcontroller

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

evsjv `k cigvyy kw³ Kwgkb BANGLADESH ATOMIC ENERGY COMMISSION

TKT-3500 Microcontroller systems

PIC Discussion By Eng. Tamar Jomaa

Interrupts, timers and counters

Microcontroller basics

UNIVERSITY OF BOLTON SCHOOL OF ENGINEERING. BEng(Hons) Electrical and Electronics Engineering SEMESTER 1 EXAMINATION 2016/2017

Topic 11: Timer ISMAIL ARIFFIN FKE UTM SKUDAI JOHOR

Introduction to ARM LPC2148 Microcontroller

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

Chapter C2051 Architecture and Serial Communication Link

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

Introduction to Embedded Systems

MTRX3700 Mechatronics

SYLLABUS UNIT - I 8086/8088 ARCHITECTURE AND INSTRUCTION SET

Example of Asyncronous Serial Comms on a PIC16F877

UNIT IV MICROCONTROLLER

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

Chapter 2. Overview of Architecture and Microcontroller-Resources

ECE 354 Computer Systems Lab II. Interrupts, Strings, and Busses

Topics. Interfacing chips

UNIVERSITY OF BOLTON SCHOOL OF ENGINEERING MSC SYSTEMS ENGINEERING AND ENGINEERING MANAGEMENT SEMESTER 2 EXAMINATION 2016/2017

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: Serial Port Communication Module No: CS/ES/11 Quadrant 1 e-text

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.

Chapter 11: Interrupt On Change

Sender Receiver Sender

The Freescale MC908JL16 Microcontroller

EE251: Thursday November 30

VLSI Design Lab., Konkuk Univ. Yong Beom Cho LSI Design Lab

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

AVR XMEGA TM. A New Reference for 8/16-bit Microcontrollers. Ingar Fredriksen AVR Product Marketing Director

ELEG3923 Microprocessor Ch.9 Timer Programming

8051 Microcontroller Interrupts

8051 Timers. Class 7 EE4380 Fall Pari vallal Kannan. Center for Integrated Circuits and Systems University of Texas at Dallas

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

Transcription:

The University of Texas at Arlington Lecture 21_Review CSE 5442/3442

Agenda Tuesday December 1st Hand back Homework 7,8 and 9. Go over questions and answers Exam 3 Review Note: There will be a take home problem that counts 10 points (addressing ABET requirement) On web page by Friday, 12/4 2

Exam 3 Coverage Exam 3, Thursday December 10, 2009 8:00 AM - 10:30 AM Exam Coverage: 1. Labs 5 and 6 2. Chapter 9 Timers 3. Chapter 10 Serial Port Programming 4. Chapter 11 Interrupts 5. Chapter 15 Using PIC18 Timers for CCP, PWM, and ECCP will not be on test 6. Chapter 16 Using the SPI 3

Exam 3 Information cont. Exam 3 will be similar in form as Exam 1 and 2 - close book, one 8.5 x 11 inch page with any information you would like to have placed on it. You may bring the instruction summary that I previously provided. 4

Assignment 7 Chapter 11 Problems 1.,3., 7., 9.,15.,16., 18., 21. 22., 33., 34., 37., 39., 42., 43., 47., 48., 51., 52. 76 1. Which technique, interrupt or polling, avoids tying down the microcontroller? interrupts 3. In the PICI8 what memory area is assigned to the interrupt t vector table? 0x0008 and 0x0018 4. True or false. The PICI8 programmer cannot change the memory address location assigned to the interrupt vector table. 5

Assignment 7, cont. 7. Do we have a memory address in the interrupt vector table assigned to the Timer0 interrupt? No all interrupts go to the same location (high or low) 9. To which register does the GIE bit belong? INTCON 6

Assignment 7, cont. 11. What is the state of the GIE bit upon power-on reset, and what does it mean? GIE is set to 0 so the interrupts are disabled on power up. 15. How many bytes of address space in the interrupt vector table are assigned to the highpriority interrupt? 16 bytes (8 words) 7

Interrupt Types CSE 3442/5442 Lecture 16 Dr. Roger Walker 8

Registers and Bit Names for Interrupt t Sources CSE 3442/5442 Lecture 16 Dr. Roger Walker 9

Simplified View of Interrupts (default for power-on reset) CSE 3442/5442 Lecture 16 Dr. Roger Walker 10

PIC18 External Hardware Interrupt t Pins CSE 3442/5442 Lecture 16 Dr. Roger Walker 11

Assignment 7, cont. 16. How many bytes of address space in the interrupt vector table are assigned to the low-priority interrupt? From 18 to what ever addresses not used by program. 18. True or false. The INTCON register is not a bit-addressable register. 21. True or false. Upon reset, all interrupts t are enabled by the PIC18. 12

Assignment 7, cont. 22. In the PIC18, how many bytes of ROM space are assigned to the reset. 8 Bytes 23. True or false. For each of Timer 0 and Timer 1, there is a unique address in the interrupt t vector table. 13

Assignment 7 Cont. 33. True or false. An address location is assigned to each of the external hardware interrupts t INT0, INTI, and INT2. 34. What address in the interrupt vector table is assigned to INT0, INTI and INT2? How about the pin numbers on PORTB? 0x0008 if high priority and 0x0018 if low priority, Pins 33, 34, and 35 are the INT0-2 interrupt lines. INT0 is always a high priority interrupt. (Note: If you said 0008 following a reset or power on and the words unless otherwise specified it would be counted correctly as this was in the book.) 14

Assignment 7, cont. 37. Show how to enable all three external hardware interrupts. BSF INTCON, INT0IE BSF INTCON3,INT1IE INT1IE BSF INTCON3,INT2IE 39. True or false. Upon reset, all the external hardware interrupts are negative edgetriggered. 42. The INTlIF bit belongs to the register. INTCON3 15

Assignment 7, cont. 43. True or false. The last two instructions of the ISR for INTI are: BCF INTCON3,INT1IF INT1IF RETFIE 47. True or false. INTO-INT2 are part of the PEIE group. 48. True or false. Upon power-on reset, all of INTO-INT2 are positive edge trigered. 16

Assignment 7, cont. 51. True or false. INT0-INT2INT2 must be configured as an input pin for a hardware interrupt to come in. 52. Which register holds the INTEDGx bits? INTCON2 register. 76. True or false. In PIC18 an interrupt inside an interrupt is not allowed. 17

Chapter 9 Timers SUMMARY The PIC18 can have up to four or more timers/counters, depending on the family member. When used as timers, they can generate time delays. When used as counters, they can serve as event counters. By using the external clock option, pulses are fed through h one of the PIC18 s pins and the mode is referred to as a counter mode. Generally, the timers are accessed as two 8-bit registers, TMRLx and TMRHx. They can be used as a 16-bit timer, or as an 8-bit bttimer. 18

Timer Summary cont. Each timer has its own TCON (Timer Control) register, to choose between various operational modes. Among the modes are the prescaler and timer/counter options. When the timer is used as a timer, the PICI8's crystal is used as the source of the frequency (Fosc/4); however, when it is used as a counter, it is a pulse outside of the PIC18 that increments the TMRxH, TMRxL registers. 19

Programming 1. Load T0CON Prescale & 8/16 bit options. 2. Load TMR0H followed by TMR0L 3. Start Timer 4. Loop (or ISR interrupt mode) when roll over flag set. 5. Stop timer and clear flag 6. Go back to step 2 20

Assignment 8 On pages 383-385 385, Chapter 9 in your text, work problems 1, 5., 8., 9., 14., 16., 21., 29.,45., 46., 47. 1. How many timers are in the PIC18F458? 4ti timers 5. Timer1 supports the highest prescaler value of 8. 21

Assignment 8 - cont. 8. True or false. TICON is a bit-addressable register. 9. Find the T1CON value for 16-bit mode, no prescaler, timer oscillator off, with the clock coming from the PICI8's crystal. 0x01 (assuming enabling w/ these parameters 14. True or false. Both Timer0 and Timer1 have their own timer interrupt flags. 22

T1CON (Timer 1 Control ) Register 1 2 3 23

Figure 8-2a. PIC18F458 Power-On Reset Circuitit Counter0 External CLk. In Pin Counter1 External CLk. In Pins 24

Timer1 Block Diagram 3 1 2 25

PIR1 (Interrupt Control Register 1) Contains the TMR1IF Flag 26

Assignment 8 - cont. 16. Assume that XTAL = 10 MHz. Find the TMR0H, TMR0L value needed to generate a time delay of 2 ms. Use 16-bit mode, no prescaler mode. 10MHz/4=25MHz 2.5 MHz, 1/25MHz=04μs 2.5 0.4 μs, 2 ms / 0.4 μs = 5000, 65536 5000 = 60536 = 0xEC78, TMR0H = 0xEC TMR0L = 0x78 27

Assignment 8 - cont. 21. Assuming that XTAL = 10 MHz, and we are generating a square wave on pin RB7, find the lowest square wave frequency that we can generate using Timer0 in 16-bit mode. 10 MHz / 4 = 2.5 MHz, 2.5 MHz / 256 = 9765.625 Hz, 1 / 9765.625625 Hz = 102.4 μs, 102.4 μs * 65536 = 6.7108864 s, 6.7108864 s * 2 = 13.4217728 s, 1 / 13.4217728 = 0.0745058 Hz So the lowest frequency is equal to 0.0745058 HZ. 28

Prob. 21 2^16 2^16 T 10 Mhz / 4 1/256 F = 1 / T (per ct) 29

Assignment 8 - cont. 29. To use a timer as an event counter we must set the T0CS bit in the T0CON register to (LOW, HIGH). ) We must set T0CS bit of T0CON to high 45. Indicate when the timer flag is raised for each of the following: (a) Timer2 - When TMR2 = PR2 (b) Timer3 - When TMR3H:TMR3L rolls over from FFFFH to 0000H 30

Assignment 8 - cont. 46. True or false. The PR2 register of Timer2 is an 8-bit register. 47. True or false. Both Timer2 and Timer3 are 16-bit timers. 31

Serial I/O Chapter 10 Terms Baud Rate (distingush from bits per second) RS232 main signals, RTS, CTS, DTR, DSR, SGd, TxD, RcD Framing Mark/space, DB9 vs DB25, UART, USART 32

Assignment 9 On pages 418-420 420, Chapter 10 in your text, work problems 4., 5., 7., 9., 13., 29., 31., 33.,36., 36 37 4. If there is no data transfer and the line is high, it is called (mark, space). 5. True or false. The stop bit can be 1, 2, or none at all. It can be 1 or 2 but we always need stop bit. 33

Assignment 9 - cont. 7. True or false. RS232 voltage specification is TTL compatible. 9. True or false. DB-25 and DB-9 are pin compatible for the first 9 pins. 13. If two PCs are connected through h the RS232 without the modem, both are configured as a (DTE, DCE) -to- (DTE, DCE) connection. 34

Assignment 9 - cont. 29. Which of the following baud rates are supported by the HyperTerminal program in PC? (a) 4,800 (b) 3,600 (c) 9,600 (d) 1,800 (e) 1,200 (f) 19,200 (a), (c), (e), (f) 35

Assignment 9 - cont. 31. Which bit of the TXSTA is used for baud rate speed? Bit D2 (BRGH) 33. TXREG is a(n) 8 -bit register. 36

Assignment 9 - cont. 36. For XTAL = 10 MHz, find the SPBRG value (in both decimal and hex) for each of the following baud rates. (a) 9,600 (b) 4,800 (c) 1,200 First we have 10 MHz/4 = 2.5 MHz and 2.5/16 = 156,250. Now each is calculated by using X = (156,250/ Desired Baud Rate) 1 formula.. (a) 156,250/9600-1 = 15 = F in hex (b) 156,250/4800-1 = 32 = 20 in hex (c) 156,250/1200-1 = 129 = 81 in hex 37

Assignment 9 - cont. 37. What is the baud rate if we use SPBRG = 15 to program the baud rate? Assume XTAL= 10 MHz. 9600(see page 398 example) SPBRG (Fosc/4/16)/(Desired Baud Rate) -1 Or solve for Baud Rate see table 10-4 38

Chapter 16 - SPI What is SPI page 604/605 SPI Bus Steps for writing to SPI device SPI - Serial Peripheral Interface short tutorial http://www.mct.net/faq/spi.html (only for information/will not be on exam) 39

Lab 6: Digital to Analog Objective: Converter (DAC) The purpose of this lab assignment is to work with the serial DAC chip (MAX 522). Use the QwikFlash board to generate a variable amplitude and frequency signal using the DAC chip. There will be a take home problem that t counts 10 points (addressing ABET requirement) On web page by Friday, 12/4 40

Using the SPI Chapter 16 For Lab 6 Use the SPI Module of PIC SPI Serial Peripheral Interfacing (SPI) protocol 41

SPI_D/A Interface 42