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!

DCC packet for turning headlight on/off

1016 views
3 replies
1 rating 2 rating 3 rating 4 rating 5 rating
  • Member since
    October 2015
  • 188 posts
Posted by passenger1955 on Wednesday, November 2, 2016 9:41 PM

The preamble and error check are managed. I was just asking about my syntax on the packet to make sure its correct. Thanks.

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Wednesday, November 2, 2016 6:11 PM

 nOt sure how you are trying to use this, but if you are trying to build your own command station, ideally it should have a packet send routine that takes care of the housekeeping stuff such as the preamble and error detection calculation so you would feed is just the actual packet information and not have to worry about adding that each time. Rough pseudocode:

senddccpacket(packet)

    checksum = calcchecksum(packet)

    output = preamble & packet & checkum

    dccout(output)

                                --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
    February 2007
  • From: Christiana, TN
  • 2,134 posts
Posted by CSX Robert on Wednesday, November 2, 2016 11:29 AM

I believe this is correct, assuming an active primary address of '3' and 28/128 speed step bit of CV29 (bit 1) set, except that you do not have the error detection byte.  Also, your pre-amble (the first 12 1's) should be at least 14 bits.  Decoders are supposed to require no more than 12, but the spec states that the command station should send at least 14.

  • Member since
    October 2015
  • 188 posts
DCC packet for turning headlight on/off
Posted by passenger1955 on Tuesday, November 1, 2016 8:16 PM

Are these the correct packets for turning F0 (headlight) on/off?

Headlight 0n (F0)    111111111111    0    00000011    0    10010000    0        1
Headlight 0ff (F0)    111111111111    0    00000011    0    10000000    0        1

This is regardless of what speed the train is traveling - correct?

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!