2/26/2015 Richard Kuo Assistant Professor

Slides:



Advertisements
Similar presentations
Introduction of Holtek HT-46 series MCU
Advertisements

PING))) Ultrasonic Distance Sensor living with the lab ultrasonic pressure waves from PING))) speaker The PING))) sensor emits short bursts of sound and.
Department of Electrical Engineering Southern Taiwan University of Science and Technology Robot and Servo Drive Lab. 2015/7/2 Digital Control Strategy.
Ultrasonic Sensor HC-SR04
1 Ultrasonic Distance Sensor. 2 How it Works The distance sensor emits short bursts of sound and listens for this sound to echo off of nearby objects.
Lecture 13: TI MSP430 Watchdog Timer and Real-Time Clock
The 8051 Microcontroller architecture
Department of Electrical Engineering, National Taiwan Ocean University NuMicro Learning Board Introduction 1/29/2015 Richard Kuo Assistant.
Pulse Width Modulation
Sensors. This is a set of transmitter and receiver in one of the photoelectric sensor. Detection distance can be adjusted according to the requirements.
7/23 Timers in Coldfire Processor Computer Science & Engineering Department Arizona State University Tempe, AZ Dr. Yann-Hang Lee (480)
RC CAR CONTROLLER BASED ON INTEL GALILEO SOC PLATFORM Nadav Shiloach Sagi Sabag Supervisor: Idan Shmuel Spring 2014 One Semester Project PROJECT’S ENDING.
ARM Timers.
1 4-Integrating Peripherals in Embedded Systems. 2 Introduction Single-purpose processors  Performs specific computation task  Custom single-purpose.
System Clocks.
ECE 353 Introduction to Microprocessor Systems Michael G. Morrow, P.E. Week 8.
Timers ELEC 330 Digital Systems Engineering Dr. Ron Hayne
Department of Electrical Engineering, National Taiwan Ocean University Pulse Width Modulation 4/25/2013 Richard Kuo Assistant Professor.
AT91 Embedded Peripherals
UART: Universal Asynchronous RX/TX
ECE 447 Fall 2009 Lecture 10: TI MSP430 Timers and Capture Modes.
Cortex-M0 MCU Interface and Driver Design - Course Overview
Timers.
© 2009, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction  Purpose This course provides an introduction to the peripheral functions.
ECE 447: Lecture 8 Timer System (1). ECE 447: 68HC11 Timer System 1.Generating delays - imposing a specific delay between two points in the program by.
Department of Electrical Engineering, National Taiwan Ocean University Timer/WatchDog /RTC 4/11/2013 Richard Kuo Assistant Professor.
Timer Timer is a device, which counts the input at regular interval (δT) using clock pulses at its input. The counts increment on each pulse and store.
CCP MODULES  The CCP module (Capture/Compare/PWM) is a peripheral which allows the user to time and control different events.  Capture Mode provides.
3/23/2015 Richard Kuo Assistant Professor
Embedded Systems Design: A Unified Hardware/Software Introduction 1 Chapter 4 Standard Single Purpose Processors: Peripherals.
8254 Timer.
Sonar Sensor Project Polaroid Sonar Sensor Details of the Project
1 68HC11 Timer HC11 or HC12: Chapter HC11 Timer Subsystem  Several timing functions: Basic timing Basic timing Real time interrupts Real time.
RTLS. LOCATING / POSITIONING SYSTEMS A positioning system is a mechanism for determining the location of an object in space Interplanetary systems Global.
Real Time Interrupts Section Real-Time Interrupt (RTI) Most operating systems (OS) require an interrupt every T seconds by the RTI RTI interrupts.
© 2009, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction  Purpose This course provides an introduction to the peripheral functions.
Network and Systems Laboratory nslab.ee.ntu.edu.tw.
TechKnowTone Contents: Sensor Features Sensor Connections Sample Sketch Questions …Sensor Features… Arduino Coding – Distance Sensors.
1 68HC11 Timer. 2 68HC11 Timer Subsystem Several timing functions: Basic timing Basic timing Real time interrupts Real time interrupts Output compare.
Istituto Tecnico Industriale A.Monaco EURLAB Object Detection Object Detection by Ultrasonic How to install and program a ultra sonic sensor with Arduino.
Istituto Tecnico Industriale A.Monaco EURLAB Object Detection Object Detection by Ultrasonic How to install and program a ultra sonic sensor with Arduino.
1 4-Integrating Peripherals in Embedded Systems. 2 Introduction Single-purpose processors  Performs specific computation task  Custom single-purpose.
TM Freescale Confidential Proprietary Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names.
RASH DRIVING WARNING SYSTEM FOR HIGHWAY POLICE
Why are Timer Functions Important?
Lecture 10: TI MSP430 Timers and Capture Modes
Serial Peripheral Interface
Application Case Study Security Camera Controller
Prof. Sajid Naeem (DOES – PC)
Pulse Width Modulation
REMOTE JAMMING DEVICE.
Cortex-M0 MCU Clocks & Pins
ULTRASONIC DISTANCE METER USING 8051
Analog-to-Digital Converter (ADC)
ECE 353 Introduction to Microprocessor Systems
ECE 353 Introduction to Microprocessor Systems
NuMicro MCU New Project Express Creation
4-Integrating Peripherals in Embedded Systems
4-Integrating Peripherals in Embedded Systems
RX Watchdog Timer (WDT)
Programmable Interval Timer
WALL DETECTOR ROBOT VEHICLE
Maxbotix Ultrasonic Distance Sensor
Timers.
Device Fabrication & Components Conclusions and Future Advancements
Elecbits.
MCO556 Timer System Exercise.
Programmable Interval Timer
Sound Waves and Ultrasound
Presentation transcript:

