<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="../XSLT/decoder.xsl"?>
<!DOCTYPE decoder-config SYSTEM "../DTD/decoder-config.dtd">

<!--Copyright (C) JMRI 2003, 2004, 2008 All rights reserved -->
<!--$Id: ESU_Bachman_3_function.xml,v 1.2 2009/09/03 22:35:41 jacobsen Exp $ -->
<!--                                                                        -->
<!-- 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>
		<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) -->

<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" >
			<size length="25.5" width="15.5" height="4.5" units="mm" />
			<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" />
		</model>
	</family>

	<programming direct="yes" paged="yes"
	                     register="yes" ops="yes"></programming>

	<variables>

		<variable label="Short Address" CV="1" default="3"
			item="Short Address"
			tooltip="2 digit address (Range 01-0128)">
			<shortAddressVal min="01" max="128"/>
            	</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"/>
		</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"/>
		</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"/>
		</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"/>
		</variable>

		<variable label="Software Version Number" CV="7"
			item="Decoder Version"
			tooltip="The decoder version number (read only) CV7" >
			<decVal/>
		</variable>

		<variable label="Manufacturer ID" CV="8" readOnly="yes" default="151"
			item="Manufacturer"
			tooltip="The manufacturer's ID number (read only) CV8">
			<decVal/>
		</variable>

		<variable label="Long Address" CV="17"
			item="Extended Address"
			tooltip="4 digit address (Range 0128-9999)">
			<longAddressVal/>
		</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"/>
				<enumChoice choice="Reverse direction of travel"/>
			</enumVal>
		</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"/>
				<enumChoice choice="28/128"/>
			</enumVal>
		</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"/>
				<enumChoice choice="Digital + Analog Operation"/>
			</enumVal>
		</variable>

		<variable label="BEMF control" CV="49" mask="XXXXXXXV" default="1"
			item="EMF Static Config"
			tooltip="CV49" >
			<enumVal>
				<enumChoice choice="Off"/>
				<enumChoice choice="Active"/>
			</enumVal>
		</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"/>
				<enumChoice choice="Active"/>
			</enumVal>
		</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"/>
		</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"/>
		</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"/>
		</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"/>
		</variable>
	</variables>

        <resets>
		<factReset label="Reset all CVs to default values" CV="8" default="8"/>
        </resets>

</decoder>

</decoder-config>

 	  	 
