Timer & Watch Dog Test UNIT 16 로봇 SW 교육원 조용수. 학습 목표 Timer Init Timer Delay Test Timer Interrupt Test –One Shot Mode –Periodic Mode Watch Dog Test 시계 만들어.

Slides:



Advertisements
Similar presentations
UNIT 10 GPIO Test 로봇 SW 교육원 조용수.
Advertisements

Interrupt Test UNIT 14 로봇 SW 교육원 조용수. 학습 목표 Button Interrupt Uart Interrupt 2.
4-1 Timers Timers can be used for  timing  event counting  pulse width measurement  pulse generation  frequency multiplication There are 8 Timers.
C Examples 1.
The 8051 Microcontroller Chapter 5 SERIAL PORT OPERATION.
Computertechniek Hogeschool van Utrecht / Institute for Computer, Communication and Media Technology 1  pak het project tint.zip.
AD Converter UNIT 19 로봇 SW 교육원 조용수. 학습 목표 AD Converter AD Converter Register 2.
UNIT 20 AD Converter Test 로봇 SW 교육원 조용수.
8-Bit Timer/Counter 0 Counter/Timer 0 and 2 (TCNT0, TCNT2) are nearly identical. Differences: -TCNT0 can run off an external 32Khz clock (Tosc) or the.
5-1 Timer/Counters In many microprocessor systems we need to:  count logic pulses  measure the frequency of signals  measure the period of pulses 
Lecture 13: TI MSP430 Watchdog Timer and Real-Time Clock
LAB 7: WDT+ and Low-Power Optimization
I2C UNIT 23 로봇 SW 교육원 조용수. 학습 목표 I2C I2C Protocol 구조 N051 I2C 동작 I2C Register 2.
UART Test UNIT 14 로봇 SW 교육원 조용수. 학습 목표 UART Init UART Send UART Receive UART -> Debugging Console Up/Down Game 제작 2.
ECE 371- Unit 11 Timers and Counters (“Stop Watches and Alarm Clocks”)
7/23 Timers in Coldfire Processor Computer Science & Engineering Department Arizona State University Tempe, AZ Dr. Yann-Hang Lee (480)
2/26/2015 Richard Kuo Assistant Professor
ARM Timers.
1 4-Integrating Peripherals in Embedded Systems. 2 Introduction Single-purpose processors  Performs specific computation task  Custom single-purpose.
M Semiconductor Products Sector Computer Operating Properly Module Detail Slide #1 of 7 Tutorial Introduction PURPOSE -To explain how to configure and.
Timers ELEC 330 Digital Systems Engineering Dr. Ron Hayne
Timers The timers of the PIC16C7X microcontroller can be briefly described in only one sentence. There are three completely independent timers/counters.
Unit 10.2 Timer Examples. Example – Music Generation Channel 6 – Set up as a timer Output to Generate Square Waves Channel 4 – Set up as a timer Output.
Robotraffic software and programming aids Robotics Laboratory Faculty of Mechanical Engineering Technion Israel Institute of Technology.
PWM UNIT 17 로봇 SW 교육원 조용수. 학습 목표 PWM PWM Register 2.
FREQUENCY COUNTER USING Silicon Labs C8051F020 microcontroller
UNIT 29 MCU Project 로봇 SW 교육원 조용수.
© 2009, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction  Purpose This course provides an introduction to the peripheral functions.
C Examples 5. Download Links MPLAB IDE dsPIC30F4011/4012 Data Sheet dsPIC30F Family Reference Manual MikroC MikroC Manual MikroC Quick Reference.
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.
Embedded Systems Design: A Unified Hardware/Software Introduction 1 Chapter 4 Standard Single Purpose Processors: Peripherals.
UNIT 11 UART 로봇 SW 교육원 조용수.
SPI Test UNIT 26 로봇 SW 교육원 조용수. 학습 목표 SPI Sample SPI Read/Write Function SPI loop back Test MPL115A1 Pressure and Temperature Sensor 2.
Conclusion Speech. Content Organization Pronunciation Handwriting.
Saxion University of Applied Sciences Advanced Microcontrollers A practical approach.
Interrupts  An interrupt is any service request that causes the CPU to stop its current execution stream and to execute an instruction stream that services.
Real Time Interrupts Section Real-Time Interrupt (RTI) Most operating systems (OS) require an interrupt every T seconds by the RTI RTI interrupts.
Chapter 5 - Interrupts.
C Examples 1. Download Links MPLAB IDE dsPIC30F4011/4012 Data Sheet dsPIC30F Family Reference Manual MikroC MikroC Manual MikroC Quick Reference.
PWM Test 2 UNIT 20 로봇 SW 교육원 조용수. 학습 목표 PWM Servo 제어 2.
C Examples 1. Download Links dsPIC30F4011/4012 Data Sheet dsPIC30F4013/3014 dsPIC30F Family Reference Manual MikroC MikroC Manual MikroC Quick Reference.
8051 Aula 02 Prof Afonso Ferreira Miguel. Microcontrolador 8051 (MCS-51)  Timers do MCS51 Two 16-bit Counter/Timers: Two 16-bit Counter/Timers: Up counters,
System Control & Clock UNIT 08 로봇 SW 교육원 조용수. 학습 목표 System Control Register System Clock CMSIS CMSIS Project 2.
WCL 조윤정 Arduino Bootloader 코드 분석. BAUD_RATE 설정 /* set the UART baud rate defaults */ #ifndef BAUD_RATE #if F_CPU >= L #define BAUD_RATE.
1 68HC11 Timer. 2 68HC11 Timer Subsystem Several timing functions: Basic timing Basic timing Real time interrupts Real time interrupts Output compare.
Special Features. Device Configuration bits Revision Device Configuration bits Revision On-chip Power-on Reset (POR) Revision On-chip Power-on Reset (POR)
One more PIC18F252 example and revision for exam B222L Branislav Vuksanovic, UoP, ECE.
Microprocessors A practical approach..
1 4-Integrating Peripherals in Embedded Systems. 2 Introduction Single-purpose processors  Performs specific computation task  Custom single-purpose.
TIMERS.
PWM Test UNIT 20 로봇 SW 교육원 조용수. 학습 목표 PWM Init PWM LED 제어 2.
16F877A.
4-Integrating Peripherals in Embedded Systems
Timer Source: under
4-Integrating Peripherals in Embedded Systems
RX Watchdog Timer (WDT)
Refer to Chapter 3 in the reference book
8-Bit Timer/Counter 0 Counter/Timer 0 and 2 (TCNT0, TCNT2) are nearly identical. Differences: -TCNT0 can run off an external 32Khz clock (Tosc) or the.
Pugazhendhi.M 11/12/2018 TIMERS 11/12/2018 CCET CCET.
8051 Timers / Counters It has two timers Timer 0 and Timer 1.
8-bit Timer/Counter2 with PWM and Asynchronous Operation
전자의료시스템 및 실습 System Configuration/Interrupt
UNIT 19 PWM 로봇 SW 교육원 조용수.
UNIT 24 I2C Test 로봇 SW 교육원 조용수.
MCO556 Timer System Exercise.
Programmable Interval Timer
Embedded Systems Workshop 2
Timers Chapter 2.
Presentation transcript:

