Frequency Resolution - ACIM Control - AN908, AN984, AN1162

Are there any code examples, suggestions, or guidelines on how I could implement a fixed resolution higher than the frequency used in AN908, AN984, and AN1162?

Microchip does not have a code example with a 0.01 Hz/bit resolution.

AN984 discusses how to generate a sinusoidal waveform. If you wish to create at a 60 Hz modulation frequency with a 0.01 Hz resolution, you need to increase two parameters:

  • the number of entries in your sine table (increase your PWM frequency),
  • and the number of bits you use as resolution-bits in your PWM sine table pointer.

As an example, a 60 Hz modulation frequency, a 16 KHz PWM (from AN984), and a sine table with 16 KHz/60 Hz results in 267 sine table entries. A 267 entry table requires a 9-bits pointer. Using a standard C language 16-bit pointer allows the upper 9-bits to point to your sine value and the lower 7-bits to be used for frequency resolution bits.

If the table pointer is updated every PWM period (16 KHz) a complete sweep of the sine table would be completed in 127 * (1/16KHz) * 267) = 2.12 seconds. This creates an oscillation frequency of 1/2.12 secs = 0.472 Hz. If you need a 0.01 Hz PWM resolution, you need to alter your sine table size, PWM frequency, and sine table pointer.

© 2018 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.