You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Sets the Railcom pin high at first tick and subsequent ticks
73
73
until its reset to setting pin 9 low at next tick.
74
74
75
-
- Cycles at 436uS so the second tick is the
75
+
- Cycles at cutoutDuration so the second tick is the
76
76
correct distance from the cutout.
77
77
78
78
- Waveform code is responsible for resetting
79
79
any time between the first and second tick.
80
80
(there will be 7 DCC timer1 ticks in which to do this.)
81
81
82
82
*/
83
-
constint cutoutDuration = 430; // Desired interval in microseconds
84
-
constint cycle=cutoutDuration/2;
83
+
constint Tcs=(26+32)/2; // half way spec Desired time from idealised setup call (at previous DCC timer interrupt) to the cutout.
84
+
constint Tce=(454+488)/2; // half way spec (460..480uS) Time from start of cutout to end of cutout.
85
+
constint cutoutDuration = Tce-Tcs; // Desired interval in microseconds
86
+
constint cycle=(cutoutDuration+1)/2; //
85
87
86
-
const byte RailcomFudge0=58+58+29;
88
+
const byte delayBeforeCutout=58+58+Tcs; // Expected time from idealised setup call (at previous DCC timer interrupt) to the cutout. This is the time we need to wait before we can set pin 9 high. We will then set pin 9 low at the next tick which is cutoutDuration later. This value should be reduced to reflect the Timer1 value measuring the time since the previous hardware interrupt.
87
89
88
90
// Set Timer2 to CTC mode with set on compare match
0 commit comments