<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="../XSLT/decoder.xsl"?>
<!--Copyright (C) JMRI 2003, 2004, 2008 All rights reserved -->
<!--$Id: ESU_Bachman_3_function.xml 17977 2011-07-18 17:23:46Z zoo $ -->
<!--                                                                        -->
<!-- JMRI is free software; you can redistribute it and/or modify it under  -->
<!-- the terms of version 2 of the GNU General Public License as published  -->
<!-- by the Free Software Foundation. See the "COPYING" file for a copy     -->
<!-- of this license.                                                       -->
<!--                                                                        -->
<!-- JMRI is distributed in the hope that it will be useful, but WITHOUT    -->
<!-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or  -->
<!-- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License  -->
<!-- for more details.                                                      -->
<decoder-config xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://jmri.org/xml/schema/decoder.xsd">
  <version author="Peter Ulvestad" version="3" lastUpdated="20100401"/>
  <version author="Peter Ulvestad" version="2" lastUpdated="20090726"/>
  <version author="Ian Birchenough@talktalk.netJeff Schmaltz escopetas@comcast.net" version="1.0" lastUpdated="20080131"/>
<!--
     This decoder configuration file is based on ESU_LokPilotBasic 1.0.xml
     V 1.0, dated 20080131, by Jeff Schmaltz. Which also acknowledged
     "the contribution of many others" including Walter Thompson.

     Based on theBachmann Branchlines 3 function decoder leaflet

     This decoder XML is meant to be used with the "Comprehensive" programmer format
    
     I did not include low/high versionID because ESU CV 7 version numbers are not included in the Bachmann data and appear to be set to 0 on the decoder itself

     Any and all feedback on this file would be appreciated.

     Version History:

        1.0 - Initial release 28 Mar 2009-->
