Home

Operation of Timer B (pulse period measurement mode)

image

Contents

1. 4 Operation 1 Setting the count start flag to 1 causes the counter to start counting the count source 2 If a measurement pulse changes from H to L the value of the counter goes to 0000h and measurement is started In this instance an indeterminate value is transferred to the reload register The timer Bi interrupt request does not generate 3 If a measurement pulse changes from H to L again the value of the counter is transferred to the reload register and the timer Bi interrupt request bit goes to 1 Then the value of the counter becomes 0000h and the measurement is started again Note e The timer Bi interrupt request bit goes to 1 when an effective edge of a measurement pulse is input or timer Bi is overflowed The factor of interrupt request can be determined by use of the timer Bi overflow flag within the interrupt routine e The value of the counter at the beginning of a count is indeterminate Therefore the timer Bi overflow flag may go to 1 and timer Bi interrupt request may be generated during the interval between a count start and an effective edge input e The timer Bi overflow flag is indeterminate after reset The timer Bi overflow flag goes to 0 if timer Bi mode register is written to when the count start flag is 1 This flag cannot be set to 1 by software Measurement of pulse time interval from falling edge to falling edge 1
2. ENESAS APPLICATION NOTE M16C 62P Group Operation of Timer B pulse period measurement mode 1 Abstract In pulse period pulse width measurement mode choose functions from those listed in Table 1 Operations of the circled items are described below Figure 1 shows the operation timing and Figure 2 shows the set up procedure A reference program is an example when using the Timer BO interrupt based on the setting procedure of Figure 2 2 Introduction This application note is applied to the M16C 62P group Microcomputers This program can be operated under the condition of M16C family products with the same SFR Special Function Register as M16C 62P Group products Because some functions may be modified of the M16C family products see the user s manual When using the functions shown in this application note evaluate them carefully for an operation REJ05B0545 0110 Rev 1 10 January 2006 Page 1 of 10 ENESAS M16C 62P Group Operation of Timer B pulse period measurement mode 3 Choosed functions Table 1 Choosed functions Count source Internal count source f1 f8 32 fc32 Measurement Pulse period measurement interval between measurement pulse falling edge to falling edge mode Pulse period measurement interval between measurement pulse rising edge to rising edge Pulse width measurement interval between measurement pulse falling edge to rising edge and between rising edge to falling edge
3. 0ns 11 fc32 2us 976 56us e Setting clock prescaler reset flag This function is effective when fc32 is selected as the count source Reset the prescaler for generating fc32 by dividing the XcIN by 32 b7 bO Clock prescaler reset flag Address 038116 CPSRF Clock prescaler reset flag 0 No effect 1 Prescaler is reset When read the value is 0 Setting count start flag Timer B3 4 5 count start b7 bo Count start flag PO flag Address 038016 Address 034016 TABSR TBSR Timer B3 count start flag Timer B4 count start flag Timer B5 count start flag Timer BO count start flag Timer B1 count start flag Timer B2 count start flag Start count Clearing overflow flag b7 bO TT Tol TT TTI Timer Bi mode register i 0 to 5 Address 039B16 to 039D16 035B16 to 035D16 LT tel TIT TBIMR 0 to 5 Timer Bi overflow flag 0 Timer did not overflow Figure 2 set up procedure of pulse period measurement mode REJ05B0545 0110 Rev 1 10 January 2006 Page 3 of 10 ENESAS M16C 62P Group Operation of Timer B pulse period measurement mode 5 The example of reference program skkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk M16C 62P Program Collection FILE NAME rjj05b0704_src a30 CPU M16C 62P Group FUNCTION Operation of Timer B pulse period measurement mode HISTORY 2004 1
4. 2 24 Ver 1 00 2006 1 25 Ver 1 10 Copyright C 2006 Renesas Technology Corp Copyright C 2006 Renesas Solutions Corp All rights reserved skkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk 3 Include skkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk LIST off Stops outputting lines to the assembler list file INCLUDE sfr62p inc Reads the file that defined SFR LIST on Starts outputting lines to the assembler list file skkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk Symbol definition a RREKKERKERKERERERERERERERERERERERERERERERERERERERERE RRE EERE EREERERERERERERERERERRERERERER RAM_TOP equ 00400h Start address of RAM RAM_END equ 013ffh End address of RAM ROM_TOP equ 0f4000h Start address of ROM VECT_TOP equ Offe0O0h Start address of vect_top FIXED_VECT_TOP equ Offfdch Start address of fixed_vect_top SB_BASE equ 00380h Base address of sb skkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk 3 Program area skkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk Start up section program code Declares section name and section type org ROM_TOP Declares start address sb SB_BASE j REJ05B0545 0110 Rev 1 10 January 2006 Page 4 of 10 ENESAS M16C 62P Group Operation of Timer B pulse period mea
5. ENESAS M16C 62P Group Operation of Timer B pulse period measurement mode 6 Referense Hardware manual M16C 62P Group Hardware Manual Use the most recent version of the document on the Renesas Technology Web site Technical news Technical update Use the most recent version of the document on the Renesas Technology Web site REJO5B0545 0110 Rev 1 10 January 2006 Page 8 of 10 ENESAS M16C 62P Group Operation of Timer B pulse period measurement mode Web site and contact for support Renesas Technology Web site http www renesas com en m16c Inquiries http www renesas com inquiry csc renesas com Revision Revised Rev Issue data Page Point 1 00 2004 12 First edition issued 1 10 2006 01 5 Reference program modified REJO5B0545 0110 Rev 1 10 January 2006 Page 9 of 10 ENESAS M16C 62P Group Operation of Timer B pulse period measurement mode Keep safety first in your circuit designs Renesas Technology Corporation puts the maximum effort into making semiconductor products better and more reliable but there is always the possibility that trouble may occur with them Trouble with semiconductors may lead to personal injury fire or property damage Remember to give due consideration to safety when making your circuit designs with appropriate measures such as i placement of substitutive auxiliary circuits ii use of nonflammable material or ii
6. Start count 2 Start measurement 3 Start measurement again Count source Measurement pulse Transfer _L Transfer Reload register lt counter indeterminate value measured value transfer timing L Note 1 yw Note 1 Note 2 W Timing at which counter reaches 000016 Count start flag Timer Bi interrupt 1 request bit 0 1 Timer Bi overflow flag 0 Note 1 Counter is initialized at completion of measurement Note 2 Timer has overflowed Figure 1 Operation timing of pulse period measurement mode REJO5B0545 0110 Rev 1 10 January 2006 Page 2 of 10 ENESAS M16C 62P Group Operation of Timer B pulse period measurement mode a Selecting pulse period pulse width measurement mode and functions Ler eles Timer Bi mode register i 0 to 5 Address 039B16 to 039D16 035B16 to 035D16 E TBiMR i 0 to 5 Selection of pulse period pulse width measurement mode Measurement mode select bit b3 b2 0 0 Pulse period measurement Interval between measurement pulse falling edge to falling edge Fixed to 0 in pulse period pulse width measurement mode i 0 3 In an attempt to write to this bit write 0 i 1 2 4 5 Timer Bi overflow flag 0 Timer did not overflow 1 Timer has overflowed Count source select bit br be Count Count source period b7 b6 gt i source f XIN 16MHz f XCIN 32 768kHz 00 f1 01 f8 cons 10 f32 i 50
7. errupt vector REJ05B0545 0110 Rev 1 10 January 2006 Page 6 of 10 ENESAS lword lword lword lword lword lword lword lword lword lword lword lword M16C 62P Group Operation of Timer B pulse period measurement mode DUMMY UART1 receive ACK interrupt vector DUMMY TAO interrupt vector DUMMY TA1 interrupt vector DUMMY TA2 interrupt vector DUMMY TAS interrupt vector DUMMY TA4 interrupt vector TBO_INT TBO interrupt vector DUMMY TB1 interrupt vector DUMMY TB2 interrupt vector DUMMY INTO interrupt vector DUMMY INT1 interrupt vector DUMMY INT2 interrupt vector skkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk Setting of fixed vector skkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk section f_vect romdata org lword lword lword lword lword lword lword lword lword end FIXED_VECT_TOP DUMMY Undefined instruction interrupt vector DUMMY Overflow INTO instruction interrupt vector DUMMY BRK instruction interrupt vector DUMMY Address match interrupt vector DUMMY Single step interrupt vector DUMMY Watchdog timer interrupt vector Oscillation stop and Re oscillation detection interrupt vector Voltage down detection interrupt vector DUMMY DBC interrupt vector DUMMY NMI interrupt vector START Sets start vector REJO5B0545 0110 Rev 1 10 January 2006 Page 7 of 10
8. i prevention against any malfunction or mishap Notes regarding these materials These materials are intended as a reference to assist our customers in the selection of the Renesas Technology Corporation product best suited to the customer s application they do not convey any license under any intellectual property rights or any other rights belonging to Renesas Technology Corporation or a third party Renesas Technology Corporation assumes no responsibility for any damage or infringement of any third party s rights originating in the use of any product data diagrams charts programs algorithms or circuit application examples contained in these materials All information contained in these materials including product data diagrams charts programs and algorithms represents information on products at the time of publication of these materials and are subject to change by Renesas Technology Corporation without notice due to product improvements or other reasons It is therefore recommended that customers contact Renesas Technology Corporation or an authorized Renesas Technology Corporation product distributor for the latest product information before purchasing a product listed herein The information described here may contain technical inaccuracies or typographical errors Renesas Technology Corporation assumes no responsibility for any damage liability or other loss rising from these inaccuracies or errors Please also pay atten
9. on Any diversion or reexport contrary to the export control laws and regulations of Japan and or the country of destination is prohibited Please contact Renesas Technology Corporation for further details on these materials or the products contained therein REJO5B0545 0110 Rev 1 10 January 2006 Page 10 of 10
10. op nop nop nop REJ05B0545 0110 Rev 1 10 January 2006 Page 5 of 10 ENESAS M16C 62P Group Operation of Timer B pulse period measurement mode fset i Set interrupt enable flag mov b 01000010b tbOmr Timer BO mode register j Timer did not overflowed MAIN jmp MAIN Interrupt program TBO_INT TBO interrupt routine reit Dummy interrupt processing program DUMMY reit skkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk j Setting of variable vector table skkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk section vect romdata org VECT_TOP 4 4 lword DUMMY INT3 interrupt vector lword DUMMY TB5 interrupt vector lword DUMMY TB4 interrupt vector UART1 bus collision detection interrupt vector lword DUMMY TB3 interrupt vector UARTO bus collision detection interrupt vector lword DUMMY SI 04 1INT5 interrupt vector lword DUMMY SI 03 1INT4 interrupt vector lword DUMMY UARTZ2 bus collision detection interrupt vector lword DUMMY DMAO interrupt vector lword DUMMY DMA1 interrupt vector lword DUMMY KEY interrupt vector lword DUMMY A D interrupt vector lword DUMMY UART2 transmit NACK interrupt vector lword DUMMY UART2 receive ACK interrupt vector lword DUMMY UARTO transmit NACK interrupt vector lword DUMMY UARTO receive ACK interrupt vector lword DUMMY UART1 transmit NACK int
11. surement mode START Idc RAM_END 1 isp Sets interrupt stack pointer Idc SB_BASE sb Sets sb register mov b 03h prcr Removes protect Set processor mode registers 0 and 1 mov w 0800h pm0 Single chip mode No expansion No wait mov w 2008h cm0 Xcin Xcout High Xin Xout High Main clock is No divison mov b 0 prcr Protects all registers Idintb VECT_TOP Sets interrupt table register mov w 0 r0 Clears WORKRAM area mov w RAM_END 1 RAM_TOP 2 r3 mov w RAM_TOP a1 sstr w mov b 01000010b tbOmr Timer BO mode register Pulse period pulsewidgh measurement mode f Pulse period measurement measurement between 111 a falling adge and the next falling adge of measured LIII pulse Set to 0 in pulse period and pulse widge measurement MN mode Timer has not overflowed A Count source f8 mov b 00000011b tb0ic Interrupt control register Interrupt priority level select bit l 011 Level 3 interrupt disabled Interrupt request bit O interrupt not requested mov b 00100000b tabsr Count start flag 3 Starts counting nop To set the MR3 bit to 0 no overflow set TBIMR nop register with setting the TBiS bit to 1 and counting the nop next count source after setting the MR3 bit to 1 nop overflow Newly added in the Ver 1 10 n
12. tion to information published by Renesas Technology Corporation by various means including the Renesas Technology Corporation Semiconductor home page http www renesas com When using any or all of the information contained in these materials including product data diagrams charts programs and algorithms please be sure to evaluate all information as a total system before making a final decision on the applicability of the information and products Renesas Technology Corporation assumes no responsibility for any damage liability or other loss resulting from the information contained herein Renesas Technology Corporation semiconductors are not designed or manufactured for use in a device or system that is used under circumstances in which human life is potentially at stake Please contact Renesas Technology Corporation or an authorized Renesas Technology Corporation product distributor when considering the use of a product contained herein for any specific purposes such as apparatus or systems for transportation vehicular medical aerospace nuclear or undersea repeater use The prior written approval of Renesas Technology Corporation is necessary to reprint or reproduce in whole or in part these materials If these products or technologies are subject to the Japanese export control restrictions they must be exported under a license from the Japanese government and cannot be imported into a country other than the approved destinati

Download Pdf Manuals

image

Related Search

Related Contents

PORTABLE HARDNESS TESTING  NBA2424ND/NBA2419ND  Manual - LPT Home Page - HP LaserJet and Lexmark Parts    Gigaset E360  Continental Refrigerator Refrigerators and Freezers Refrigerator User Manual  Téléchargez le programme complet des conférences.  DSP-2 Manual  Istruzioni per l`uso e l`installazione Mode d`emploi et  PDF  

Copyright © All rights reserved.
Failed to retrieve file