Trains.com

Subscriber & Member Login

Login, or register today to interact in our online community, comment on articles, receive our newsletter, manage your account online and more!

How to send a CV write packet

799 views
5 replies
1 rating 2 rating 3 rating 4 rating 5 rating
  • Member since
    October 2015
  • 188 posts
How to send a CV write packet
Posted by passenger1955 on Saturday, April 27, 2019 12:18 PM

I'm trying to understand how to send a CV write packet in Ops mode, and I want to make sure my syntax is correct. For my example, I'm using a decoder with the address 3, and I am attempting to change the master volume (which for this decoder is CV128) to 50. I am referencing the NMRA extended packet doc 9.2.1 line 376, which has the command syntax:

1110CCVV 0 VVVVVVVV 0 DDDDDDDD           CC=11 Write byte          The actual Configuration Variable desired is selected via the 10-bit address with the 2-bit address (VV) in the first data byte being the most significant bits of the address. The Configuration variable being addressed is the provided 10-bit address plus 1. For example, to address CV#1 the 10 bit address is “00 00000000”.

So the first command byte for me will be: 11101100  which in decimal is: 128+64+32+8+4=236

For the second byte, I am trying to edit CV 128, so I would have 128-1 = 127

Let's pretend my decoder is address 3, and I am trying to set the volume to 50. So my entire packet in decimal would be:

3  236  127  50

Is this correct? Or have I made a mistake?

Moderator
  • Member since
    June 2003
  • From: Northeast OH
  • 17,249 posts
Posted by tstage on Saturday, April 27, 2019 12:26 PM

What decoder are you using and what DCC system are you programming it with?  Why not just change CV128 to a value of 50 in OPS mode - i.e. call up CV128 in OPs mode, enter "50", and exit OPs mode.

Seems like you are taking the hypotenuse (convoluted) approach to programming CVs.  Some CV settings are indexed and do require changing one or more CVs in order to alter an embedded CV.  IIRC, master volume is not one of those.

Tom

https://tstage9.wixsite.com/nyc-modeling

Time...It marches on...without ever turning around to see if anyone is even keeping in step.

  • Member since
    October 2015
  • 188 posts
Posted by passenger1955 on Saturday, April 27, 2019 12:34 PM
My goal here is learn the correct syntax
  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Saturday, April 27, 2019 1:00 PM

 Everything gets transmitted in bits, so those 0 bits between the bytes must be included in the data stream. 

 It looks ok. Note you have to send the CV programming data TWICE for it to be accepted. See line 395.

                                       --Randy

 


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    October 2015
  • 188 posts
Posted by passenger1955 on Saturday, April 27, 2019 1:05 PM

That was it - I was not sending the command twice. It's working now. Thank you very much!

  • Member since
    October 2015
  • 188 posts
Posted by passenger1955 on Saturday, April 27, 2019 1:25 PM
Thanks again. So for bit manipulation, do I have to send the command twice as well? I don't see that in the documentation, so maybe I don't.

Subscriber & Member Login

Login, or register today to interact in our online community, comment on articles, receive our newsletter, manage your account online and more!

Users Online

There are no community member online

Search the Community

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
Model Railroader Newsletter See all
Sign up for our FREE e-newsletter and get model railroad news in your inbox!