<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://www.dynomotion.com/wiki/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://www.dynomotion.com/wiki/index.php?action=history&amp;feed=atom&amp;title=PWM_Output_Mode</id>
		<title>PWM Output Mode - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://www.dynomotion.com/wiki/index.php?action=history&amp;feed=atom&amp;title=PWM_Output_Mode"/>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php?title=PWM_Output_Mode&amp;action=history"/>
		<updated>2026-05-13T07:16:25Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.10</generator>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php?title=PWM_Output_Mode&amp;diff=442&amp;oldid=prev</id>
		<title>TK: Fix minor typos</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php?title=PWM_Output_Mode&amp;diff=442&amp;oldid=prev"/>
				<updated>2017-11-16T01:12:33Z</updated>
		
		<summary type="html">&lt;p&gt;Fix minor typos&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 01:12, 16 November 2017&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;KFLOP has 8 hardware PWMs (Pulse Width Modulators) that output on dedicated KFLOP JP6 pins&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;KFLOP has 8 hardware &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;8-bit &lt;/ins&gt;PWMs (Pulse Width Modulators) that output on dedicated KFLOP JP6 pins&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[File:KFLOP_PWMS.png|none|link=]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[File:KFLOP_PWMS.png|none|link=]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 21:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 21:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	SetBitDirection(26,1);&amp;#160; // define bit as an output&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	SetBitDirection(26,1);&amp;#160; // define bit as an output&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	FPGA(IO_PWMS_PRESCALE) = &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;65&lt;/del&gt;;&amp;#160; 	// divide clock by 65 (&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;1 KHz&lt;/del&gt;)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	FPGA(IO_PWMS_PRESCALE) = &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;64&lt;/ins&gt;;&amp;#160; 	// divide clock by 65 (&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;~1KHz&lt;/ins&gt;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	FPGA(IO_PWMS) = 128;&amp;#160; 			// square wave&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	FPGA(IO_PWMS) = 128;&amp;#160; 			// square wave&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	FPGA(IO_PWMS+1) = 1;&amp;#160; 			// Enable&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	FPGA(IO_PWMS+1) = 1;&amp;#160; 			// Enable&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 47:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 47:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	SetBitDirection(26,1);&amp;#160; 		// Set bit 26 (PWM 0 as an output)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	SetBitDirection(26,1);&amp;#160; 		// Set bit 26 (PWM 0 as an output)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	SetBitDirection(DIR_BIT0,1);	// Set bit 30 (Direction an output)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	SetBitDirection(DIR_BIT0,1);	// Set bit 30 (Direction an output)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	FPGA(IO_PWMS_PRESCALE) = 1;&amp;#160; 	// set pwm period to &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;30 &lt;/del&gt;KHz&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	FPGA(IO_PWMS_PRESCALE) = 1;&amp;#160; 	// set pwm period to &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;~33 &lt;/ins&gt;KHz&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	FPGA(IO_PWMS+1) = 1;			// enable the PWM&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	FPGA(IO_PWMS+1) = 1;			// enable the PWM&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 94:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 94:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	SetBitDirection(26,1);&amp;#160; 	// Set bit 26 (PWM 0 as an output)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	SetBitDirection(26,1);&amp;#160; 	// Set bit 26 (PWM 0 as an output)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	FPGA(IO_PWMS_PRESCALE) = 1;&amp;#160; 	// set pwm period to &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;30 &lt;/del&gt;KHz&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	FPGA(IO_PWMS_PRESCALE) = 1;&amp;#160; 	// set pwm period to &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;~33 &lt;/ins&gt;KHz&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	FPGA(IO_PWMS+1) = 1;		// enable the PWM&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	FPGA(IO_PWMS+1) = 1;		// enable the PWM&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php?title=PWM_Output_Mode&amp;diff=333&amp;oldid=prev</id>
		<title>TK: Added note for setting the KFLOP Axis Parameters</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php?title=PWM_Output_Mode&amp;diff=333&amp;oldid=prev"/>
				<updated>2017-01-13T01:22:21Z</updated>
		
		<summary type="html">&lt;p&gt;Added note for setting the KFLOP Axis Parameters&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 01:22, 13 January 2017&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 27:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 27:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Usually a PWM is used to drive a Full H-Bridge Driver to control the effective voltage to a motor coil.  There are two basic modes of operation: Sign/Magnitude and Anti-Phase.  With Sign and Magnitude the Sign controls the polarity of voltage (either positive or negative) and the PWM pulse controls the fraction of time the voltage is applied.  The voltage is applied for some fraction of the time period and zero volts are applied for the remainder.  With Anti-phase there is no Direction Output required.  Instead both positive and negative voltages are applied every cycle.  Equal amounts of positive and negative voltage results in effectively zero volts.  With KFLOP's 8-bit PWMs setting a PWM value of 128 will result in equal positive and negative times.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Usually a PWM is used to drive a Full H-Bridge Driver to control the effective voltage to a motor coil.  There are two basic modes of operation: Sign/Magnitude and Anti-Phase.  With Sign and Magnitude the Sign controls the polarity of voltage (either positive or negative) and the PWM pulse controls the fraction of time the voltage is applied.  The voltage is applied for some fraction of the time period and zero volts are applied for the remainder.  With Anti-phase there is no Direction Output required.  Instead both positive and negative voltages are applied every cycle.  Equal amounts of positive and negative voltage results in effectively zero volts.  With KFLOP's 8-bit PWMs setting a PWM value of 128 will result in equal positive and negative times.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;The KFLOP Axis Output Mode should be set to &amp;quot;NO Output&amp;quot; as your C Code will be performing the Output.  The Max Output should be set to less than the maximum PWM range.  Either 255 for Sign/Mag types or 127 for Anti-Phase types.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>TK</name></author>	</entry>

	<entry>
		<id>https://www.dynomotion.com/wiki/index.php?title=PWM_Output_Mode&amp;diff=332&amp;oldid=prev</id>
		<title>TK: Added PWM Descriptions</title>
		<link rel="alternate" type="text/html" href="https://www.dynomotion.com/wiki/index.php?title=PWM_Output_Mode&amp;diff=332&amp;oldid=prev"/>
				<updated>2017-01-13T01:08:46Z</updated>
		
		<summary type="html">&lt;p&gt;Added PWM Descriptions&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;KFLOP has 8 hardware PWMs (Pulse Width Modulators) that output on dedicated KFLOP JP6 pins&lt;br /&gt;
