Part Number Hot Search : 
5KP22A XLT2423 000001 8HC05 BC489B SI3000 CXMXX HER108R1
Product Description
Full Text Search
 

To Download PULSE Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  regarding the change of names mentioned in the document, such as mitsubishi electric and mitsubishi xx, to renesas technology corp. the semiconductor operations of hitachi and mitsubishi electric were transferred to renesas technology corporation on april 1st 2003. these operations include microcomputer, logic, analog and discrete devices, and memory chips other than drams (flash memory, srams etc.) accordingly, although mitsubishi electric, mitsubishi electric corporation, mitsubishi semiconductors, and other mitsubishi brand names are mentioned in the document, these names have in fact all been changed to renesas technology corp. thank you for your understanding. except for our corporate trademark, logo and corporate statement, no changes whatsoever have been made to the contents of the document, and these changes do not constitute any alteration to the contents of the document itself. note : mitsubishi electric will continue the business operations of high frequency & optical devices and power devices. renesas technology corp. customer support dept. april 1, 2003 to all our customers
a pplication n ote m16c PULSE period/width measurement on the m16c/62 1. abstract measuring the frequency (1/period) or the PULSE width of an input signal is useful in applications such as tachometers, dc motor control, power usage calculat ions, and so on. the following article describes how to use timer b to measure the period and PULSE widt h of an input waveform, referred to as ?PULSE period/PULSE width measurement mode?. 2. introduction the mitsubishi m16c/62 is a 16-bit mcu, based on t he m16c cpu core, with an impressive list of features including 10-bit a/d, d/a, uarts, timers, dma, etc., and up to 256k bytes of user flash. the mcu has 6 b timers and all 6 timers can operate in PULSE period/PULSE width measurement mode. timer b has the following additional modes of operation: ? timer mode ? event counter mode figure 1 illustrates the operation of timer b. the rema inder of this article fo cuses on setting up timer b0 to measure PULSE width, and time r b1 to measure PULSE period. figure 1. block diagram of timer b an-dece-mcu-6-a may 2002 1
m16c PULSE period/width measurement on the m16c/62 3. PULSE period/PULSE width measurement mode description as illustrated in figure 1, the timer tbi register cons ists of two parts, a counter and a reload register. in measurement mode, when an effective edge appears on the tbi in pin, the count value is transferred to the reload register and the cpu can read this val ue by performing a read on the tbi register. the measured time is the counter value (tbi) divided by the frequency of the clock source (fi). two period measurement options are availabl e that measure from falling edge to falling edge or rising edge to rising edge. for width measurement, the measurement is taken at both edges and software determines if the measured value is for the high width or low. 3.1 PULSE period measurement in period measurement mode (e.g. falling edge to falling edge), after the ?start count flag? is set, the counter counts up using the select ed clock source and every time a falling edge is detected on the tbi in pin, the value in the counter is transferred to the reload register, the counter is reset to zero, and then continues counting. at the same time, the timer inte rrupt request bit is set and an interrupt is generated if the timer interrupt priority level is set above the curr ent cpu priority level (if the i flag in the cpu flag register is cleared, the interrupt will not be serviced until the flag is set). if the timer?s counter overflows within a period, it will also generate the interrupt and the mr3 bit in the tbimr is set to distinguish between the interrupt causes. note that the measurem ent is free running and the reload register contains the most recent measurement. the user has the opti on of polling the tbi regist er or reading it in an interrupt service routine. also note that the value of the counter immediately after the ?start count flag? is set is indeterminate and an overflow could occur bef ore the first falling edge. figure 2 illustrates this. figure 2. operation timing when measuring a PULSE period an-dece-mcu-6-a may 2002 2
m16c PULSE period/width measurement on the m16c/62 3.2 PULSE width measurement PULSE width measurement mode operates in much the sa me way except the count register is transferred to the reload register for every edge detected on the tbi in pin, and the counter resets and resumes counting, as shown in figure 3. again, note that the value of the counter immediately after the ?start count flag? is set is indeterminate and an ov erflow could occur before the firs t falling edge. this measurement is also free running but now the user must determine by software whether the measurement is for the high or low width. figure 3. operation timing when measuring a PULSE width 4. configuring PULSE period/PULSE width measurement mode to configure a timer for PULSE period/PULSE width measurement mode: 1. load the timer mode register, taimr. ? select measurement mode: bits tmod0 = 0, tmod1 = 1. ? set the mr0 and mr1 bits for period or width measurement. ? clear the mr2 bit for period or width measurement. ? mr3 is the timer bi overflow flag (can be cleared but not set). ? select the clock source (f1, f/8, f/32, or fc/32): bits tck0,tck1 register. 2. set the timer ?interrupt priority level?, tbiic, to at least 1 if required. an-dece-mcu-6-a may 2002 3
m16c PULSE period/width measurement on the m16c/62 3. enable interrupts (cpu i flag set). 4. set the ?start count flag? bit, tbis, in the ?count start flag? register, tabsr or tbsr. it is not necessary to perform these steps in t he order listed, but the mode register should be loaded before the ?start count? flag is set. also, the priority level should not be modified when there is a possibility of an interrupt occurring. the required registers ar e shown in figure 4. figure 4. timer bi mode register in pu lse period/PULSE width measurement mode an-dece-mcu-6-a may 2002 4
m16c PULSE period/width measurement on the m16c/62 figure 5. timer bi register figure 6. count start flag figure 7. timer b3, 4, 5 count start flag an-dece-mcu-6-a may 2002 5
m16c PULSE period/width measurement on the m16c/62 figure 8. interrupt control register 5. references ? nc30 ver. 4.0 user?s manual, nc30ue.pdf ? m16c/60 and m16c/20 c language programming manual, 6020ec.pdf ? m16c/62 datasheets, 62aeds.pdf ? m16c/62 user?s manual, 62eum.pdf ? application note: writing interrupt handlers in c for the m16c an-dece-mcu-6-a may 2002 6
m16c PULSE period/width measurement on the m16c/62 6. software code the software supplied by mitsubishi electric & electronics usa, inc. is intended and supplied for use on mitsubishi electric products. this software is owned by mitsubishi electric & electronics usa, inc. or mitsubishi electric corporation and is protected under applicable copyright laws. all rights are reserved. this software is provided ?as is?. no warranties, whether express, implied, or statutory, including but not limited to implied warran ties of merchantability and fitness for a particular purpose apply to this software. mitsubishi electric & electronics usa, inc. and mitsubishi electric corporation reserve the right, without notice, to make changes to this software. neither mitsubishi electric & electronics usa, inc. nor mitsubishi electric corporation shall, in any circumstances, be liable for special, incidental, or consequential damages for any reason whatsoever arising out of the use or application of this software. below is a program written for mitsubishi?s nc30 compiler to illustrate how to configure PULSE period/PULSE width measurement mode. the progr am can measure up to about a 16msec period and runs on the msv1632 starter kit board. using the kd30 debugger, the program can be ?stopped? and the global variables ?widthlow?, ?width_hi?, and ? period? viewed from t he global watch window. to become familiar with this mode, try changing the clock source or even switch to a different timer (e.g. tb2, tb3, etc.). /***************************************************************************** * * file name: period_width.c * * content: example program using timer b in 'PULSE width / period measurement * mode'. this program is written for the "PULSE period/width * measurement" application note. timer b0 is configured to measure * PULSE width(tb0in pin),and timer b1,measures the period(tb1in pin). * tested using a 250hz square wave with a 0.5msec PULSE width(high). * this program works with the msv1632 starter kit board. * * compiled with nc30 ver. 3.20.00. * * all timing based on 16 mhz xtal * * copyright,2001 mitsubishi electric corporation * and mitsubishi semiconductor system corporation * and mitsubishi electric and electronics usa *============================================================================= * $log:$ *===========================================================================*/ an-dece-mcu-6-a may 2002 7
m16c PULSE period/width measurement on the m16c/62 #include "sfr62.h" #define b1time_config 0x42 /* 01000010 value to load into timer b1 mode register ||||||||_ tmod0,tmod1: PULSE measurement mode ||||||____ mr0,mr1: PULSE period mode ||||_______mr2: = 0 for PULSE measurement |||_______ mr3: overflow flag ||________ tck0,tck1: f divided by 8 selected */ #define b0time_config 0x4a /* 01001010 value to load into timer b0 mode register ||||||||_ tmod0,tmod1: PULSE measurement mode ||||||____ mr0,mr1: PULSE width mode ||||_______mr2: = 0 for PULSE measurement |||_______ mr3: overflow flag ||________ tck0,tck1: f divided by 8 selected */ #define cntr_ipl 0x03 // tb0 priority interrupt level int period,widthlow,width_hi; //prototypes void init(void); #pragma interrupt /b timerb0int void timerb0int(void); /***************************************************************************** name: timerb0int() parameters: none returns: nothing description: timer b0 interrupt service routine. the overflow flag is check to determine if the tb0 register contains valid data. if so, the input is tested to determine if the value in the tb0 register is the high PULSE width or low width and stored in the appropriate variable. **************************************************************************** */ void timerb0int(void) { if (mr3_tb0mr ==1) // check for timer overflow { tb0mr = b0time_config; // if so clear flag and return; // data invaild, so leave } if (p9_0== 1) widthlow = tb0 ; // if input now hi, just measured a low width else width_hi = tb0; } an-dece-mcu-6-a may 2002 8
m16c PULSE period/width measurement on the m16c/62 /***************************************************************************** name: main() parameters: none returns: nothing description: initializes variables. then the variable 'period' is constantly updated with the period count in timer tb1. this is to illustrate that the period measurement is free running. note that the first few times tb1 is read, the data may not be valid. *****************************************************************************/ void main (void) { init(); while (1) { period = tb1 ; // period measured in polled mode } } /***************************************************************************** name: initial() parameters: none returns: nothing description: timer tb0 setup for PULSE width interrupts and tb1 configured for PULSE period measurement (no interrupts). **************************************************************************** */ void init() { /* the following procedure for writing an interrupt priority level follows that as described in the m16c data sheets under 'interrupts' */ _asm (" fclr i") ; // turn off interrupts before modifying ipl tb0ic |= cntr_ipl; // use read-modify-write instruction to write ipl tb0mr = b0time_config; _asm (" fset i"); tb0s = 1; //start counting tb1mr = b1time_config; tb1s = 1; //start counting } an-dece-mcu-6-a may 2002 9
m16c PULSE period/width measurement on the m16c/62 in order for this program to run pr operly, timer b0?s interrupt vector needs to point to the function. the interrupt vector table is near the end of the startup file ?sect30.inc?. insert the function label ?timerb0int? into the interrupt vector table at vector 26 as shown below. ;******************************************************************************* ; ; c compiler for m16c/62 ; ; copyright,2000 mitsubishi electric corporation ; and mitsubishi semiconductor system corporation ; and mitsubishi electric and electronics usa ; all rights reserved. ; ; written by t.aoyama ; modified for use on msv1632 starter kit. ; sect30.inc : section definition ; this program is applicable when using kd30 and the rom monitor. ; ; $id: ; ;****************************************************************************** : : : : : : .lword dummy_int ; timer a0(for user)(vector 21) .lword dummy_int ; timer a1(for user)(vector 22) .lword dummy_int ; timer a2(for user)(vector 23) .lword dummy_int ; timer a3(for user)(vector 24) .lword dummy_int ; timer a4(for user)(vector 25) .glb _timerb0int .lword _timerb0int ; timer b0(for user)(vector 26) .lword dummy_int ; timer b1(for user)(vector 27) .lword dummy_int ; timer b2(for user)(vector 28) .lword dummy_int ; int0 (for user)(vector 29) .lword dummy_int ; int1 (for user)(vector 30) .lword dummy_int ; int2 (for user)(vector 31) .lword dummy_int ; vector 32 (for user or mr30) .lword dummy_int ; vector 33 (for user or mr30) .lword dummy_int ; vector 34 (for user or mr30) .lword dummy_int ; vector 35 (for user or mr30) .lword dummy_int ; vector 36 (for user or mr30) .lword dummy_int ; vector 37 (for user or mr30) : : : an-dece-mcu-6-a may 2002 10
keep safety first in your circuit designs! ? mitsubishi electric corporation puts the maximum effort into ma king semiconductor products bette r and more reliable, but there is always a possibility of trouble occurring. 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 backup, auxiliary circuits, (ii) use of non- flammable material, or (iii) prevent ion against any malfunction or mishap. notes regarding this information ? this information is intended as a reference to assist our consumers in the selection of the mitsubishi semiconductor product best suited to the customer?s application; it does not convey any license under any intellectual property ri ghts, or any other righ ts, belonging to mitsubish i electric corpor ation or a third party. ? mitsubishi electric corporation assumes no responsibility for any damage, or infringement of any third- party?s rights, origi nating in the us e of any product data, diagrams, charts, progr ams, algorithms, or circuit application examples contained in these materials. ? all information c ontained in these materials, including pr oduct data, diagrams, charts, pr ograms and algorithms, represents info rmation on produ cts at the time of publication of these materials, and is subject to change by mitsubishi electric corporation without notice due to product improvements or other reasons. it is therefore recommended that customers contact mitsubishi electric corporation or an authorized mitsubishi semiconductor product distributor for the latest product information before purchasing a product listed herein. ? the information described herein may contain technical inaccuracies or typographical errors. mitsubishi electric corporation assumes no responsibility for any damage, liability, or other loss arising from these inaccuracies or errors. ? please also pay attention to information published by mitsubishi electric corporation by various means, including the mitsubishi se miconductor home page (http:// www.mitsubishichip s.com). ? when using any or all of the information c ontained in these materials, in cluding produ ct, data, diagrams, charts, programs, and algorithms, please be sure to evaluate all info rmation as a to tal system before making a final decision on the app licability of t he information and produ cts. mitsubishi electric corporation assumes no responsibility for any damage, liability, or other loss resulting from the information contained herein. ? mitsubishi electric 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 mitsubishi electric corporation or an authorized mitsubishi semiconductor 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 mitsubishi electric corporation is necessary to reprint or reproduce these materials in whole or in part. ? if these products or technologies are subject to japanese export c ontrol restriction s, they must be exported under a license from the japanese government and cannot be imported into a country other than the approved destination. ? any diversion or reexport contrary to the export control laws and regulations of japan and/or the country of destination is prohibited. ? please contact mitsubishi electric corporation or an authorized mitsubishi semiconductor product distributor for further deta ils on these materials or t he produ cts contained therein.
mitsubishi electric & electronics usa, inc. electronic device group usa headquarters mitsubishi electric & electronics usa, inc. electronic device group 1050 east arques avenue sunnyvale, ca 94085-4601 phone: 408-730-5900 fax: 408-732-9382 direct sales offices ? usa northwest mitsubishi electric & electronics usa, inc. electronic device group 1050 east arques avenue sunnyvale, ca 94085-4601 phone: 408-730-5900 fax: 408-737-1129 southwest mitsubishi electric & electronics usa, inc. electronic device group 20 fairbanks, suite 181 irvine, ca 92618 phone: 949-859-9453 fax: 949-859-9450 rocky m ountain mitsubishi electric & electronics usa, inc. electronic device group po box 273377 fort collin s, co 80527 phone: 970-669-4068 fax: 970-669-4129 north central mitsubishi electric & electronics usa, inc. electronic device group 3300 edinborough way, suite 511 edina, mn 55435 phone: 952-837-9053 fax: 952-837-9059 mitsubishi electric & electronics usa, inc. (automotive market only) 50 west big beaver rd., suite 136 troy, mi 48084 phone: 248-526-9580 fax: 248-526-9583 south central mitsubishi electric & electronics usa, inc. electronic device group 8310 capital of texas hwy. n., suite 260 austin, tx 78731 phone: 512-346-4200 fax: 512-346-4434 northeast mitsubishi electric & electronics usa, inc. electronic device group 92 montvale avenue, suite 2500 stoneham, ma 02180 phone: 781-245-6956 fax: 781-245-4233 mid-atlantic mitsubishi electric & electronics usa, inc. electronic device group 92 montvale avenue, suite 2500 stoneham, ma 02180 phone: 781-245-6956 fax: 781-245-4233 south atlantic mitsubishi electric & electronics usa, inc. electronic device group 2625 meridian parkway, suite 100 durham, nc 27713 phone: 919-767-7900 fax: 919-767-7902 southeast mitsubishi electric & electronics usa, inc. electronic device group 2810 premiere parkway, suite 400 duluth, ga 30097 phone: 678-258-4518 fax: 678-258-4519 mexico inquiries western mexico mitsubishi electric & electronics usa, inc. electronic device group 20 fairbanks, suite 181 irvine, ca 92618 phone: 949-859-9453 fax: 949-859-9450 eastern mexico mitsubishi electric & electronics usa, inc. electronic device group 8310 capital of texas hwy. n., suite 260 austin, tx 78731 phone: 512-346-4200 fax: 512-346-4434 puerto rico inquiries puerto rico mitsubishi electric & electronics usa, inc. electronic device group 2810 premiere parkway, suite 400 duluth, ga 30097 phone: 678-258-4518 fax: 678-258-4519 mitsubishi electric sales canada, inc. jqa-qs0161 direct sales offices ? canada central & western canada mitsubishi electric sales canada, inc. 4299 14th avenue markham, ontario, canada l3r 0j2 phone: 905-475-7728 fax: 905-475-1918 eastern canada mitsubishi electric sales canada, inc. 340 march road, suite 300 kanata, ontario, canada k2k 2e4 mitsubishi electric mcu products sold into the automotive marketplace are qs-9000 certified. phone: 613-591-3348 fax: 613-591-3948 ? 2002 mitsubishi electric & electronics usa, inc., electronic device group. mitsubishi electric & electronics usa, inc. is a wholly owned subsidiary of mitsubishi electric corporation. all trademarks are the property of their respective owners. the information supplied by mitsubishi electric & electronics usa, inc. is believed to be accurate and relia ble but in no event shall mitsubishi electric & electronics usa, inc. be liable for any damages whatsoever arising out of the use or inab ility to use the information or any errors that may appear in this publication. the information is provided as is without any warranties of any kind, either express or implied. mitsubishi electric & electronics usa, inc. reserves the right, without notice, to make changes to the information or to the design and specifications of its hardware and/or software products. products subject to availability. printed in u.s.a. www.mitsubishichips.com an-dece-mcu-6-a may 2002 12


▲Up To Search▲   

 
Price & Availability of PULSE

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X