2/26/2015 Richard Kuo Assistant Professor Timer/WatchDog /RTC 2/26/2015 Richard Kuo Assistant Professor

Outline 6.0 NuMicro_Timer.ppt Timer/WatchDog/RTC Introduction Exercise Timers Lab. Periodic mode (smpl_Timer_LED) Lab. One timer Multiple counter (smpl_Timer_Counter) Lab. One timer Multiple modes (smpl_Timer_LCD) Exercise Timer Capture pin Lab. Ultrasonic Sensor module (smpl_Timer_SR04) Exercise Watch-Dog Timer Lab. Watch-Dog Timer (smpl_WDT) Exercise Real-Time Clock Lab. Real Time Clock (smpl_RTC) Homework : Car Parking Sensor

Timer Features Four 24-bit up-counting timer A prescaler (divider) for each Timer Selectable 5 clock source Four modes : one shot, periodic, toggle, continuous Timeout Period calculation Time out period = (Period of timer clock input) * (8-bit Prescale + 1) * (24-bit TCMP)

Nano100 Timer Clock Source

Nano100 Timer Block Diagram

NUC100 Timer Clock Source HIRC HCLK LIRC HXT

NUC100 Timer Block Diagram

Timer operation modes Example: TCMPR = 100 One-Shot mode Periodic mode Continuous Counting mode Interrupt 100 One shot Reset counter Periodic 100 Overflow 100 101 224-1 Continuous

