<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="zkwm">
  <refmeta>
    <refentrytitle>zkwm</refentrytitle>
  </refmeta>
 
  <refnamediv>
    <refname>zkwm</refname>
    <refpurpose>
      Writes to a zk variable at k-rate with mixing.
      <indexterm id="IndexZkwm"><primary>zkwm</primary></indexterm>
    </refpurpose>
  </refnamediv>
 
  <refsect1>
    <title>Description</title>
    <para>
      Writes to a zk variable at k-rate with mixing.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis><command>zkwm</command> ksig, kndx [, imix]</synopsis>
 </refsect1>
 
  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>imix</emphasis> (optional) -- points to the zk location location to which to write.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Performance</title>
    <para>
      <emphasis>ksig</emphasis> -- value to be written to the zk location.
    </para>

    <para>
      <emphasis>kndx</emphasis> -- points to the zk or za location to which to write.
    </para>

    <para>
      <emphasis>zkwm</emphasis> is a mixing opcode, it adds the signal to the current value of the variable. If no <emphasis>imix</emphasis> is specified, mixing always occurs. <emphasis>imix</emphasis> = 0 will cause overwriting like <emphasis>ziw</emphasis>, <emphasis>zkw</emphasis>, and <emphasis>zaw</emphasis>. Any other value will cause mixing.
    </para>

    <para>
      <emphasis>Caution</emphasis>: When using the mixing opcodes <emphasis>ziwm</emphasis>, <emphasis>zkwm</emphasis>, and <emphasis>zawm</emphasis>, care must be taken that the variables mixed to, are zeroed at the end (or start) of each k- or a-cycle. Continuing to add signals to them, can cause their values can drift to astronomical figures.
    </para>

    <para>
      One approach would be to establish certain ranges of zk or za variables to be used for mixing, then use <emphasis>zkcl</emphasis> or <emphasis>zacl</emphasis> to clear those ranges.
    </para>
  </refsect1>

  <refsect1>
    <title>Examples</title>
    <para>
      Here is an example of the zkwm opcode. It uses the files <ulink url="examples/zkwm.orc"><citetitle>zkwm.orc</citetitle></ulink> and <ulink url="examples/zkwm.sco"><citetitle>zkwm.sco</citetitle></ulink>.

      <example>
        <title>Example of the zkwm opcode.</title>

        <programlisting>
<inlinemediaobject>
            <imageobject>
              <imagedata fileref="examples/zkwm.orc" format="linespecific">
            </imageobject>
          </inlinemediaobject>
        </programlisting>

        <programlisting>
<inlinemediaobject>
            <imageobject>
              <imagedata fileref="examples/zkwm.sco" format="linespecific">
            </imageobject>
          </inlinemediaobject>
        </programlisting>
      </example>
    </para>
  </refsect1>

  <refsect1>
    <title>See Also</title>
    <para>
      <link linkend="zaw"><citetitle>zaw</citetitle></link>,
      <link linkend="zawm"><citetitle>zawm</citetitle></link>,
      <link linkend="ziw"><citetitle>ziw</citetitle></link>,
      <link linkend="ziwm"><citetitle>ziwm</citetitle></link>,
      <link linkend="zkcl"><citetitle>zkcl</citetitle></link>,
      <link linkend="zkw"><citetitle>zkw</citetitle></link>,
      <link linkend="zkr"><citetitle>zkr</citetitle></link>
    </para>
  </refsect1>
 
  <refsect1>
    <title>Credits</title>
    <para>
      <simplelist>
        <member>Author: Robin Whittle</member>
        <member>Australia</member>
        <member>May 1997</member>
      </simplelist>
    </para>
    <para>Example written by &namekevin;.</para>
  </refsect1>
</refentry>