Timer & Watch Dog Test UNIT 16 로봇 SW 교육원 조용수

학습 목표 Timer Init Timer Delay Test Timer Interrupt Test –One Shot Mode –Periodic Mode Watch Dog Test 시계 만들어 보기 2

Timer Init Timer Clock Enable 3 void TMR0_Init(void) { CLK_EnableModuleClock(TMR0_MODULE); CLK_SetModuleClock(TMR0_MODULE, CLK_CLKSEL1_TMR0_S_HIRC, 4); }

Timer Delay Test Delay 함수 제작 Time-out period = (Period time of timer clock input) * (8-bit pre-scale counter + 1) * (24-bit TCMP) Timer 1ms Period Value = System Clock / (pre-scale + 1) / 1000 System Clock : 22,118,400 Hz 4

Timer Delay Test 5 int delay(int ms) { int prescaler =3; TIMER0->TCSR &=~(0xFF); TIMER0->TCSR |= prescaler; // Set Prescaler : 1ms period TIMER0->TCMPR = ms * (SystemCoreClock / (prescaler + 1)) / 1000; //printf("Timer Register TCSR = 0x%x\n", TIMER0->TCSR); //printf("Timer Register TCMPR = %d\n", TIMER0->TCMPR); TIMER0->TCSR &= ~(0x3 << 27) ; // One shot Mode TIMER0->TCSR |= (0x1 << 30 ); // Start Counting; while(TIMER0->TCSR & TIMER_TCSR_CACT_Msk); }

Timer Interrupt Test Timer Handler 6 void TMR0_IRQHandler(void) { /* Clears Timer time-out interrupt flag */ TIMER_ClearIntFlag(TIMER0); Count++; P2->DOUT &= ~0x7; if(Count > 0x7) { Count = 0x0; } P2->DOUT |= Count; }

Timer Interrupt Test One Shot Mode 7 void TMR0_Init(void) { CLK_EnableModuleClock(TMR0_MODULE); CLK_SetModuleClock(TMR0_MODULE, CLK_CLKSEL1_TMR0_S_HIRC, 4); TIMER_Open(TIMER0, TIMER_ONESHOT_MODE, 1); /* Enable the Timer time-out interrupt */ TIMER_EnableInt(TIMER0); /* Start Timer counting */ TIMER_Start(TIMER0); /* Enable TMR0 Interrupt */ NVIC_EnableIRQ(TMR0_IRQn); }

Timer Interrupt Test Periodic Mode 8 void TMR0_Init(void) { CLK_EnableModuleClock(TMR0_MODULE); CLK_SetModuleClock(TMR0_MODULE, CLK_CLKSEL1_TMR0_S_HIRC, 4); TIMER_Open(TIMER0, TIMER_PERIODIC_MODE, 1); /* Enable the Timer time-out interrupt */ TIMER_EnableInt(TIMER0); /* Start Timer counting */ TIMER_Start(TIMER0); /* Enable TMR0 Interrupt */ NVIC_EnableIRQ(TMR0_IRQn); }

Watch Dog Test Init 9 void WDT_Init(void) { SYS_UnlockReg(); CLK_EnableModuleClock(WDT_MODULE); CLK_SetModuleClock(WDT_MODULE, CLK_CLKSEL1_WDT_S_HCLK_DIV2048, 1); WDT->WTCR &= ~(0x7 << 8); WDT->WTCR |= (0x6 << 8); WDT->WTCR |= 0x3 << 6; WDT->WTCR |= 0x1 << 1; NVIC_EnableIRQ(WDT_IRQn); SYS_LockReg(); }

Watch Dog Test Watch Dog Handler 10 void WDT_IRQHandler(void) { WDT_CLEAR_TIMEOUT_INT_FLAG(); printf("WDT_Interrupt!!\n"); WDT->WTCR |= 0x1; // Reset WDT Counter }

Watch Dog Test Watch Dog Counter Clear 11 void WDT_Clear(void) { SYS_UnlockReg(); WDT->WTCR |= 0x1; SYS_LockReg(); }

Watch Dog Test Watch Dog Counter Clear (main) 12 int main(void) { int count = 0; SYS_Init(); … while(1) { … WDT_Clear(); }

Timer 를 이용한 시계 제작 Timer 를 이용하여 Uart 로 출력하는 시계를 작성하세요 13