Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer System Laboratory

Similar presentations


Presentation on theme: "Computer System Laboratory"— Presentation transcript:

1 Computer System Laboratory
Lab8 – Interrupt + Timer 2018/11/13 /13 Lab 10

2 Experimental Goal Understand the hardware timer, the system timer and also learn how to control 7 segment LED and LCD to display the time. 2018/11/13 /13

3 Environment Host System Build System Target System Software
Windows XP Build System IAR Embedded Workbench+ Ubuntu 8.04 Target System PTK development board (STM32F207) Software PTK Examples version 2 – Micrium added. You can download all software from CSL Course Software. 2018/11/13 /13 Lab 10

4 Introduction to Interrupt
An interrupt is a signal to the processor. The processor responds by suspending its current activities, saving its state, and executing a small program called an interrupt handler (interrupt service routine, ISR) to deal with the event. The act of initiating a hardware interrupt is referred to as an interrupt request (IRQ). Interrupts are a commonly used technique for computer multitasking. Reference: wiki info: interrupt, 2018/11/13 /13

5 Two Types of Interrupt Asynchronous interrupt: caused by an external event. Maskable interrupt (IRQ) E.g., I/O request Non-maskable interrupt E.g., watchdog timer Synchronous interrupt (Exception) Faults E.g., page fault Traps E.g., divide by zero Aborts E.g., machine check Software interrupt E.g., system call Reference: Daniel P. Bovert & Marco Cesati, “Understanding the Linux Kernel 3rd”, chapter 4, O’Reilly 2018/11/13 /13

6 Interrupt Routing In ARM Cortex-M series processor use the Nested Vectored Interrupt Controller (NVIC) to group the device interrupts together before passing on the signal to a single interrupt pin on the CPU. Reference: 2018/11/13 /13

7 System Tick in μCOS-II System tick is the software timer used by OS to represent a computer system's notion of the passing of time. uCOS II set the number of system ticks per seconds by function OS_CPU_SysTickInit (). Every system tick an interrupt is triggered, μCOS-II calls OS_CPU_SysTickHandler () to do some work. You can trace the code mentioned later at p.12 for more understanding about this. 2018/11/13 /13

8 Introduction to Timer Computer systems usually have at least one timer. These are typically digital counters that decrement at a fixed frequency, which are often configurable and interrupt the processor when reaching zero. As the number of hardware timers in a computer system or processor is finite, OSes often use a single hardware timer to implement an extensible set of software timers. Some timer devices count up instead of down and have a register whose value is compared with the counter to determine when to interrupt and restart the count at zero. Reference: wiki info: timer, 2018/11/13 /13

9 Timer The oscillator provides a fixed input frequency to the timer device, and the counter counts down one unit for each cycle of the oscillator. When it reaches zero, it generates an interrupt signal. There might also be a counter input register whose value is loaded into the counter when it reaches zero. Reference: VMWare, “Timekeeping in VMware Virtual Machines”, 2018/11/13 /13

10 Software timer provided by μCOS-II
OSTmrCreate() - Create and specify the operating mode of the timer. OSTmrStart() - Start (or restart) a timer. OSTmrStop() - Stop the countdown process of a timer. OSTmrDel() - Delete a timer. There are three types/modes of such OS Timer: One-Shot Timers Periodic (no initial delay) Periodic (with initial delay) Source: It’s well documented officially; please read it for more detailed understanding about the μCOS-II OS Timer; e.g., the APIs, data structures and system functions used. Utilize Go to definition and Find All References provided by IAR to help you understand better how it works. 2018/11/13 /13

11 Software timer provided by μCOS-II (Cont’d)
os.cfg.h #define OS_TICKS_PER_SEC #define OS_TMR_CFG_TICKS_PER_SEC 10 You should be able to find the above configuration via the given code- tracing instrument in IAR. 2018/11/13 /13

12 Lab Steps Try …\OS_None\base_7seg\demo.eww, and use …\OS_uCOS-II\base_uart\demo.eww as the base. Modify the source codes of OS_uCOS-II\base_uart such that the 7- segment LED counts one cycle at a time, using the OS Timer introduced earlier. 16 seconds per cycle – one hexadecimal digit. Any other numeral systems are ok. 2018/11/13 /13

13 Lab Requirement Show the time going counted at the last page in the format “MM:SS” on the UART console. Could you achieve this by using OS Timer? Report your observation. 2018/11/13 /13


Download ppt "Computer System Laboratory"

Similar presentations


Ads by Google