Complementary Waveform Generator Example

This page is a step by step example of using the Complementary Waveform Generator.

This example uses the Numerically Controller Oscillator (NCO) Output signal (running at 50% duty cycle) as the input and the High Frequency Internal Oscillator (HFINTOSC) as clock.

This example also produces two complementary outputs and uses an external switch as the shutdown control as shown in the block diagram below.

Click image to enlarge.

CWG Example Setup


The NCO is selected as the input for the CWG.

Click image to enlarge.


The High Frequency Internal Oscillator is selected as the clock source.

Click image to enlarge.


Dead Band delays are set to 63-64 clock counts.

Click image to enlarge.


The CWGFLT1 pin is enabled as a shutdown signal which is connected to a normally open momentary switch. When the switch is pressed, a low signal appears on the CWGFLT1 pin and triggers the shutdown.

Click image to enlarge.


Auto-restart is enabled and the Shutdown bit is cleared to start in run mode.

Click image to enlarge.


Both outputs are set to drive to their respective inactive mode when the shutdown signal occurs.

Click image to enlarge.


The CWG outputs are connected to the I/O pins and the output polarity is set to normal mode.

Click image to enlarge.


The CWG is then enabled.

For reference the NCO setup code is also shown that produces the input signal.

Click image to enlarge.

CWG Example Operation

The CWG example is running and the screen capture below shows the results.

The NCO signal can be seen at the top of the screen capture along with the CWGA and CWGB signals. You can also see the dead band delays that are triggered by the edges of the NCO input signal.

Click image to enlarge.

The CWG is forced into shutdown mode.

When the momentary switch is pressed, the CWG outputs are driven to their inactive state showing the shutdown has occurred.

Click image to enlarge.
© 2019 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.