<!-- Version 2 - Added CV17 - Extended address, corrected CV4 max value and CV5 default value (Peter Ulvestad) -->
<!-- Version 3 - Fixed Extended address buttons not showing (Peter Ulvestad) -->
  <decoder>
    <family name="Bachmann" mfg="Electronic Solutions Ulm GmbH">
      <model model="EZ Command 3 function decoder (336-553)" maxInputVolts="25 V" maxMotorCurrent="0.7 A" maxTotalCurrent="1.05 A" numOuts="3" numFns="4" formFactor="HO" connector="NMRAmedium">
        <output name="1" label="Front light" maxcurrent="180 mA" connection="wire"/>
        <output name="2" label="Rear light " maxcurrent="180 mA" connection="wire"/>
        <output name="3" label="   AUX1    " maxcurrent="180 mA" connection="wire"/>
        <size length="25.5" width="15.5" height="4.5" units="mm"/>
      </model>
    </family>
    <programming direct="yes" paged="yes" register="yes" ops="yes"/>
    <variables>
      <variable label="Short Address" CV="1" default="3" item="Short Address" tooltip="2 digit address (Range 01-0128)">
        <shortAddressVal/>
        <label>Short Address</label>
      </variable>
      <variable label="Starting Voltage" CV="2" default="3" item="Vstart" tooltip="Determines the starting speed, range 1-63. CV2">
        <decVal min="1" max="63"/>
        <label>Starting Voltage</label>
      </variable>
      <variable label="Acceleration" CV="3" default="8" item="Accel" tooltip="This value multiplied by 0.5 gives the time from stop to maximum speed, range 1-63. CV3">
        <decVal min="1" max="63"/>
        <label>Acceleration</label>
      </variable>
      <variable label="Deceleration" CV="4" default="6" item="Decel" tooltip="This value multiplied by 0.5 gives the time from maximum speed to stop, range 1-63. CV4">
        <decVal min="1" max="63"/>
        <label>Deceleration</label>
      </variable>
      <variable label="Maximum Speed" CV="5" default="42" item="Vhigh" tooltip="Maximum speed of locomotive, range 1-63. CV5">
        <decVal min="1" max="63"/>
        <label>Maximum Speed</label>
      </variable>
      <variable label="Software Version Number" CV="7" item="Decoder Version" tooltip="The decoder version number (read only) CV7">
        <decVal/>
        <label>Software Version Number</label>
      </variable>
      <variable label="Manufacturer ID" CV="8" readOnly="yes" default="151" item="Manufacturer" tooltip="The manufacturer's ID number (read only) CV8">
        <decVal/>
        <label>Manufacturer ID</label>
      </variable>
      <variable label="Long Address" CV="17" item="Extended Address" tooltip="4 digit address (Range 0128-9999)">
        <longAddressVal/>
        <label>Long Address</label>
      </variable>
      <variable label="Addressing Mode" CV="29" mask="XXVXXXXX" item="Address Format" tooltip="CV29 ['32' bit] sets the Addressing Mode">
        <enumVal>
          <enumChoice choice="2 digit addressing">
            <choice>2 digit addressing</choice>
          </enumChoice>
          <enumChoice choice="4 digit addressing">
            <choice>4 digit addressing</choice>
          </enumChoice>
        </enumVal>
        <label>Addressing Mode</label>
      </variable>
      <variable label="Direction of Travel" CV="29" mask="XXXXXXXV" default="0" item="Locomotive Direction" tooltip="Sets the relative direction of the loco when told to move forward CV29">
        <enumVal>
          <enumChoice choice="Normal direction of travel">
            <choice>Normal direction of travel</choice>
          </enumChoice>
          <enumChoice choice="Reverse direction of travel">
            <choice>Reverse direction of travel</choice>
          </enumChoice>
        </enumVal>
        <label>Direction of Travel</label>
      </variable>
      <variable label="Speed Steps" CV="29" mask="XXXXXXVX" default="1" item="Speed Step Mode" tooltip="Sets the speed step mode. 128 speed steps are recognized automatically CV29">
        <enumVal>
          <enumChoice choice="14">
            <choice>14</choice>
          </enumChoice>
          <enumChoice choice="28/128">
            <choice>28/128</choice>
          </enumChoice>
        </enumVal>
        <label>Speed Steps</label>
      </variable>
      <variable label="Analogue mode" CV="29" mask="XXXXXVXX" default="1" item="Analog (DC) Operation" tooltip="Determines whether loco can operate on conventional DC current (enables Power Source Conversion) CV29">
        <enumVal>
          <enumChoice choice="Digital Operation Only">
            <choice>Digital Operation Only</choice>
          </enumChoice>
          <enumChoice choice="Digital + Analog Operation">
            <choice>Digital + Analog Operation</choice>
          </enumChoice>
        </enumVal>
        <label>Analogue mode</label>
      </variable>
      <variable label="BEMF control" CV="49" mask="XXXXXXXV" default="1" item="EMF Static Config" tooltip="CV49">
        <enumVal>
          <enumChoice choice="Off">
            <choice>Off</choice>
          </enumChoice>
          <enumChoice choice="Active">
            <choice>Active</choice>
          </enumChoice>
        </enumVal>
        <label>BEMF control</label>
      </variable>
      <variable label="DC Brake Control Mode" CV="51" mask="XXXXXXXV" default="1" item="Dither option" tooltip="Supports Lenz DC brake sections CV51">
        <enumVal>
          <enumChoice choice="Off">
            <choice>Off</choice>
          </enumChoice>
          <enumChoice choice="Active">
            <choice>Active</choice>
          </enumChoice>
        </enumVal>
        <label>DC Brake Control Mode</label>
      </variable>
      <variable label="Feedback Reference" CV="53" default="42" item="Dither option" tooltip="Determines the back EMF supplied by the motor at Max speed. The more efficient the motor the higher this value should be. 0-63 default=42.">
        <decVal min="0" max="63"/>
        <label>Feedback Reference</label>
      </variable>
      <variable label="Load control parameter K" CV="54" default="32" item="EMF Dynamic Config" tooltip="Determines how strongly load control effects, range 0-63. CV54">
        <decVal min="0" max="63"/>
        <label>Load control parameter K</label>
      </variable>
      <variable label="Load control parameter I" CV="55" default="24" item="EMF Droop Config" tooltip="Determines the momentum of the motor, range 0-63. CV55">
        <decVal min="0" max="63"/>
        <label>Load control parameter I</label>
      </variable>
      <variable label="Lamp brightness" CV="63" default="7" item="Global lighting option 1" tooltip="Defines the brightness of the function outputs, range 0-7, CV63">
        <decVal min="0" max="7"/>
        <label>Lamp brightness</label>
      </variable>
    </variables>
    <resets>
      <factReset label="Reset all CVs to default values" CV="8" default="8"/>
    </resets>
  </decoder>
</decoder-config>

