| 数据搜索系统,热门电子元器件搜索 |
|
AN913 数据表(PDF) 4 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN913 数据表(HTML) 4 Page - STMicroelectronics |
|
4 / 12 page ![]() 4/12 PWM GENERATION WITH THE ST62 16-BIT AUTO-RELOAD TIMER Figure 2. PWM Timer Operation with PWMPOL=0, MASK=FFFFh and RELOAD mode (Reload bit=1) Example: The purpose of this example is to use the PWM as an 8-bit precision DAC for a Telecom DTMF application. DTMF is a succession of breaks and tones. The tone is made of two sinus waves for each digit to send. To make the sinus waves, we use a window look-up table of 64 samples. For each frequency the phase is calculated with 16-bit precision and the look-up table is indexed with the 8 most significant bits. The sum of the two values obtained from the look-up table is loaded in the CMP register. The PWM is selected with the set/reset mode. With a 8MHz clock frequency, a PSC value of 4 and a RLCP register value at 177h (RLCPH=100h and RLCPL=77h) the PWM gives a sample frequency of: 8MHz/(4*(177h+1)) = 5319Hz This frequency is the highest one in order to have 115 CPU cycles to calculate the tone. To calculate the sinus wave with only 8 bits, the sinus table gives data between 1 and 7Fh. The addition of the two sinus waves gives an 8-bit data stored in the CMP register when an overflow occurs. To avoid the TC register going below the maximum value of the CMP register (which is the maximum value of the DTMF result FFh) when the program wants to reload the CMP register after an ARTimer overflow, the CPU cycle time between the overflow and TC=FFh equals: (177h-FFh)*4/8MHz*8MHz/13 = 36 cycles Reload Register Compare Value 0 t up to 65536 Overflow PWM ouput t MASK&TC=MASK&CMP |
|
|
链接网址 |
| ALLDATASHEET是否为您带来帮助? [ DONATE ] |
关于 Alldatasheet | 广告服务 | 联系我们 | 隐私政策 | 数据表链接 | 链接交换 | 制造商名单 All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |