Version 5:Indexed CVs

From Train Control Systems Documentation
Jump to navigation Jump to search

Overview

Indexed CV's use a Paging System to allow for the ability to program thousands of CV's. There are two index CV's used to select an indexed page, CV31 and CV32, which are described in detail below. CV31 controls the high byte of the index/page and CV32 controls the low byte. Once the index/page has been selected, you can read or write the CV's within the indexed page just like any other CV. The indexed CV range is from CV256 to CV512 in all cases. This is possible through the paging system, wherein changing the values of CV31 and CV32 load new definitions for those indexed CV's, allowing them to be used for different applications based on the page.

This may be complicated to understand, so here is an analogy to help visualize what is happening. An analogy for indexed CV's is to think of a filing cabinet, where CV31 selects the "drawer" and CV32 selects the "folder" within the drawer. CV's 257 to 512 are then the "files" within those folders whose data you can read and write. All of the "files" within each folder and drawer are all numbered 257 to 512, but they all represent different things because they are in different folders and drawers.

All indexed CV's can be 16-bit representations of data, be it bitwise, decimal-equivalent, or otherwise. This means that each "individual" indexed CV is made of tow 8-bit chunks, both of which should be read out to ensure accuracy. This can also be confusing if you are used to "normal" CV's where each read or write operation is only a singe step; whereas with indexed CV's, each read requires two operations, and each write could require up to two operations.

In every case for TCS' decoders which support NMRA indexed CV's, the ODD numbered indexed CV's (257, 259, etc.) correspond to the LOW BYTE of the data, and the EVEN numbered indexed CV's (258, 260, etc.) are the HIGH BYTE of the data. A value of [1] in a High Byte indexed CV is equal to a value of 255+1 in a Low Byte indexed CV. This means that the maximum value of any 16-bit indexed CV is 65,535. TCS does not divide indexed CV's into 8-bits, so in the documentation below, the numbers listed for an indexed CV number use the High Byte. The low byte of the same CV is (n-1).

NMRA CV#31
Indexed CV High Byte
Range of Values16-255
Default Value16

NMRA CV 31 - Indexed CV High Byte

The Indexed Address is the address of the indexed CV page when the decoder is set up for indexed CV operation. CV#31 contains the most significant bits of the two byte address and may have any value between 16 and 255 inclusive. Values of 0 thru 15 are reserved by the NMRA for future use. CV32 contains the least significant bits of the index address and may contain any value.

This gives a total 61,440 indexed pages each with 256 CV's in each page for a total of 15,728,640 indexed CV's!
(High byte 240 * Low Byte 256 * bytes per page 256) = total number of available CV's

See Indexed CV's for more info on using this CV.

NMRA CV#32
Indexed CV Low Byte
Range of Values0-255
Default Value0

NMRA CV 32 - Indexed CV Low Byte

The Indexed Address is the address of the indexed CV page when the decoder is set up for indexed CV operation. CV31 contains the most significant bits of the two byte address and may have any value between 16 and 255 inclusive. Values of 0 thru 15 are reserved by the NMRA for future use. CV32 contains the least significant bits of the index address and may contain any value.

This gives a total 61,440 indexed pages each with 256 CV's in each page for a total of 15,728,640 indexed CV's!
(High byte 240 * Low Byte 256 * bytes per page 256) = total number of available CV's

See Indexed CV's for more info on using this CV.

Indexed CV Data Bytes

Once values have been entered into CV 31 and CV 32, the decoder will select a "page" of data. ("Drawer" from the previous analogy.) This 'page' of data can be modified by using CV's within the range of CV 257 through CV 512. Depending on which values have been set in CV 31 and CV 32, the configurations which can be modified by CV's 257 through 512 will change.

Each configuration option will be represented within that particular page by a "High Byte" and "Low Byte," just like the CV's 31 and 32. CV's with an ODD number, such as 257, will be the Low Byte. CV's with an EVEN number will be the High Byte. Not all configuration options use both the high byte and low byte. For example, the DC Mode Bell Cutout Voltage is limited to values from 1 to 255 in the Low Byte CV.

NOTE: Indexed CV's on this wiki and throughout our documentation will be referred to by their High Byte CV number, regardless of whether or not the high byte is used.

Example

You want to change the speed of the locomotive at speed step 1 to be faster. To do this, you can program the Motor Speed Target for Speed Step 1 in the 128-Point Speed Table in the indexed CV's (Note: this table is more detailed than the 28-point "User Loadable Speed Table" defined in the standard CV range since it gives access to the speed at every speed step from 0-128 with no interpolation). The 128-point speed table is found in index 16.2, so set CV31 = 16, then set CV32 = 2. Next, you can read CV258 and CV257 to do the current value. If the High Byte (CV260) has a value that is greater than 0, multiply that value by 256, then add the value of the Low Byte (CV259) to get the total for the current value. You could then repeat this process for reading the value of Speed Step 2 (Index 262) so that you do not exceed it. Finally, select a value between the original value for Speed Step 1 and the current value of Speed Step 2, and write the value into the CV(s) for Speed Step 1.

Naturally, this process is tedious, and not for the feint of heart. Manual modification of indexed CV's does often require a lot of math. TCS is working to develop tools to make this process more user-friendly. Stay tuned!

List of Indexed CV's in Use

Specific Indexed CV numbers omitted from these tables can be assumed to be unused. To view details about the indexed CV, click on the indexed CV number to the left of the description.

NMRA Index 16.0 DC Mode Motor Control Settings (And Misc.)
Indexed CV Description
16.0.258 Startup Delay Timer
16.0.260 DC Mode Bell Cutout Voltage - Regulated Supply Mode
16.0.262 DC Mode Quill Delta - Regulated Supply Mode
16.0.264 DC Mode Start Voltage - Regulated Supply Mode
16.0.266 DC Mode Motor Hysteresis - Regulated Supply Mode
16.0.268 DC Mode Max ADC Value - Regulated Supply Mode
16.0.270 Reserved/Not Used
16.0.272 Reserved/Not Used
16.0.274 DC Mode Bell Cutout Voltage - Unregulated Supply Mode
16.0.276 DC Mode Quill Delta - Unregulated Supply Mode
16.0.278 DC Mode Start Voltage - Unregulated Supply Mode
16.0.280 DC Mode Motor Hysteresis - Unregulated Supply Mode
16.0.282 DC Mode Max ADC Value - Unregulated Supply Mode
16.0.284 Reserved/Not Used
16.0.286 Reserved/Not Used
16.0.288 to

16.0.290

Reserved/Not Used
16.0.292 Light Mapping - Auxiliary Input
16.1.257 Bootloader Hash Part 1 (LSB)
16.1.258 Bootloader Hash Part 2
16.1.259 Bootloader Hash Part 3
16.1.260 Bootloader Hash Part 4 (MSB)
16.1.261 Bootloader Month
16.1.262 Bootloader Day
16.1.263 Bootloader Year
16.1.264 Bootloader Version
16.1.265 Bootloader Hardware
16.1.266 Bootloader Processor
16.1.267 Bootloader WOWPOW Protocol Version
16.1.268 Decoder Serial Number Part 1
16.1.269 Decoder Serial Number Part 2
16.1.270 Decoder Serial Number Part 3
16.1.271 Decoder Serial Number Part 4
16.1.272 Decoder Serial Number Part 5
16.1.273 Decoder Serial Number Part 6
16.1.418 [Reserved]
... ...
16.1.432 [Reserved]
NMRA Index 16.2 Motor Speed Targets (128-Point Speed Curve)
Indexed CV Description
16.2.258 BEMF Target - Speed Step 0/128
16.2.260 BEMF Target - Speed Step 1/128
... ...
16.2.512 BEMF Target - Speed Step 127/128
NMRA Index 16.3 Not Used (reserved)
Indexed CV Description
16.3.258 N/A
16.3.260 N/A
... ...
16.3.512 N/A
NMRA Index 16.4 Sound Function Remapping
Indexed CV Description
16.4.258 Sound Mapping - Button 0
... ...
16.4.314 Sound Mapping - Button 28
16.4.316 Sound Mapping - Random Sound #1
16.4.318 Sound Mapping - Random Sound #2
16.4.320 Sound Mapping - Random Sound #3
16.4.322 Sound Mapping - Random Sound #4
16.4.324 Sound Mapping - Auxiliary Input
16.4.326 Sound Mapping - Reserved
NMRA Index 16.6 Lighting Modules (Part 1)
Indexed CV Description
16.6.258 Lighting Module 0 - Step 0 - Fade Rade
16.6.260 Lighting Module 0 - Step 0 - Start Brightness
16.6.262 Lighting Module 0 - Step 0 - End Brightness
... ...
16.6.316 Lighting Module 0 - Step 9 - End Brightness
16.6.318 Lighting Module 1 - Step 0 - Fade Rade
16.6.320 Lighting Module 1 - Step 0 - Start Brightness
16.6.322 Lighting Module 1 - Step 0 - End Brightness
... ...
16.6.376 Lighting Module 1 - Step 9 - End Brightness
16.6.378 Lighting Module 2 - Step 0 - Fade Rate
.. ...
16.6.512 Lighting Module 4 - Step 2 - Start Brightness

...Note.... As of 2-22-21, indexed CV's stop at 16.13.504 - Lighting Preset 16 - Step 9 - End Brightness

See Also