| 数据搜索系统,热门电子元器件搜索 |
|
AN1712 数据表(PDF) 7 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN1712 数据表(HTML) 7 Page - STMicroelectronics |
|
7 / 14 page ![]() 7/14 GENERATING A HIGH RESOLUTION SINEWAVE USING ST7 PWMART 3 SOFTWARE CONFIGURATION The software is developed in “C” language and gives you the option of using the ST7 software library or not. A header file “define.h” is supplied. This header file defines the sin structure. The sin structure has the three user defined datatypes for storing sinewave patterns depending on the number of samples in a sinewave cycle, the “index” which is used for counting the current sinewave sample and another datatype which is used to indicate whether the current sample is related to the upper half or lower half of the sinewave. Depending on the number of samples in a sin e wa ve cycle , sa m p le va lu e s a r e in itia lize d fo r th e sin e wa ve e n ve lo p e (X(n)=Asin((2*pi*n)/N)). where A is the sinewave amplitude, pi is 3.1416, n is the nth sample of the sinewave, N is the number of samples in a sinewave cycle. N should be more than 18 in order to generate a sinewave with Total Harmonic Distortion of less than 5%. The value of A should be such that no 0% or 100% duty cycle is generated for any of the sinewave samples. There are other define types for the sinewave frequency from 45 to 65Hz with a resolution of less than 0.1Hz. These define types contain five parameters: – “no_of_samples_half” for defining the number of samples in half a sinewave cycle – “COUNTER” value which defines the number of overflow cycles after which the PWM duty cycle changes – Initialization value of ARTARR for fPWM, – Initialization value of PWMDCR0 a 50% duty cycle – “AVERAGE_AMP” to define the average sinewave amplitude. A s i new a v e w i th a r e s o l u ti on of l e s s t han 0.1 H z i s obtai ne d b y v a r y i ng the “no_of_samples_half”, the “COUNTER” value and ARTARR. The average sinewave ampli- tude is also software configurable by the “AVERAGE_AMP” parameter. It should be noted that the value of A and the value of the “AVERAGE_AMP” is chosen in such a way that no 0% or 100% duty cycle is generated for any of the sinewave samples. 3.1 SIN STRUCTURE INITIALIZATION The sin structure has the three user defined datatypes for storing the sinewave pattern ac- cording to the number of samples in a sinewave cycle, the “index” which is used for counting the current sinewave sample and another datatype which is used for indicating whether the current sample is related to the upper half or lower half of the sinewave. |
|
|
链接网址 |
| 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 |