&lt;br /&gt;
[[File:KFLOP_PWMS.png|none|link=]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is no direct output support for KFLOP PWMs.  A few lines of C Code executing in a loop are required to output the Servo Outputs to the pwms and possibly directions (sometimes referred to as signs) in your required format.  This allows flexibility for controlling Mode, Frequency, Range, Polarity, etc... Pre-made examples exist.  Often this code can be added to an existing forever loop toward the end of your Initialization C Program.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The PWMs are accessed via a pair of FPGA Registers.  The first in the pair is a value 0-255 to set the pulse width.  The second register is a single bit enable register.  A value of 1 enables the PWM to take control of the Output pin and begin pulsing.  The PWM pin must be configured as an output via a SetBitDirection call.  A value of 0 disables the PWM and allows the pin to be used as General Purpose IO.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There is also a global pre-scaler to set the frequency of all the PWMs.  All PWMs must operate at the same frequency.  The pre-scaler divides the 16.67MHz input clock by N+1.  Where N is a value of 0-255. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
PWM1KHz.c is a simple example to enable a PWM to operate at a fixed period and frequency:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;#include &amp;quot;KMotionDef.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
main()&lt;br /&gt;
{&lt;br /&gt;
	SetBitDirection(26,1);  // define bit as an output&lt;br /&gt;
	FPGA(IO_PWMS_PRESCALE) = 65;  	// divide clock by 65 (1 KHz)&lt;br /&gt;
	FPGA(IO_PWMS) = 128;  			// square wave&lt;br /&gt;
	FPGA(IO_PWMS+1) = 1;  			// Enable&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Usually a PWM is used to drive a Full H-Bridge Driver to control the effective voltage to a motor coil.  There are two basic modes of operation: Sign/Magnitude and Anti-Phase.  With Sign and Magnitude the Sign controls the polarity of voltage (either positive or negative) and the PWM pulse controls the fraction of time the voltage is applied.  The voltage is applied for some fraction of the time period and zero volts are applied for the remainder.  With Anti-phase there is no Direction Output required.  Instead both positive and negative voltages are applied every cycle.  Equal amounts of positive and negative voltage results in effectively zero volts.  With KFLOP's 8-bit PWMs setting a PWM value of 128 will result in equal positive and negative times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
See the example below &amp;quot;OutputToPWM_sign_mag_single_axis.c&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;#include &amp;quot;KMotionDef.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// Send Servo Output to PWM as Sign/mag&lt;br /&gt;
&lt;br /&gt;
#define MAXPWM 242&lt;br /&gt;
#define DIR_BIT0 30&lt;br /&gt;
&lt;br /&gt;
void OutputSignMag(int ch, int pwm, int dir_bit);&lt;br /&gt;
&lt;br /&gt;
main()&lt;br /&gt;
{&lt;br /&gt;
	SetBitDirection(26,1);  		// Set bit 26 (PWM 0 as an output)&lt;br /&gt;
	SetBitDirection(DIR_BIT0,1);	// Set bit 30 (Direction an output)&lt;br /&gt;
	FPGA(IO_PWMS_PRESCALE) = 1;  	// set pwm period to 30 KHz&lt;br /&gt;
	FPGA(IO_PWMS+1) = 1;			// enable the PWM&lt;br /&gt;
&lt;br /&gt;
	for (;;)  //loop forever&lt;br /&gt;
	{&lt;br /&gt;
		WaitNextTimeSlice();&lt;br /&gt;
		OutputSignMag(0,0,DIR_BIT0);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// put the servo Output to a specified PWM channel &lt;br /&gt;
// and direction bit in signed and magnitude mode&lt;br /&gt;
&lt;br /&gt;
void OutputSignMag(int ch, int pwm, int dir_bit)&lt;br /&gt;
{&lt;br /&gt;
	if (chan[ch].Enable)&lt;br /&gt;
	{&lt;br /&gt;
		if (chan[ch].Output &amp;gt;= 0)&lt;br /&gt;
		{&lt;br /&gt;
			if (chan[ch].Output &amp;gt; MAXPWM) // don't go to 100%&lt;br /&gt;
				FPGA(IO_PWMS+pwm*2) = MAXPWM;  &lt;br /&gt;
			else&lt;br /&gt;
				FPGA(IO_PWMS+pwm*2) = chan[ch].Output;  &lt;br /&gt;
			SetBit(dir_bit);&lt;br /&gt;
		}&lt;br /&gt;
		else&lt;br /&gt;
		{&lt;br /&gt;
			if (chan[ch].Output &amp;lt; -MAXPWM) // don't go to 100%&lt;br /&gt;
				FPGA(IO_PWMS+pwm*2) = MAXPWM;  &lt;br /&gt;
			else&lt;br /&gt;
				FPGA(IO_PWMS+pwm*2) = -chan[ch].Output;  &lt;br /&gt;
			ClearBit(dir_bit);&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	else&lt;br /&gt;
	{&lt;br /&gt;
		FPGA(IO_PWMS+pwm*2) = 0;  // whenever not enabled put 0% duty cycle&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See the example below &amp;quot;OutputToPWM.c&amp;quot; written for an anti-phase type of H Bridge drive:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;brush:c&amp;quot;&amp;gt;#include &amp;quot;KMotionDef.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
main()&lt;br /&gt;
{&lt;br /&gt;
	SetBitDirection(26,1);  	// Set bit 26 (PWM 0 as an output)&lt;br /&gt;
	FPGA(IO_PWMS_PRESCALE) = 1;  	// set pwm period to 30 KHz&lt;br /&gt;
	FPGA(IO_PWMS+1) = 1;		// enable the PWM&lt;br /&gt;
&lt;br /&gt;
	for (;;)  //loop forever&lt;br /&gt;
	{&lt;br /&gt;
		WaitNextTimeSlice();&lt;br /&gt;
		if (ch0-&amp;gt;Enable)&lt;br /&gt;
			FPGA(IO_PWMS+0) = ch0-&amp;gt;Output + 128;  // +128 converts to anti-phase&lt;br /&gt;
		else&lt;br /&gt;
			FPGA(IO_PWMS+0) = 128;  // whenever not enabled put 50% duty cycle&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You might also search the C Programs directory for other PWM examples.&lt;/div&gt;</summary>
		<author><name>TK</name></author>	</entry>

	</feed>