// port 0x43 public void WriteControlWord(byte data) { // control word (bits 7-0) // SC1-SC0-RL1-RL0-M2-M1-M0-BCD // Set the mode of the timer (0=latch, 1=LSB, 2=MSB, 3=both) byte sc = (byte)(data >> 6); byte rl = (byte)((data >> 4) & 0x03); TimerAccessMode mode = (TimerAccessMode)rl; if (sc == 0) { if (_timer.ThreadState == System.Threading.ThreadState.Running) { _stopTimer = true; } } _timers[sc].accessMode = mode; if (mode == TimerAccessMode.Latch || mode == TimerAccessMode.BothBytes) { _timers[sc].toggleMode = TimerAccessMode.LoByte; } }
// port 0x43 private void WriteControlWord(byte data) { // control word (bits 7-0) // SC1-SC0-RL1-RL0-M2-M1-M0-BCD // Set the mode of the timer (0=latch, 1=LSB, 2=MSB, 3=both) byte sc = (byte)(data >> 6); byte rl = (byte)((data >> 4) & 0x03); TimerAccessMode mode = (TimerAccessMode)rl; Timers[sc].AccessMode = mode; if (mode == TimerAccessMode.Latch || mode == TimerAccessMode.BothBytes) { Timers[sc].ToggleMode = TimerAccessMode.LoByte; } }