DCC error byte
Basil
Posts: 380
Hi All,
Im in the process of building my own DCC command center for model railroads, but im stuck on something you might/will be able to help with.
(When I mention NMRA documents, I am refering to the standards developed by the NMRA for model railroads)
I am trying to figure out how to generate the error byte in a DCC pkacets.
With the general (baseline) packet format (according to NMRA S9.2) the error byte is simply:
address_byte ^ data_byte = error_byte
My confusion is with extended packets. NMRA RP9.2.1 says on page 2, line 97:
"The last byte of the packet is the Error Detection Byte, which is calculated the same as is done in the baseline packet using all address, and all instruction bytes (see S-9.2). "
Now lets take an example from page 11 of RP9.2.1 where an extended packet has the following format:
10AAAAAA 0AAA11VV VVVVVVVV DDDDDDDD EEEEEEEE
(EEEEEEEE being the error byte.)
To generate the error byte do I perform the following?
10AAAAAA ^ 0AAA11VV ^ VVVVVVVV ^ DDDDDDDD
Or this:
10AAAAAA ^ 0AAA11VV = temp
temp ^ VVVVVVVV = temp
temp ^ DDDDDDDD = EEEEEEEE
Im more inclined to think the second way but needed to check
Regards,
Alec
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Alec
Velden in N scale
Post Edited (Basil) : 2/12/2009 8:10:09 PM GMT
Im in the process of building my own DCC command center for model railroads, but im stuck on something you might/will be able to help with.
(When I mention NMRA documents, I am refering to the standards developed by the NMRA for model railroads)
I am trying to figure out how to generate the error byte in a DCC pkacets.
With the general (baseline) packet format (according to NMRA S9.2) the error byte is simply:
address_byte ^ data_byte = error_byte
My confusion is with extended packets. NMRA RP9.2.1 says on page 2, line 97:
"The last byte of the packet is the Error Detection Byte, which is calculated the same as is done in the baseline packet using all address, and all instruction bytes (see S-9.2). "
Now lets take an example from page 11 of RP9.2.1 where an extended packet has the following format:
10AAAAAA 0AAA11VV VVVVVVVV DDDDDDDD EEEEEEEE
(EEEEEEEE being the error byte.)
To generate the error byte do I perform the following?
10AAAAAA ^ 0AAA11VV ^ VVVVVVVV ^ DDDDDDDD
Or this:
10AAAAAA ^ 0AAA11VV = temp
temp ^ VVVVVVVV = temp
temp ^ DDDDDDDD = EEEEEEEE
Im more inclined to think the second way but needed to check
Regards,
Alec
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Alec
Velden in N scale
Post Edited (Basil) : 2/12/2009 8:10:09 PM GMT
Comments
-Phil
Do you think there are any other ways to interpret the standard I quoted?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Alec
Velden in N scale
I believe there is a DCC object in the object exchange if you haven't seen that already. I haven't used it myself yet though so I can not comment on it. I was thinking of making a DCC base station someday, but that is further down my list of items to make/build at the moment. Do keep me posted on your progress.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Timothy D. Swieter, E.I.
www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, uOLED-IOC, eProto for SunSPOT, BitScope
www.tdswieter.com
I found the DCC object but unfortunately it requires you send the error byte to it just as with all the other bytes
I will surely keep you posted. My blog (see my sig) has updates of my progress also. Not much at the moment but it will grow [noparse]:)[/noparse]
Phil,
I drew up a drew truth tables and I think I must be bgetting something wrong because this
10AAAAAA ^ 0AAA11VV ^ VVVVVVVV ^ DDDDDDDD
gives me a different result to
10AAAAAA ^ 0AAA11VV = temp
temp ^ VVVVVVVV = temp
temp ^ DDDDDDDD = EEEEEEEE
Here are my truth tables. I must be doing something wrong in the first one.
(All bytes are fabricated and mean nothing BTW)
(Note I am using 4 bytes not 3, but its the same principle)
Using method '10AAAAAA ^ 0AAA11VV ^ VVVVVVVV ^ DDDDDDDD':
A 1011_0010
B 1100_1010
C 1010_0110
D 0110_1101
E 0001_0001 <----result
And using method:
10AAAAAA ^ 0AAA11VV = temp
temp ^ VVVVVVVV = temp
temp ^ DDDDDDDD = EEEEEEEE
A 1011_0010
B 1100_1010
E 0111_1000
E 0111_1000
C 1010_0110
E 1101_1110
E 1101_1110
D 0110_1101
E 1011_0011 <----result
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Alec
Velden in N scale
Thanks [noparse]:D[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Alec
Velden in N scale