Skip to main content
The easiest way to create a new decoder definition is to edit one that already exists that has parameters similar to your new decoder. Hundreds of decoder definitions are available in JMRI, so you should be able to find one that is similar as a starting point. Don't feel bad about standing on someone else's shoulders, that's the spirit of JMRI and open source software in general. Although you can call this new file anything you like, it will work best if you use the same convention as the provided files. That is "manufacturer name"_"decoder family".xml, for example: Digitrax_1x2.xml and Atlas_DualMode.xml.
Now that you have located a Decoder Definition file as a starting point open the file with an XML editor (editors recommended by JMRI are discussed on a separate page) or your favorite text editor. DO NOT try an advanced word processor like Word. Use a basic text file editor like Notepad, or an XML editor, XML Marker is a good one and it's free.
The beginning XML lines deal with the Header:
Decoder Family and Model
Programming modes the decoder will accept:
The next part of the file consists of a set of 'variable' elements defining specific variables, nested inside a 'variables' (note the extra "s") element. Here's where the real definition is determined.
Each variable represents one thing to configure. They can represent a single CV, e.g. address, or a few bits that can be configured to control a particular function. If some of these aren't appropriate to your decoder, you can just remove them. Make sure you remove the entire element from the <variable> to the matching </variable>. You can also rearrange them if you'd prefer a different sequence.
Once you get your variables all in order, it's time to test the definition.