State 0
State 0 is to synchronize on the preamble. It is initiated with DCC_subst set to 0.
Condition | Action | Process | Next state |
receive 0 bit | if DCC_subst < 20 set DCC_subst to 0 ELSE set DCC_subst to 8 and go to state 1 |
dca02 -> dca03 |
0 1 |
receive 1 bit | increment DCC_subst | dca04 | 0 |
State 1
State 1 verifies the second half of a "0" bit
Condition | Action | Process | Next state |
receive 0 bit | if DCC_subst == 0 go to state 4, else go to state 2 for next bit | dca07 | 2 / 4 |
receive 1 bit | set DCC_subst to 0, go to state 0 | dca01 | 0 |
State 2
State 2 processes the first half of a bit
Condition | Action | Process | Next state |
receive 0 bit | assemble "0" bit, decrement DCC_subst, go to state 1 to verify | dca05 | 1 |
receive 1 bit | assemble "1" bit, decrement DCC_subst, go to state 3 to verify | dca06 | 3 |
State 3
State 3 verifies the second half of a "1" bit
Condition | Action | Process | Next state |
receive 0 bit | set DCC_subst to 0, go to state 0 | dca01 | 0 |
receive 1 bit | if DCC_subst == 0 go to state 4, else go to state 2 for next bit | dca07 | 2 / 4 |
State 4
State 4 looks for EOM or start another byte
Condition | Action | Process | Next state |
receive 0 bit | set DCC_subst to 8, go to state 1 | dca03 | 1 |
receive 1 bit | set EOM, check checksum if used / set DCC_subst to 0 go to state 0 | dca00 -> dca01 | 0 |
|
Proc | Condition | Action |
dca00 |   | set EOM, check checksum if enabled. Fallthrough to dca01 |
dca01 |   | set DCC_subst to 0, go to state 0 |
dca02 | DCC_subst < 20 ELSE | set DCC_subst to 0, stay in state 0
fall through to dca03 |
dca03 |   | set DCC_subst to 8, go to state 1 to verify |
dca04 |   | increment DCC_subst, stay in state 0 |
dca05 |   | assemble 0, decrement DCC_subst, go to state 1 to verify |
dca06 |   | assemble 1, decrement DCC_subst, go to state 3 to verify |
dca07 | DCC_subst == 0 ELSE | process byte, go to state 4
go to state 2 for next bit |
|