Timers and Pulse Accumulator
|
|
- Allen Clifton Bell
- 6 years ago
- Views:
Transcription
1 7 7.1 Objectives: Tiva is equipped with six General Purpose Timer Modules named TIMERn. Additionally, each TIMERn consists of two 16 bit timers (A and B). Most GPIO pins can be assigned a TIMERn as an alternate function allowing the GPIO pin to act as a port for the TIMER. This lab will focus on using the TIMER0. While doing this lab, you will learn The key components of the GPTM system. How to program the input capture features of the GPTM system. How to program the output compare features of the GPTM system. How to program the Edge Count features of the GPTM system. 7.2 Related material to read: Text, Chapter 15, pp The module described in the text is NOT the same as on our processor, but it is similar and the concepts are the same. TM4C123GH6PM Data Sheet, Chapter 11, pp Very technical, very detailed, and very accurate, but not focused on accomplishing user tasks. Embedded Systems: Real Time Interfacing to ARM Cortex-M Microcontrollers, Jonathan Valvano, Chapter 6, pp This chapter explains exactly our GPTM, and shows how measurements are made using this module. This book is on reserve in Morgan Library
2 7.3 The Tivatimer module (TIMERn): Each timer module, TIMERn, of Tiva performs three main functions, viz., Input Capture, Output Compare and Edge Count. The input capture feature measures the characteristics of a periodic input signal such as period, duty cycle, and frequency of the signal. The output compare feature allows the generation of an output signal to user specifications. The edge count feature is used to count pulses (external events) on a line connected to Tiva. Each TIMERn module (TIMER0, 1, 2, etc) consists of two individual timers A and B. Each timer (A or B) is 16 bits and can be used individually, or configured to concatenate timers A and B to form a 32 bit timer. Figure 7.1 shows the base addresses for each 16/32 bit timer module. Figure 7.1: TIMER base addresses Each TIMER can be physically accessed through one of the GPIO pins, in which case, the GPIO ports will have to be configured accordingly. Each TIMER has already been assigned a GPIO pin, but you will have to enable its function via software using the GPIOAFSEL and GPIOPCTL registers. Figure 7.2 shows each TIMERn and its associated pins. Each of these channels is software configurable to be either, One-Shot, Periodic, Edge Count, Edge Time, or PWM. 7.4 One Shot / Periodic mode: In One Shot / Periodic mode, the timer will start counting up to a specified value, or down from a specified value to 0x00. Counting starts once the timer is enabled using the TnEN bit inside the Control register (GPTMCTL). If configured to count up, the timer starts at 0x00 and counts up to the value stored in the Timer n Interval Load Register (GPTMTnILR). When the value in GPTMTnILR is reached, a Time-Out event is triggered which sets a flag in the Raw Interrupt Status register (GPTMRIS). Then, the timer starts over its count at 0x00 if in Periodic mode. If the timer is set for One Shot, the timer is disabled after the value in the Interval Load Register is reached and the interrupt flag is set. If the timer is configured to count down, the actions are similar to counting up, but instead the timer starts at the value stored in the Interval Load Register and counts down. A timeout event is triggered when 0x00 is reached. In this mode, the timer can also be configured to set a flag in the GPTMRIS register when the current count matches the value loaded into the GPTMTnMATCHR register. In each case the interrupt flag will need to be cleared after each timeout event using the appropriate bit inside the Interrupt Clear Register (GPTMICR)
3 Figure 7.2: TIMER pin assignments 7.5 Edge Time / Edge Count mode: In Edge Time mode the timer starts counting once the timer is enabled, but stores the current count into the GPTMTnR register when an edge of a pulse signal is detected. The timer can be configured to detect a rising edge, falling edge, or either. When the selected edge is detected, a flag in the Raw Interrupt Status register (GPTMRIS) and will need to be cleared using the Interrupt Clear Register (GPTMICR). Edge Count mode is used to count the number of edge types (rising, falling, both) detected, and stores them in the GPTMTnR register. When the count equals the value stared in the GPTMTnMATCHR register, a Capture Mode Match interrupt is triggered. 7.6 Timer Setup: Similar to the GPIO, in order to use the timer peripheral, we must first power it up by staring its clock using the General-Purpose Timer Run Mode Clock Gating Control - 3 -
4 (RCGCTIMER) at address 0x400F.E604. Setting bits 5:0 enables the associated TIMERn module. Figure 7.2: General-Purpose Timer Run Mode Clock Gating Control (RCGCTIMER) The timer must first be disabled before configuring the timer! Each timer A and B can be enabled / disabled by setting or clearing the TnEN bit of the Control register (GPTMCTL, offset 0x00C). Note the difference between enable bits for timer A and B (TAEN, TBEN) inside each TIMERn. The TnSTALL bit allows the timer count to freeze while in debugging mode. Setting this bit allows more efficient debugging of your code. Figure 7.3: GPTM Control register (GPTMCTL)
5 Next set the Configuration register (GPTMCFG, offset 0x000) to specify the 16 bit timer by setting bits 2:0 to 0x4. With this setting, Timer A and B will be used individually as two 16 bit timers. For this lab we will use Timer0A. Note that this register is the base address for the module. Figure 7.4: GPTM Configuration register (GPTMCFG). Since we are using Timer0A after setting the Timer0 CFG register to 16 bit, we need to select which mode Timer A will be running in. The mode is specified using the TAMR bits (bits 1:0) of the Timer A Mode register (GPTMTAMR, offset 0x004). TAMR settings: 0x00 0x01 0x02 0x03 Reserved One Shot Periodic Capture Edge Time and Edge Count modes can be thought of as sub modes of Capture. If either Edge Time or Edge Count modes are desired, TAMR must be set to 0x03 for Capture. Then the Capture Mode bit (TACMR, bit 2) must be set to to specify Edge Time mode or cleared to specify Edge Count mode. The Timer Direction bit (TACDIR, bit 4) selects whether the timer counts up (set bit) or counts down (clear bit). Figure 7.5: GPTM Timer A mode register (GPTMTAMR)
6 If using One-Shot or Periodic, load the 16 bit value that the timer will count up to, or down from, into the GPTM Timer A Interval Load register (GPTMTAILR, offset 0x028). Figure 7.6: GPTM Interval Load Register (GPTMTAILR). If using Edge Count Mode, or using a Match value in One-Shot or Periodic mode, load the match value into the GPTM Timer A Match register (GPTMTAMATCHR, offset 0x030). Figure 7.7: GPTM Timer A Match Register (GPTMTAMATCHR). In order to receive a flag in the RIS register when a particular event happens, the appropriate interrupt will need to be set in the GPTM Interrupt Mask register (GPTMIMR, offset 0x018). The TnTOIM bit enables the Time-Out Interrupt Mask, which is used in One-Shot or Periodic modes. The CnMIM bit enables the Capture Mode Match Interrupt Mask, which is used when Capture mode with Edge Count mode enabled. The CnEIM bit enables the Capture Mode Event Interrupt Mask, which is used when Capture Edge Time mode is enabled. The RTCIM bit enables the Real Time Clock Interrupt Mask, which is used in Real Time Clock mode. The TnMIM bit enables the Match Interrupt Mask, which sets a flag in One-Shot or Periodic modes when using the GPTMTAMATCHR register. Figure 7.8: GPTM Interrupt Mask Register (GPTMIMR)
7 Figure 7.9: GPTM Raw Interrupt Status register (GPTMRIS). With the Timer using the bus clock of 16 Mhz, each clock cycle (each increment of the Timer) is 62.5ns long. When the 16/32 bit Timer is in 16-bit mode, loading TnILR with a maximum value of 0xFFFF would result in a 4.096ms delay (65536*62.5*10-9 ). If a larger delay is needed, the timer has the ability to increase the time between each increment. When the timer is used individually, the GPTM Timer n Prescale register (GPTMTnPR, offset 0x038 for A, 0x03C for B) becomes available. Loading a value into the Prescale register makes the timer first count down the Prescale register to 0x00 before incrementing the timer count. For example, if the Prescale register had a value of 0x03, the timer would use 3 clock cycles to count down to 0x00, then a 4 th to increment the counter. This effectively increased your delay by a factor of 4. When the timer is in 16-bit mode the GPTMTnPR register is 8- bits long, so the delay can be increased by a maximum factor of 256. Figure 7.10 shows prescale values and the equivalent maximum delay. Figure 7.10: Max delay time and equivalent prescale value. Figure 7.11: GPTM Timer n Prescale register
8 The following program shows how to use Timer0A in periodic mode to obtain a 10-second delay. ;16/32 bit Timer Registers TIMER0_CFG EQU 0x TIMER0_TAMR EQU 0x TIMER0_CTL EQU 0x C TIMER0_IMR EQU 0x TIMER0_RIS EQU 0x C TIMER0_ICR EQU 0x TIMER0_TAILR EQU 0x TIMER0_TAMATCHR EQU 0x TIMER0_TAPR EQU 0x TIMER0_TAPMR EQU 0x SYSCTL_RCGCTIMER EQU 0x400FE604 ; 16/32 Gate Control EXPORT main ;*************************************************************** ; Program Area ;*************************************************************** ;LABEL DIRECTIVE VALUE COMMENT main MOV R0, #ms LDR R1, =count STRB R0, [R1] LDR R1, =SYSCTL_RCGCTIMER ; Start Timer clock ORR R2, R2, #0x01 ; start timer 0 ; allow clock to settle LDR R1, =TIMER0_CTL ; disable timer during setup BIC R2, R2, #0x01 ; clear bit0 to disable TimerA LDR R1, =TIMER0_CFG MOV R2, #0x04 ; 16 bit mode LDR R1, =TIMER0_TAMR MOV R2, #0x02 ; periodic, count down LDR R1, =TIMER0_TAILR ; load time-out clocks into TAIL MOV R0, #16000 ; 1ms delay LDR R1, =TIMER0_TAPR ; divide clock by 100 MOV R2, #99 LDR R1, =TIMER0_IMR MOV R2, #0x01 ; enable Time Out Interrupt ; LDR R1, =TIMER0_CTL ; enable timer - 8 -
9 ORR R2, R2, #0x03 ; set bit0 to enable ; and bit1 to stall on debug pole LDR R1,=TIMER0_RIS ; check interrupt flag LDR R2,[R1] CMP R2,#0x01 BNE pole LDR R1, =TIMER0_ICR ; clear interrupt flag MOV R0, #0x01 LDR R1, =count ; check/reduce count LDRB R0, [R1] SUBS R0, R0, #1 STRB R0, [R1] BNE pole LDR R1, =TIMER0_CTL ; stop timer BIC R2, R2, #0x01 done B done ;*************************************************************** ; Data Area ;*************************************************************** ;LABEL DIRECTIVE VALUE COMMENT AREA DATA, READWRITE ALIGN ms EQU 100 count SPACE 1 ALIGN ; END ; Figure 7.12: Program to generate a 10-second delay using Periodic mode
10 7.7 Procedure: 1. Before lab, draw a flowchart for the 3 rd part of this procedure, create two programs that include code in Figures 7.12 and 7.13, run them and test if they are working properly. Describe in writing how these codes are working. How is the delay of 10 seconds created using initial 1ms interrupt setup? Note the changes in TIMER0A initialization between poling and interrupt methods in two programs. Understanding two codes will be very helpful for the second part of Procedures. Show prelab work to your TA at the beginning of lab. 2. Change the program from Maskable Interrupts lab (digital alarm clock) to work with General Purpose Timer Module in Periodic mode. You need to exchange routines that are specific to System Timer (SysTick). Copy the program you have created in previous lab experiment, replace systick_ini by routine that initializes TIMER0A and exchange Interrupt Service Routine (ISR) to service the interrupt created by TIMER0A (i.e. create appropriate Timer0A_Handler). No change is needed for setme, cdisp, almon, led_ini and clock routines. Note that routine initializing TIMER0A needs to enable 1s interrupt in order for digital alarm clock to work properly. 3. Write a program that uses the Edge Time feature of the TIMER to find the duty cycle, period and frequency of a periodic pulse train. For an input signal, you have two choices: a. Connect the function generator signal to one of the pins of Timer0 and configure the corresponding GPIO as an input channel. You may refer Lecture 14 for an example of how to set this up. or b. Using the interrupt based pulse generator shown in Figure 7.13, create a pulse train on a GPIO pin of your choice. Your program should set the R0 register to the number of 1 µsecond high counts and the R1 register to the number of 1 µsecond low counts, For a total period of R0+R1 µseconds. Feel free to modify the subroutine PGstart or ISR PGISR to achieve other TIMER goals you might have. Connect the output pin of the PulseGen to your chosen input capture pin. Write your program such that the period of any periodic pulse train can be measured, i.e., the measured period can be more than the 65,536 counts of the free-running counter. Display the measured characteristics of the signal on the terminal window. Show the working program to the TA. 4. For 40% extra credit, write a program that uses the Edge Count and Periodic modes of the TIMER to count the number of rising or falling edges in the pulse train from the function generator in 10 seconds. Configure one of the channels as an output channel and connect the LED circuit to its output. At time, t = 0, the LED should be off and the Edge Count system should be enabled to count the rising or falling edges in the pulse train from the function generator. After time t = 10 sec., the LED should turn on and the pulse accumulator should stop counting the number of specified edges. Display the counter value on the terminal window at the end of the program. Show the working program to the TA
11 7.8 Questions: 1. Give at least 2 applications each of the Edge Time, Edge Count, and Periodic modes of the TIMER. 2. Is it possible to generate a square wave (50% duty cycle) of period 10 hours using the Periodic mode of the 16 bit TIMER If yes, explain how and if not, explain why not. You do not need to write a program or flow chart to justify your answer. 7.9 Lab report: For the lab write-up, include 1. Your flowcharts and programs that you wrote before the lab. 2. A copy of your working.s files. 3. A brief discussion of the objectives of the lab and the procedures performed in the lab. 4. Answers to any questions in the discussion, procedure, or question sections of the lab
12 ; Routine for creating a pulse train using interrupts ; This uses Channel 0, and a 1MHz Timer Clock ; Be sure to us the Startup.s file ; Use Timer0A to create square wave pulses on PF2 ;Nested Vector Interrupt Controller registers NVIC_EN0_INT19 EQU 0x ; Interrupt 19 enable NVIC_EN0 EQU 0xE000E100 ; IRQ 0 to 31 Set Enable Register NVIC_PRI4 EQU 0xE000E410 ; IRQ 16 to 19 Priority Register ; 16/32 Timer Registers TIMER0_CFG EQU 0x TIMER0_TAMR EQU 0x TIMER0_CTL EQU 0x C TIMER0_IMR EQU 0x TIMER0_RIS EQU 0x C ; Timer Interrupt Status TIMER0_ICR EQU 0x ; Timer Interrupt Clear TIMER0_TAILR EQU 0x ; Timer interval TIMER0_TAPR EQU 0x ;GPIO Registers GPIO_PORTF_IM EQU 0x ; Interrupt Mask GPIO_PORTF_DIR EQU 0x ; Port Direction GPIO_PORTF_AFSEL EQU 0x ; Alt Function enable GPIO_PORTF_DEN EQU 0x C ; Digital Enable GPIO_PORTF_AMSEL EQU 0x ; Analog enable GPIO_PORTF_PCTL EQU 0x C ; Alternate Functions ;System Registers SYSCTL_RCGCGPIO EQU 0x400FE608 ; GPIO Gate Control SYSCTL_RCGCTIMER EQU 0x400FE604 ; GPTM Gate Control AREA THUMB EXPORT EXPORT timer, CODE, READONLY Timer0A_Init Timer0A_Handler Timer0A_Handler LDR R1, =TIMER0_ICR ; clear interrupt flag MOV R0, #0x01 LDR R1, =GPIO_PORTF_IM ; toggle output LDR R0, [R1] EOR R0, R0, #0x04 CMP R0,#0x04 ; check current state BEQ high LDR R1,=TIMER0_TAILR ; load low time LDR R2,=LowClocks LDR R0,[R2] STR R0,[R1] B doneisr high LDR R1,=TIMER0_TAILR ;load high time LDR R2,=HighClocks LDR R0,[R2]
13 STR R0,[R1] doneisr BX LR ; return Timer0A_Init LDR R2, =HighClocks ; store high clocks STR R0, [R2] LDR R2, =LowClocks ; store low clocks STR R1, [R2] LDR R1, =SYSCTL_RCGCGPIO ; start GPIO clock LDR R0, [R1] ORR R0, R0, #0x20 ; set bit 5 for port F ; allow clock to settle LDR R1, =GPIO_PORTF_DIR ; set direction of PF2 LDR R0, [R1] ORR R0, R0, #0x04 ; set bit2 for output LDR R1, =GPIO_PORTF_AFSEL ; regular port function LDR R0, [R1] BIC R0, R0, #0x04 LDR R1, =GPIO_PORTF_DEN ; make port digital LDR R0, [R1] ORR R0, R0, #0x04 LDR R1, =GPIO_PORTF_PCTL ; no alternate function LDR R0, [R1] BIC R0, R0, #0x00000F00 LDR R1, =GPIO_PORTF_AMSEL ; disable analog MOV R0, #0 LDR R1, =SYSCTL_RCGCTIMER ; Start Timer0 ORR R2, R2, #0x01 ; allow clock to settle LDR R1, =TIMER0_CTL ; disable timer during setup BIC R2, R2, #0x01 LDR R1, =TIMER0_CFG ; set 16 bit mode MOV R2, #0x04 LDR R1, =TIMER0_TAMR MOV R2, #0x02 ; set to periodic, count down LDR R1, =TIMER0_TAILR ; initialize match clocks LDR R2, =LowClocks LDR R0, [R2] LDR R1, =TIMER0_TAPR
14 MOV R2, #15 ; divide clock by 16 to ; get 1us clocks LDR R1, =TIMER0_IMR ; enable timeout interrupt MOV R2, #0x01 ; Configure interrupt priorities ; Timer0A is interrupt #19. ; Interrupts are handled by NVIC register PRI4. ; Interrupt 19 is controlled by bits 31:29 of PRI4. ; set NVIC interrupt 19 to priority 2 LDR R1, =NVIC_PRI4 AND R2, R2, #0x00FFFFFF ; clear interrupt 19 priority ORR R2, R2, #0x ; set interrupt 19 priority to 2 ; NVIC has to be enabled ; Interrupts 0-31 are handled by NVIC register EN0 ; Interrupt 19 is controlled by bit 19 ; enable interrupt 19 in NVIC LDR R1, =NVIC_EN0 MOVT R2, #0x08 ; set bit 19 to enable interrupt 19 ; Enable timer LDR R1, =TIMER0_CTL ORR R2, R2, #0x03 ; set bit0 to enable ; and bit 1 to stall on debug BX LR ; return ;*************************************************************** ; Data Area ;*************************************************************** ;LABEL DIRECTIVE VALUE COMMENT AREA DATA, READWRITE ALIGN HighClocks SPACE 4 LowClocks SPACE 4 ALIGN END Figure 7.13: Pulse Generator Subroutine and Interrupt Service Routine
Parallel I/O and Keyboard Scanning
4 4.1 Objectives: Microprocessors can monitor the outside world using input ports. They can also control it using output ports. The TM4C123G (Tiva) performs I/O using 6 ports. Computer keyboards are typically
More information11 General-Purpose Timers
General-Purpose Timers General-Purpose Timers Programmable timers can be used to count or time external events that drive the Timer input pins. The TM4C23GH6PM General-Purpose Timer Module(GPTM) contains
More informationEE251: Tuesday October 23
EE251: Tuesday October 23 Higher Frequency Clock via Phase Locked Loop TIMER MODULE: SysTick-Basis of next week s lab Section 12.4 and 18 in text describes our SysTick Section 2.5 of Valvano s Real Time
More informationAdvanced Assembly, Branching, and Monitor Utilities
2 Advanced Assembly, Branching, and Monitor Utilities 2.1 Objectives: There are several different ways for an instruction to form effective addresses to acquire data, called addressing modes. One of these
More informationSubroutines and the Stack
3 31 Objectives: A subroutine is a reusable program module A main program can call or jump to the subroutine one or more times The stack is used in several ways when subroutines are called In this lab
More informationDesign and Implementation Interrupt Mechanism
Design and Implementation Interrupt Mechanism 1 Module Overview Study processor interruption; Design and implement of an interrupt mechanism which responds to interrupts from timer and UART; Program interrupt
More informationCprE 288 Introduction to Embedded Systems (Timers/Input Capture) Instructors: Dr. Phillip Jones
CprE 288 Introduction to Embedded Systems (Timers/Input Capture) Instructors: Dr. Phillip Jones 1 Announcements HW 4, Due Wed 6/13 Quiz 5 (15 min): Wed 6/13, Textbook reading: Section 9.1, 9.2 (your one-side
More informationInterrupt-Driven Input/Output
Interrupt-Driven Input/Output Textbook: Chapter 11 (Interrupts) ARM Cortex-M4 User Guide (Interrupts, exceptions, NVIC) Sections 2.1.4, 2.3 Exceptions and interrupts Section 4.2 Nested Vectored Interrupt
More informationECE251: Thursday September 27
ECE251: Thursday September 27 Exceptions: Interrupts and Resets Chapter in text and Lab #6. READ ALL this material! This will NOT be on the mid-term exam. Lab Practical Exam #1 Homework # due today at
More informationEE251: Thursday September 20
EE251: Thursday September 20 Parallel I/O aka General Purpose I/O aka GPIO Common Devices: Switches, LEDs, Keypads Read Lab 4 carefully, and Chapter 14 in text Think about what you would like to review
More informationSTM32 MICROCONTROLLER
STM32 MICROCONTROLLER Lecture 4 Prof. Yasser Mostafa Kadah Nested Vectored Interrupt Controller The NVIC supports up to 56 maskable interrupt channels with 16 programmable priority levels Not including
More informationARM Interrupts. EE383: Introduction to Embedded Systems University of Kentucky. James E. Lumpp
ARM Interrupts EE383: Introduction to Embedded Systems University of Kentucky James E. Lumpp Includes material from: - Jonathan Valvano, Introduction to ARM Cortex-M Microcontrollers, Volume 1 Ebook, EE
More informationExam 1 Fun Times. EE319K Fall 2012 Exam 1A Modified Page 1. Date: October 5, Printed Name:
EE319K Fall 2012 Exam 1A Modified Page 1 Exam 1 Fun Times Date: October 5, 2012 Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will
More informationMeasuring Interrupt Latency
NXP Semiconductors Document Number: AN12078 Application Note Rev. 0, 10/2017 Measuring Interrupt Latency 1. Introduction The term interrupt latency refers to the delay between the start of an Interrupt
More informationExam 1. Date: Oct 4, 2018
Exam 1 Date: Oct 4, 2018 UT EID: Professor: Valvano Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will you help others to cheat
More informationEE251: Thursday November 30
EE251: Thursday November 30 Course Evaluation Forms-fill out Memory Subsystem continued Timing requirements Adding memory beyond 4 Gbyte Time Allowing: Begin Review for Final Exam Homework due next Tuesday,
More informationECE251: Intro to Microprocessors Name: Solutions Mid Term Exam October 4, 2018
ECE251: Intro to Microprocessors Name: Solutions Mid Term Exam October 4, 2018 (PRINT) Instructions: No calculators, books, or cell phones; do not communicate with any other student. One side of a single
More informationECE251: Tuesday September 18
ECE251: Tuesday September 18 Subroutine Parameter Passing (Important) Allocating Memory in Subroutines (Important) Recursive Subroutines (Good to know) Debugging Hints Programming Hints Preview of I/O
More informationEmbedded assembly is more useful. Embedded assembly places an assembly function inside a C program and can be used with the ARM Cortex M0 processor.
EE 354 Fall 2015 ARM Lecture 4 Assembly Language, Floating Point, PWM The ARM Cortex M0 processor supports only the thumb2 assembly language instruction set. This instruction set consists of fifty 16-bit
More informationEE319K Fall 2013 Exam 1B Modified Page 1. Exam 1. Date: October 3, 2013
EE319K Fall 2013 Exam 1B Modified Page 1 Exam 1 Date: October 3, 2013 UT EID: Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will
More information// middle priority ISR Status.flag = 1; Status.y = 6;
EE445L Spring 2018 Quiz 1A Page 1 of 6 Jonathan W. Valvano First: Last: March 1, 2018, 3:30pm-4:45pm. This is a closed book exam, with one 8.5 by 11-inch crib sheet. You have 75 minutes, so please allocate
More information(2) Part a) Registers (e.g., R0, R1, themselves). other Registers do not exists at any address in the memory map
(14) Question 1. For each of the following components, decide where to place it within the memory map of the microcontroller. Multiple choice select: RAM, ROM, or other. Select other if the component is
More informationARM Cortex-M4 Architecture and Instruction Set 1: Architecture Overview
ARM Cortex-M4 Architecture and Instruction Set 1: Architecture Overview M J Brockway January 25, 2016 UM10562 All information provided in this document is subject to legal disclaimers. NXP B.V. 2014. All
More informationInterrupt/Timer/DMA 1
Interrupt/Timer/DMA 1 Exception An exception is any condition that needs to halt normal execution of the instructions Examples - Reset - HWI - SWI 2 Interrupt Hardware interrupt Software interrupt Trap
More informationELC4438: Embedded System Design ARM Cortex-M Architecture II
ELC4438: Embedded System Design ARM Cortex-M Architecture II Liang Dong Electrical and Computer Engineering Baylor University Memory system The memory systems in microcontrollers often contain two or more
More informationEE319K Spring 2015 Exam 1 Page 1. Exam 1. Date: Feb 26, 2015
EE319K Spring 2015 Exam 1 Page 1 Exam 1 Date: Feb 26, 2015 UT EID: Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will you help
More informationInput/Output Programming
Input/Output Programming Chapter 3: Section 3.1, 3.2 Input and output (I/O) programming Communicating with I/O devices Busy-wait I/O Interrupt-driven I/O I/O devices Devices may include digital and non-digital
More informationThe ARM Cortex-M0 Processor Architecture Part-2
The ARM Cortex-M0 Processor Architecture Part-2 1 Module Syllabus ARM Cortex-M0 Processor Instruction Set ARM and Thumb Instruction Set Cortex-M0 Instruction Set Data Accessing Instructions Arithmetic
More informationECE 362 Experiment 4: Interrupts
ECE 362 Experiment 4: Interrupts 1.0 Introduction Microprocessors consistently follow a straight sequence of instructions, and you have likely only worked with this kind of programming until now. In this
More informationExam 1. Date: February 23, 2016
Exam 1 Date: February 23, 2016 UT EID: Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will you help others to cheat on this exam:
More informationEE251: Tuesday December 4
EE251: Tuesday December 4 Memory Subsystem continued Timing requirements Adding memory beyond 4 Gbyte Time Allowing: Begin Review for Final Exam Homework #9 due Thursday at beginning of class Friday is
More informationEECS 373 Fall 2018 Homework #3
EECS 373 Fall 2018 Homework #3 Answers 1) Loaders, Linkers and Executables a) In straightforward English, explain the role of a linker. [7 points] A linker receives object files as input and must emit
More informationEE319K Spring 2016 Exam 1 Solution Page 1. Exam 1. Date: Feb 25, UT EID: Solution Professor (circle): Janapa Reddi, Tiwari, Valvano, Yerraballi
EE319K Spring 2016 Exam 1 Solution Page 1 Exam 1 Date: Feb 25, 2016 UT EID: Solution Professor (circle): Janapa Reddi, Tiwari, Valvano, Yerraballi Printed Name: Last, First Your signature is your promise
More informationDesign and development of embedded systems for the Internet of Things (IoT) Fabio Angeletti Fabrizio Gattuso
Design and development of embedded systems for the Internet of Things (IoT) Fabio Angeletti Fabrizio Gattuso Microcontroller It is essentially a small computer on a chip Like any computer, it has memory,
More informationCOEN-4720 Embedded Systems Design Lecture 4 Interrupts (Part 1) Cristinel Ababei Dept. of Electrical and Computer Engineering Marquette University
COEN-4720 Embedded Systems Design Lecture 4 Interrupts (Part 1) Cristinel Ababei Dept. of Electrical and Computer Engineering Marquette University Outline Introduction NVIC and Interrupt Control Interrupt
More informationEE319K Exam 1 Summer 2014 Page 1. Exam 1. Date: July 9, Printed Name:
EE319K Exam 1 Summer 2014 Page 1 Exam 1 Date: July 9, 2014 UT EID: Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will you help
More informationExam 1. Date: February 23, 2018
Exam 1 Date: February 23, 2018 UT EID: Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will you help others to cheat on this exam:
More informationoriginal M68K requests/priorities Interrupts to execute important code interrupts (n will always be I) I-bits bits in SR accomplish this
Coldfire / M68K Interrupts EE 5 Unit 1b Interrupts Timers Coldfire interrupt architecture is based on original M68K -bit input (IPL[2:]) indicating interrupt requests/priorities = No interrupt t 1-111
More informationMark Redekopp, All rights reserved. EE 357 Unit 10b. Interrupts Timers
EE 357 Unit 10b Interrupts Timers IPL bits Coldfire / M68K Interrupts Coldfire interrupt architecture is based on original M68K 3-bit input (IPL[2:0]) indicating interrupt requests/priorities 000 = No
More informationMicrocomputer Interfacing Lab 3 Interrupts in ARM ANGUS GALLOWAY
Microcomputer Interfacing Lab 3 Interrupts in ARM ANGUS GALLOWAY The Goal: Convert a KSDK project with interrupts into ARM assembly FOR THE ARMASM ASSEMBLER USED BY KEIL Why learn ARM? ARM doesn t build
More informationEmbedded Systems. October 2, 2017
15-348 Embedded Systems October 2, 2017 Announcements Read pages 267 275 The Plan! Timers and Counter Interrupts A little review of timers How do we keep track of seconds using a timer? We have several
More informationARM Embedded Systems: ARM Design philosophy, Embedded System Hardware, Embedded System Software
Department of Technical Education DIPLOMA COURSE IN ELECTRONICS AND COMMUNICATION ENGINEERING Sixth Semester ARM MICROCONTROLLER Contact Hours/Week : 04 Contact Hours/Semester : 64 CONTENTS Unit-I No.
More informationARM PROGRAMMING. When use assembly
ARM PROGRAMMING Bùi Quốc Bảo When use assembly Functions that cannot be implemented in C, such as special register accesses and exclusive accesses Timing-critical routines Tight memory requirements, causing
More informationIntroduction to C. Write a main() function that swaps the contents of two integer variables x and y.
Introduction to C Write a main() function that swaps the contents of two integer variables x and y. void main(void){ int a = 10; int b = 20; a = b; b = a; } 1 Introduction to C Write a main() function
More informationCMPSCI 201 Fall 2004 Midterm #2 Answers
CMPSCI 201 Fall 2004 Midterm #2 Answers Professor William T. Verts 15 Points You should be quite familiar by now with the single-precision floating point numeric format (one 32-bit word containing
More informationMICROPROCESSOR TECHNOLOGY
MICROPROCESSOR TECHNOLOGY Assis. Prof. Hossam El-Din Moustafa Lecture 14 Ch.6 The 80186, 80188, and 80286 Microprocessors 21-Apr-15 1 Timers The 80186/80188 contain three fully programmable 16-bit timers
More informationLAB 1 Using Visual Emulator. Download the emulator https://salmanarif.bitbucket.io/visual/downloads.html Answer to questions (Q)
LAB 1 Using Visual Emulator Download the emulator https://salmanarif.bitbucket.io/visual/downloads.html Answer to questions (Q) Load the following Program in Visual Emulator ; The purpose of this program
More informationBy the end of Class. Outline. Homework 5. C8051F020 Block Diagram (pg 18) Pseudo-code for Lab 1-2 due as part of prelab
By the end of Class Pseudo-code for Lab 1-2 due as part of prelab Homework #5 on website due before next class Outline Introduce Lab 1-2 Counting Timers on C8051 Interrupts Laboratory Worksheet #05 Copy
More informationDE0-Nano-SoC Computer System with ARM Cortex-A9. 1 Introduction. 2 DE0-Nano-SoC Computer Contents. 2.1 Hard Processor System. For Quartus Prime 16.
DE0-Nano-SoC Computer System with ARM Cortex-A9 For Quartus Prime 16.0 1 Introduction This document describes a computer system that can be implemented on the Altera DE0-Nano-SoC development and education
More informationE85 Lab 8: Assembly Language
E85 Lab 8: Assembly Language E85 Spring 2016 Due: 4/6/16 Overview: This lab is focused on assembly programming. Assembly language serves as a bridge between the machine code we will need to understand
More informationEE 354 Fall 2015 Lecture 1 Architecture and Introduction
EE 354 Fall 2015 Lecture 1 Architecture and Introduction Note: Much of these notes are taken from the book: The definitive Guide to ARM Cortex M3 and Cortex M4 Processors by Joseph Yiu, third edition,
More informationExam 1. Date: March 1, 2019
Exam 1 Date: March 1, 2019 UT EID: Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will you help others to cheat on this exam: Signature:
More informationOverview of Microcontroller and Embedded Systems
UNIT-III Overview of Microcontroller and Embedded Systems Embedded Hardware and Various Building Blocks: The basic hardware components of an embedded system shown in a block diagram in below figure. These
More informationEECS 373 Practice Midterm / Homework #3 Fall 2014
Exam #: EECS 373 Practice Midterm / Homework #3 Fall 2014 Name: Uniquename: Sign the honor code: I have neither given nor received aid on this exam nor observed anyone else doing so. Scores: Problem #
More informationEMBEDDED SYSTEMS: Jonathan W. Valvano INTRODUCTION TO THE MSP432 MICROCONTROLLER. Volume 1 First Edition June 2015
EMBEDDED SYSTEMS: INTRODUCTION TO THE MSP432 MICROCONTROLLER Volume 1 First Edition June 2015 Jonathan W. Valvano ii Jonathan Valvano First edition 3 rd printing June 2015 The true engineering experience
More informationUniversity of Texas at Austin Electrical and Computer Engineering Department. EE319K, Embedded Systems, Spring 2013 Final Exam
University of Texas at Austin Electrical and Computer Engineering Department EE319K, Embedded Systems, Spring 2013 Final Exam Directions There are 6 problems worth a total of 100 points. The number of
More informationTimer 32. Last updated 8/7/18
Last updated 8/7/18 Basic Timer Function Delay Counter Load a value into a counter register The counter counts Down to zero (count down timer) Up from zero (count up timer) An action is triggered when
More informationEE445M/EE380L.6 Quiz 2 Spring 2017 Solution Page 1 of 5
EE445M/EE380L.6 Quiz 2 Spring 2017 Solution Page 1 of 5 First Name: Last Name: April 21, 2017, 10:00 to 10:50am Open book, open notes, calculator (no laptops, phones, devices with screens larger than a
More informationEE4144: ARM Cortex-M Processor
EE4144: ARM Cortex-M Processor EE4144 Fall 2014 EE4144 EE4144: ARM Cortex-M Processor Fall 2014 1 / 10 ARM Cortex-M 32-bit RISC processor Cortex-M4F Cortex-M3 + DSP instructions + floating point unit (FPU)
More informationDE1-SoC Computer System with ARM Cortex-A9. 1 Introduction. 2 DE1-SoC Computer Contents. 2.1 Hard Processor System. For Quartus Prime 16.
DE1-SoC Computer System with ARM Cortex-A9 For Quartus Prime 16.1 1 Introduction This document describes a computer system that can be implemented on the Intel DE1-SoC development and education board.
More informationCENG-336 Introduction to Embedded Systems Development. Timers
CENG-336 Introduction to Embedded Systems Development Timers Definitions A counter counts (possibly asynchronous) input pulses from an external signal A timer counts pulses of a fixed, known frequency
More informationAN10254 Philips ARM LPC microcontroller family
Rev. 02 25 October 2004 Application note Document information Info Content Keywords ARM LPC, Timer 1 Abstract Simple interrupt handling using Timer 1 peripheral on the ARM LPC device is shown in this application
More informationMicroprocessors & Interfacing
Lecture Overview Microprocessors & Interfacing Interrupts (I) Lecturer : Dr. Annie Guo Introduction to Interrupts Interrupt system specifications Multiple sources of interrupts Interrupt priorities Interrupts
More informationLecture-55 System Interface:
Lecture-55 System Interface: To interface 8253 with 8085A processor, CS signal is to be generated. Whenever CS =0, chip is selected and depending upon A 1 and A 0 one of the internal registers is selected
More informationInterrupts (I) Lecturer: Sri Notes by Annie Guo. Week8 1
Interrupts (I) Lecturer: Sri Notes by Annie Guo Week8 1 Lecture overview Introduction to Interrupts Interrupt system specifications Multiple Sources of Interrupts Interrupt Priorities Interrupts in AVR
More informationECE 598 Advanced Operating Systems Lecture 8
ECE 598 Advanced Operating Systems Lecture 8 Vince Weaver http://www.eece.maine.edu/~vweaver vincent.weaver@maine.edu 11 February 2016 Homework #3 Due. Announcements Homework #4 Posted Soon 1 HW#3 Comments
More information(5) Question 2. Give the two most important factors for effective debugging. Jonathan W. Valvano
EE445M/EE380L Quiz 1 Spring 2013 Page 1 of 5 First Name: Last Name: March 1, 2013, 10:00 to 10:50am Quiz 1 is a closed book exam. You may have one 8.5 by 11 inch sheet of hand-written crib notes, but no
More informationUNIT II SYSTEM BUS STRUCTURE 1. Differentiate between minimum and maximum mode 2. Give any four pin definitions for the minimum mode. 3. What are the pins that are used to indicate the type of transfer
More informationVariations on a Theme
Variations on a Theme Shlomo Engelberg December 27, 2013 1 Chapter 6 of ADuC841 Microcontroller Design Manual: From Microcontroller Theory to Design Projects No variations in this chapter are planned for
More informationLAB4. Program the on chip SPI module
LAB4 Program the on chip SPI module Outline Learn to utilize the on-chip SPI module Implement it in C Translate it to ARM Assembly Test and verify the result using oscilloscope and shift register. Serial
More information8254 is a programmable interval timer. Which is widely used in clock driven digital circuits. with out timer there will not be proper synchronization
8254 is a programmable interval timer. Which is widely used in clock driven digital circuits. with out timer there will not be proper synchronization between two devices. So it is very useful chip. The
More informationELEC 3040/3050 Lab 5. Matrix Keypad Interface Using Parallel I/O
ELEC 3040/3050 Lab 5 Matrix Keypad Interface Using Parallel I/O Goals of this lab exercise Control a real device with the microcontroller Coordinate parallel I/O ports to control and access a device Implement
More informationModes and Levels. Registers. Registers. Cortex-M3 programming
Modes and Levels Cortex-M3 programming Texas Instruments, www.ti.com CortexM3InstructionSet.pdf STMicroelectronics, www.st.com CortexM3Programmer.pdf PM0056 Registers Registers R0-R3 parameters R4-R11
More informationChapters 5. Load & Store. Embedded Systems with ARM Cortex-M. Updated: Thursday, March 1, 2018
Chapters 5 Load & Store Embedded Systems with ARM Cortex-M Updated: Thursday, March 1, 2018 Overview: Part I Machine Codes Branches and Offsets Subroutine Time Delay 2 32-Bit ARM Vs. 16/32-Bit THUMB2 Assembly
More informationMicrocontroller & Interfacing
Course Title Course Code Microcontroller & Interfacing EC406 Lecture : 3 Course Credit Practical : 1 Tutorial : 0 Total : 4 Course Objective At the end of the course the students will be able to Understand
More informationECE 598 Advanced Operating Systems Lecture 8
ECE 598 Advanced Operating Systems Lecture 8 Vince Weaver http://web.eece.maine.edu/~vweaver vincent.weaver@maine.edu 15 February 2018 Homework #3 Due. Announcements Homework #4 Posted Soon 1 (Review)
More informationMigrating ARM7 Code to a Cortex-M3 MCU By Todd Hixon, Atmel
Migrating ARM7 Code to a Cortex-M3 MCU By Todd Hixon, Atmel The ARM Cortex-M3 core has enhancements to its architecture that result in increased code execution speed, lower power consumption, and easier
More informationARM Assembly Programming
Introduction ARM Assembly Programming The ARM processor is very easy to program at the assembly level. (It is a RISC) We will learn ARM assembly programming at the user level and run it on a GBA emulator.
More informationSystems Programming. Lecture 11 Timers
Systems Programming www.atomicrhubarb.com/systems Lecture 11 Timers Section Topic Where in the books Zilog PS220 (ZNEO Z16F Series Product Specification) What is a Timer (a microcontroller timer) Timers
More informationReal Time Operating Systems
Real Time Operating Systems Terminology uc/os-iii, The Real-Time Kernel, or a High Performance, Scalable, ROMable, Preemptive, Multitasking Kernel for Microprocessors, Microcontrollers & DSPs, Book & Board
More informationVE7104/INTRODUCTION TO EMBEDDED CONTROLLERS UNIT III ARM BASED MICROCONTROLLERS
VE7104/INTRODUCTION TO EMBEDDED CONTROLLERS UNIT III ARM BASED MICROCONTROLLERS Introduction to 32 bit Processors, ARM Architecture, ARM cortex M3, 32 bit ARM Instruction set, Thumb Instruction set, Exception
More informationLab 9: On-Board Time Generation and Interrupts
Lab 9: On-Board Time Generation and Interrupts Summary: Develop a program and hardware interface that will utilize externally triggered interrupts and the onboard timer functions of the 68HC12. Learning
More informationMicroprocessors B (17.384) Spring Lecture Outline
Microprocessors B (17.384) Spring 2013 Lecture Outline Class # 04 February 12, 2013 Dohn Bowden 1 Today s Lecture Administrative Microcontroller Hardware and/or Interface Programming/Software Lab Homework
More informationInterrupts (Exceptions) (From LM3S1968) Gary J. Minden August 29, 2016
Interrupts (Exceptions) (From LM3S1968) Gary J. Minden August 29, 2016 1 Interrupts Motivation Implementation Material from Stellaris LM3S1968 Micro-controller Datasheet Sections 2.5 and 2.6 2 Motivation
More informationExceptions and Interrupts ARM Cortex M3
Exceptions and Interrupts ARM Cortex M3 ผศ.ดร. ส ร นทร ก ตต ธรก ล และ อ.สรย ทธ กลมกล อม 1 Introduction! Exception are events! They occur during the execution of the program! ARM exceptions! Exceptions
More informationFinal Exam. Date: May 12, 2017
Final Exam Date: May 12, 2017 UT EID: Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will you help others to cheat on this exam:
More informationChapter 6 PROGRAMMING THE TIMERS
Chapter 6 PROGRAMMING THE TIMERS Lesson 3 Real Time Clocked Interrupts and Software Timers 2 Real Time Clock Interrupt 3 Real Time interrupts Prescaling Pre-scaling by RT1-RT0 bits for 4 or 8 or 16 2 13
More informationReferences & Terminology
, 2/22/2018 Embedded and Real-Time Systems/ Real-Time Operating Systems : RTOS, OS Kernel, Operating Modes, Context Switch 1 References & Terminology μc/os-iii, The Real-Time Kernel, or a High Performance,
More informationCprE 288 Introduction to Embedded Systems Course Review for Exam 3. Instructors: Dr. Phillip Jones
CprE 288 Introduction to Embedded Systems Course Review for Exam 3 Instructors: Dr. Phillip Jones 1 Announcements Exam 3: See course website for day/time. Exam 3 location: Our regular classroom Allowed
More informationELEC 3040/3050 Lab 5. Matrix Keypad Interface Using Parallel I/O
ELEC 3040/3050 Lab 5 Matrix Keypad Interface Using Parallel I/O Goals of this lab exercise Control a real device with the microcontroller Coordinate parallel I/O ports to control and access a device Implement
More informationUnderstanding the basic building blocks of a microcontroller device in general. Knows the terminologies like embedded and external memory devices,
Understanding the basic building blocks of a microcontroller device in general. Knows the terminologies like embedded and external memory devices, CISC and RISC processors etc. Knows the architecture and
More informationQuestion Bank Microprocessor and Microcontroller
QUESTION BANK - 2 PART A 1. What is cycle stealing? (K1-CO3) During any given bus cycle, one of the system components connected to the system bus is given control of the bus. This component is said to
More informationExercise 4-1. DSP Peripherals EXERCISE OBJECTIVES
Exercise 4-1 DSP Peripherals EXERCISE OBJECTIVES Upon completion of this exercise, you will be familiar with the specialized peripherals used by DSPs. DISCUSSION The peripherals found on the TMS320C50
More informationIntroduction to Embedded Systems
Stefan Kowalewski, 4. November 25 Introduction to Embedded Systems Part 2: Microcontrollers. Basics 2. Structure/elements 3. Digital I/O 4. Interrupts 5. Timers/Counters Introduction to Embedded Systems
More informationDepartment of Electronics and Instrumentation Engineering Question Bank
www.examquestionpaper.in Department of Electronics and Instrumentation Engineering Question Bank SUBJECT CODE / NAME: ET7102 / MICROCONTROLLER BASED SYSTEM DESIGN BRANCH : M.E. (C&I) YEAR / SEM : I / I
More informationCOEN-4720 Embedded Systems Design Lecture 3 Intro to ARM Cortex-M3 (CM3) and LPC17xx MCU
COEN-4720 Embedded Systems Design Lecture 3 Intro to ARM Cortex-M3 (CM3) and LPC17xx MCU Cristinel Ababei Dept. of Electrical and Computer Engineering Marquette University Outline Overview of ARM Cortex-M3
More informationAN316 Determining the stack usage of applications
Determining the stack usage of applications AN 316, Summer 2018, V 1.0 feedback@keil.com Abstract Determining the required stack sizes for a software project is a crucial part of the development process.
More informationLaboratory Exercise 4
Laboratory Exercise Input/Output in an Embedded System The purpose of this exercise is to investigate the use of devices that provide input and output capabilities for a processor. There are two basic
More informationInterrupts and Low Power Features
ARM University Program 1 Copyright ARM Ltd 2013 Interrupts and Low Power Features Module Syllabus Interrupts What are interrupts? Why use interrupts? Interrupts Entering an Exception Handler Exiting an
More informationModule Introduction. PURPOSE: The intent of this module is to explain MCU processing of reset and interrupt exception events.
Module Introduction PURPOSE: The intent of this module is to explain MCU processing of reset and interrupt exception events. OBJECTIVES: - Describe the difference between resets and interrupts. - Identify
More information