smpl_Timer_LED volatile uint8_t ledState =0; void TMR1_IRQHandler(void) { ledState = ~ ledState; // changing ON/OFF state if(ledState) PC12=0; else PC12=1; TIMER_ClearIntFlag(TIMER1); // Clear Timer1 time-out interrupt flag }

smpl_Timer_LCD

smpl_Timer_SR04 Ultrasonic Sensor HC-SR04 VCC5 to VCC GND to GND GPB2 to Echo GPB4 to Trig

Ultrasonic Ranging Module SR04 Item Specification Working Voltage DC 5V Working Current 15mA Working Frequency 40Hz Max. Range 4 m Min. Range 2 cm Measuring Angle 15 degree Trigger Input 10 us TTL pulse Echo Output TTL level

Ultrasonic Sensor Waveform

Ultrasonic Ranging Module SR04 supply a short 10uS pulse to the trigger input to start the ranging, then the module will send out an 8 cycle burst of ultrasound at 40 kHz and raise its echo The Echo is a distance object that is pulse width and the range in proportion Equation : Distance = (Echo_Pulse [us] * 340/2 [Meter] ) / 1000 …… (Unit: mm) Example : Echo Pulse: 11245 us, Velocity of Sound: 340m/s Distance = (11245 * 340/2) / 1000 = 1911 (Unit: mm) over 60ms measurement cycle is suggested, in order to prevent trigger signal to the echo signal. Ultrasound Speed : V = 331.4 + 0.607 * T

Ultrasound Sensor Ranger Principle 。 Ultrasound Sensor Ranger Principle Ultrasound Sensor Ranging the distance by measuring the time from transmitting 40KHz wave to received 40KHz wave, Ultrasound Speed : V = 331.4 + 0.607 * T T : temperature C0 : speed at absolute zero degree Distance t: travel time from sound wave transmitted to the reflection received

WatchDog Timer 18-bit up counter 8 selections of time out period Support function: WDT interrupt WDT reset WDT wakeup

NUC100 WDT Clock

Watchdog controller Block Diagram

Watchdog Timer Interrupt & Reset signals

Windowed Watchdog controller Block Diagram

Nano100 WDT Time out Interval selection

Nano100 WWDT pre-scaler selection

NUC100 WDT Time out selection WTIS Interrupt Timeout Watchdog Reset Timeout WTR Timeout Interval for Reset (WDT_CLK=12MHz) WTR Timeout Interval for Reset (WDT_CLK=32KHz) 000 24 WDT_CLK (16 WDT_CLK) (24 + 1024) WDT_CLK (1040 WDT_CLK) 86.67us 32.5 ms 001 26 WDT_CLK (26 + 1024) WDT_CLK 90.67 us 34 ms 010 28 WDT_CLK (28 + 1024) 106.67 us 40 ms 011 210 WDT_CLK (210 + 1024) WDT_CLK 170.67 us 64 ms 100 212 WDT_CLK (212 + 1024) WDT_CLK 426.67 us 160 ms 101 214 WDT_CLK (214 + 1024) WDT_CLK 1.45 ms 544 ms 110 216 WDT_CLK (216 + 1024) WDT_CLK 5.55 ms 2080 ms 111 218 WDT_CLK (218 + 1024) WDT_CLK 21.93 ms 8224 ms `

smpl_WDT

RTC Features TLR=0x00093043 CLR=0x00120229 RTC counter A set of Alarm Time counter Calendar counter Day of week Leap year BCD format TLR=0x00093043 CLR=0x00120229 A set of Alarm Alarm and time tick interrupt Wakeup function 32KHz compensation

RTC Block Diagram INIR (0xA5EB1357) AER (0xA965) 512 RTC clock ≒15msec

RTC Example RTC sample code with driver RTC sample code Enable RTC and set date and time Date: 2009.1.19 Time:13.20.00 Enable alarm interrupt and set alarm date and time Alarm date:2009.1.19 Alarm Time:13.20.10 RTC sample code The same flow

Smpl_RTC

smpl_Timer_WDT_RTC

Car Parking Sensor

Important Notice ! This educational material are neither intended nor warranted for usage in systems or equipment, any malfunction or failure of which may cause loss of human life, bodily injury or severe property damage. Such applications are deemed, “Insecure Usage”. Insecure usage includes, but is not limited to: equipment for surgical implementation, atomic energy control instruments, airplane or spaceship instruments, the control or operation of dynamic, brake or safety systems designed for vehicular use, traffic signal instruments, all types of safety devices, and other applications intended to support or sustain life. All Insecure Usage shall be made at user’s own risk, and in the event that third parties lay claims to the author as a result of customer’s Insecure Usage, the user shall indemnify the damages and liabilities thus incurred by using this material. Please note that all lecture and sample codes are subject to change without notice. All the trademarks of products and companies mentioned in this material belong to their respective owners.