Decoder Programming Lock

== Decoder Lock ==
Configuration Variables 15 and 16.
Digital Command Control users may install additional function or sound decoders in a single locomotive in addition to its primary multifunction decoder. These decoders share a single address. Any commands sent to that address will be acted on by all the decoders. 
:As the complexity of multifunction decoders has increased, the need to install function or sound decoders to supplement the multifunction decoder has diminished. 
Common uses of the decoder lock feature are for programming separate decoders for motor control and sound, and/or additional function only decoders. This process is also used with a RailCom transmitter installed in the vehicle. Decoder Lock can also be used to prevent accidental programming or reset of a decoder.
Since decoders sharing the same address will need to have their CVs adjusted separately, a method to communicate with only one of multiple decoders installed in a vehicle was needed. One method was to give the decoders differing addresses, but that can be difficult in service mode programming.
You should be able to:
* Use service mode read and write from a specific decoder, with no need to disconnect other decoders electrically.
* Discover the type of decoder(s) present inside a locomotive without disassembly, despite multiple decoders being present.
 If the decoder is locked, the only CV which can be read is CV15. Attempting to read another CV results in a Decoder Not Found error. 
=== How Does the Programming Lock Work? ===
The keys to decoder locking are CVs 15 and 16.
====CV15====
CV 15 is the unlock number, set to a value from zero to seven. It is used to select the decoder that will respond to NMRA standard programming commands.
====CV16====
CV 16 carries the value that defines the decoder as suggested below. It is referred to as the locking number. It must have a unique ID, as it identifies a specific decoder in a multiple decoder installation.
As is, the decoder should have a value of 0 (zero) in CV16, as that is the as-shipped reset value, or 255, Broadcast ID, so all decoders can be programmed at the same time.
Recommended values for CV 16:
# Motor decoder
# Sound decoder
# Function only decoder
# Or Higher: Other applications as chosen by the user.
=== Lock Rule ===
* If CV15 equals CV16, all configuration values can be written.
* If CV15 does not equal CV16, only CV15 may be written to.
** If CV15 ≠ CV16, the decoder is locked and no CVs (except CV15) can be changed or read.
It was proposed that some manufacturers may wish to include an extra read only bit in certain CVs to protect their contents. This would be manufacturer specific. The NMRA may include this feature by defining a CV bit for this purpose at a later time.
The reset command will be ignored unless the rules are met, to prevent an accidental reset of all the decoders in an install.
=== Decoder Configuration ===
A proposed method of configuring the decoders is as follows:
# Connect the decoder to the programming track before installation.
# Write a value of 8 to CV8 to reset the decoder and ensure CV 15 and 16 are set to zero. Decoder reset procedures vary by manufacturer, so read the documentation.
# If you wish, check the value of CV15 to ensure it is zero.
# Write the desired identification number to CV16, such as those suggested above. Be consistent!
# Write the identification number to CV15 to enable writing to the decoder. CV15 must match CV16.
# Configure the decoder's functions.
# Install the decoder.
# Repeat as necessary. If you are only installing a single decoder in a locomotive, setting up CV15 and 16 is not required.
==== Accessing the Decoder ====
# Write the identification number defined earlier (in CV16) to CV15
# Write the other CVs. This will work when CV15 equals CV16.
# When programming is complete, set CV15 to 0 (zero) to lock the decoder.
===== Identification of the Decoders Installed =====
To identify a decoder, write 0 to CV15. Then attempt to read a 0 in CV16. If no acknowledgement is received, no decoder with CV16 equalling zero exists. The second step is to change the value in CV15, from 1 through 7, then read CV16 until an acknowledgement is received from the decoder.
===Lockable and Non-Lockable Decoders===
An older non-locking decoder can be programmed in an install with a lockable decoder by simply locking the decoder, then writing the values to the older, non-lockable decoder.
=== ESU LokSound Variation ===
ESU implements the Decoder Lock with a slight difference.
CVs 15 and 16 are used, with a range of values from 0-255. To activate the Decoder Lock feature, the Extended Configuration Variable, CV124, must have bit 2 set to ON (a value of 1).
:;As with CV29, read the values in this CV before attempting to write any changes. This CV also controls features such as the Prime Mover Delay, Bi-Directional Bit, SUSI, Enable Wheel Sensor, Motor Overload Protection, and EMK (Auto Parking Brake). Its default value is 21 for a retail decoder, which may be different for an OEM decoder.
== Notes ==
=== Digitrax ===
The Digitrax TL1 function decoder with transponding does not support Decoder Lock. It must be programmed before installation with a Multifunction Decoder. Programming changes afterwards are possible, with the exception of CV29 and any other CVs it has in common with a Digitrax multifunction decoder. It also will not accept programming commands in Operations Mode. Manufactures from other brands require the TL1 to be disconnected during programming operations.
=== TCS ===
TCS decoders may accept a 0 (zero) value in CV15 which acts as a skeleton key.
=== Lock Enable ===
Other decoders may implement a Lock Enable which is controlled by another CV.
ESU uses a Lock Enable bit in CV 124 for this purpose.
== Further Reading ==
* Multifunction Decoders
* Decoder Programming
== Locking a Multifunction Decoder ==
Category:Multifunction Decoder
Category:Programming
Category:CV
Category:Troubleshooting