// Test the square wave frequencies supported by the clock (oscilloscope or interrupt handler useful here). public static void TestSquareWaves(ref DS1307 clock) { Debug.Print("1Hz frequency test"); clock.SetSquareWave(DS1307.SQWFreq.SQW_1Hz, DS1307.SQWDisabledOutputControl.One); Thread.Sleep(5 * 1000); Debug.Print("4kHz frequency test"); clock.SetSquareWave(DS1307.SQWFreq.SQW_4kHz, DS1307.SQWDisabledOutputControl.One); Thread.Sleep(5 * 1000); Debug.Print("8kHz frequency test"); clock.SetSquareWave(DS1307.SQWFreq.SQW_8kHz, DS1307.SQWDisabledOutputControl.One); Thread.Sleep(5 * 1000); Debug.Print("32kHz frequency test"); clock.SetSquareWave(DS1307.SQWFreq.SQW_32kHz, DS1307.SQWDisabledOutputControl.One); Thread.Sleep(5 * 1000); // Test the logic levels when the oscillator is off clock.Halt(true); // No frequency, square wave output pin pulled high Debug.Print("Square Wave disabled, square wave output pin pulled high"); clock.SetSquareWave(DS1307.SQWFreq.SQW_OFF, DS1307.SQWDisabledOutputControl.One); Thread.Sleep(5 * 1000); // No frequency, square wave output pin pulled low Debug.Print("Square Wave disabled, square wave output pin pulled low"); clock.SetSquareWave(DS1307.SQWFreq.SQW_OFF, DS1307.SQWDisabledOutputControl.Zero); Thread.Sleep(5 * 1000); // Resume the oscillator clock.Halt(false); }