private void Form1_Load(object sender, EventArgs e) { // List aviable COM ports and select last in list string[] aviablePorts = System.IO.Ports.SerialPort.GetPortNames(); for (int i = 0; i < aviablePorts.Length; i++) comboBox_COM.Items.Add(aviablePorts[i]); comboBox_COM.SelectedIndex = comboBox_COM.Items.Count - 1; // Create scope objects scopeA = Oscilloscope.CreateScope("scope_settings.ini", ""); if (scopeA != null) { scopeB = Oscilloscope.CreateScope("scope_settings.ini", ""); scopeC = Oscilloscope.CreateScope("scope_settings.ini", ""); scopeD = Oscilloscope.CreateScope("scope_settings.ini", ""); scopeE = Oscilloscope.CreateScope("scope_settings.ini", ""); scopeF = Oscilloscope.CreateScope("scope_settings.ini", ""); scopeG = Oscilloscope.CreateScope("scope_settings.ini", ""); scopeH = Oscilloscope.CreateScope("scope_settings.ini", ""); scopeI = Oscilloscope.CreateScope("scope_settings.ini", ""); scopeJ = Oscilloscope.CreateScope("scope_settings.ini", ""); scopeK = Oscilloscope.CreateScope("scope_settings.ini", ""); } // Set default scope channels comboBox_scopeA0.SelectedIndex = 0; comboBox_scopeA1.SelectedIndex = 1; comboBox_scopeA2.SelectedIndex = 2; comboBox_scopeAtrig.SelectedIndex = 0; comboBox_scopeB0.SelectedIndex = 3; comboBox_scopeB1.SelectedIndex = 4; comboBox_scopeB2.SelectedIndex = 5; comboBox_scopeBtrig.SelectedIndex = 3; comboBox_scopeC0.SelectedIndex = 6; comboBox_scopeC1.SelectedIndex = 7; comboBox_scopeC2.SelectedIndex = 8; comboBox_scopeCtrig.SelectedIndex = 6; comboBox_scopeD0.SelectedIndex = 9; comboBox_scopeD1.SelectedIndex = 10; comboBox_scopeD2.SelectedIndex = 11; comboBox_scopeDtrig.SelectedIndex = 9; comboBox_scopeE0.SelectedIndex = 12; comboBox_scopeE1.SelectedIndex = 13; comboBox_scopeE2.SelectedIndex = 14; comboBox_scopeEtrig.SelectedIndex = 12; comboBox_scopeF0.SelectedIndex = 15; comboBox_scopeF1.SelectedIndex = 16; comboBox_scopeF2.SelectedIndex = 17; comboBox_scopeFtrig.SelectedIndex = 15; comboBox_scopeG0.SelectedIndex = 18; comboBox_scopeG1.SelectedIndex = 19; comboBox_scopeG2.SelectedIndex = 20; comboBox_scopeGtrig.SelectedIndex = 18; comboBox_scopeH0.SelectedIndex = 21; comboBox_scopeH1.SelectedIndex = 22; comboBox_scopeH2.SelectedIndex = 23; comboBox_scopeHtrig.SelectedIndex = 21; comboBox_scopeI0.SelectedIndex = 24; comboBox_scopeI1.SelectedIndex = 25; comboBox_scopeI2.SelectedIndex = 26; comboBox_scopeItrig.SelectedIndex = 24; comboBox_scopeJ0.SelectedIndex = 27; comboBox_scopeJ1.SelectedIndex = 28; comboBox_scopeJ2.SelectedIndex = 29; comboBox_scopeJtrig.SelectedIndex = 28; comboBox_scopeK0.SelectedIndex = 30; comboBox_scopeK1.SelectedIndex = 31; comboBox_scopeK2.SelectedIndex = 0; comboBox_scopeKtrig.SelectedIndex = 30; // Show scopes else disable controls if .ini file file not present if (scopeA != null) { //button_scopeAshow.PerformClick(); //button_scopeBshow.PerformClick(); //button_scopeCshow.PerformClick(); //button_scopeDshow.PerformClick(); //button_scopeEshow.PerformClick(); //button_scopeFshow.PerformClick(); //button_scopeGshow.PerformClick(); //button_scopeHshow.PerformClick(); //button_scopeIshow.PerformClick(); //button_scopeJshow.PerformClick(); //button_scopeKshow.PerformClick(); } else { button_scopeAshow.Enabled = false; button_scopeBshow.Enabled = false; button_scopeCshow.Enabled = false; button_scopeDshow.Enabled = false; button_scopeEshow.Enabled = false; button_scopeFshow.Enabled = false; button_scopeGshow.Enabled = false; button_scopeHshow.Enabled = false; button_scopeIshow.Enabled = false; button_scopeJshow.Enabled = false; button_scopeKshow.Enabled = false; } // Create new DAQ32 data object data = new DAQ32data(); // Start for update timer formUpdateTimer = new Timer(); formUpdateTimer.Interval = 50; formUpdateTimer.Tick += new EventHandler(formUpdateTimer_Tick); formUpdateTimer.Start(); }
private void Form1_Load(object sender, EventArgs e) { // List aviable COM ports and select last in list string[] aviablePorts = System.IO.Ports.SerialPort.GetPortNames(); for (int i = 0; i < aviablePorts.Length; i++) comboBox_COM.Items.Add(aviablePorts[i]); comboBox_COM.SelectedIndex = comboBox_COM.Items.Count - 1; // Create scope objects scopeA = Oscilloscope.CreateScope("scope_settings.ini", ""); if (scopeA != null) { scopeB = Oscilloscope.CreateScope("scope_settings.ini", ""); scopeC = Oscilloscope.CreateScope("scope_settings.ini", ""); scopeD = Oscilloscope.CreateScope("scope_settings.ini", ""); } // Set default scope channels comboBox_scopeA0.SelectedIndex = 0; comboBox_scopeA1.SelectedIndex = 1; comboBox_scopeA2.SelectedIndex = 2; comboBox_scopeAtrig.SelectedIndex = 12; comboBox_scopeB0.SelectedIndex = 3; comboBox_scopeB1.SelectedIndex = 4; comboBox_scopeB2.SelectedIndex = 5; comboBox_scopeBtrig.SelectedIndex = 13; comboBox_scopeC0.SelectedIndex = 6; comboBox_scopeC1.SelectedIndex = 7; comboBox_scopeC2.SelectedIndex = 8; comboBox_scopeCtrig.SelectedIndex = 14; comboBox_scopeD0.SelectedIndex = 9; comboBox_scopeD1.SelectedIndex = 10; comboBox_scopeD2.SelectedIndex = 11; comboBox_scopeDtrig.SelectedIndex = 15; // Show scopes (else disable scope form controls if .dll error) if (scopeA != null) scopeA.ShowScope(); else { label_scopeA.Enabled = false; comboBox_scopeA0.Enabled = false; comboBox_scopeA1.Enabled = false; comboBox_scopeA2.Enabled = false; comboBox_scopeAtrig.Enabled = false; } if (scopeB != null) scopeB.ShowScope(); else { label_scopeB.Enabled = false; comboBox_scopeB0.Enabled = false; comboBox_scopeB1.Enabled = false; comboBox_scopeB2.Enabled = false; comboBox_scopeBtrig.Enabled = false; } if (scopeC != null) scopeC.ShowScope(); else { label_scopeC.Enabled = false; comboBox_scopeC0.Enabled = false; comboBox_scopeC1.Enabled = false; comboBox_scopeC2.Enabled = false; comboBox_scopeCtrig.Enabled = false; } if (scopeD != null) scopeD.ShowScope(); else { label_scopeD.Enabled = false; comboBox_scopeD0.Enabled = false; comboBox_scopeD1.Enabled = false; comboBox_scopeD2.Enabled = false; comboBox_scopeDtrig.Enabled = false; } // Create new DAQ32 data object data = new DAQ32data(); // Start for update timer formUpdateTimer = new Timer(); formUpdateTimer.Interval = 50; formUpdateTimer.Tick += new EventHandler(formUpdateTimer_Tick); formUpdateTimer.Start(); }
private void Form1_Load(object sender, EventArgs e) { // List aviable COM ports and select last in list string[] aviablePorts = System.IO.Ports.SerialPort.GetPortNames(); for (int i = 0; i < aviablePorts.Length; i++) comboBox_COM.Items.Add(aviablePorts[i]); comboBox_COM.SelectedIndex = comboBox_COM.Items.Count - 1; // Create scope objects scopeA = Oscilloscope.CreateScope(iniFileName, ""); if (scopeA != null) { scopeB = Oscilloscope.CreateScope(iniFileName, ""); scopeC = Oscilloscope.CreateScope(iniFileName, ""); scopeD = Oscilloscope.CreateScope(iniFileName, ""); } // Set default scope channels comboBox_scopeA0.SelectedIndex = 0; comboBox_scopeA1.SelectedIndex = 1; comboBox_scopeA2.SelectedIndex = 2; comboBox_scopeAtrig.SelectedIndex = 12; comboBox_scopeB0.SelectedIndex = 3; comboBox_scopeB1.SelectedIndex = 4; comboBox_scopeB2.SelectedIndex = 5; comboBox_scopeBtrig.SelectedIndex = 13; comboBox_scopeC0.SelectedIndex = 6; comboBox_scopeC1.SelectedIndex = 7; comboBox_scopeC2.SelectedIndex = 8; comboBox_scopeCtrig.SelectedIndex = 14; comboBox_scopeD0.SelectedIndex = 9; comboBox_scopeD1.SelectedIndex = 10; comboBox_scopeD2.SelectedIndex = 11; comboBox_scopeDtrig.SelectedIndex = 15; // Show scopes and use default settings if .ini file file not present if (scopeA != null) { scopeA.ShowScope(); scopeB.ShowScope(); scopeC.ShowScope(); scopeD.ShowScope(); if (!File.Exists(iniFileName)) { #region default scope settings scopeA.TriggerLevel1 = 2048; scopeA.TriggerLevel2 = 2048; scopeA.TriggerLevel3 = 2048; scopeA.AmplitudeScale1 = 300; scopeA.AmplitudeScale2 = 300; scopeA.AmplitudeScale3 = 300; scopeA.VerticalOffset1 = -2000; scopeA.VerticalOffset2 = -2000; scopeA.VerticalOffset3 = -2000; scopeA.SamplesPerGridCell = 100; scopeA.CellSize = 35; scopeA.Width = 630; scopeA.Height = 470; scopeB.TriggerLevel1 = 2048; scopeB.TriggerLevel2 = 2048; scopeB.TriggerLevel3 = 2048; scopeB.AmplitudeScale1 = 300; scopeB.AmplitudeScale2 = 300; scopeB.AmplitudeScale3 = 300; scopeB.VerticalOffset1 = -2000; scopeB.VerticalOffset2 = -2000; scopeB.VerticalOffset3 = -2000; scopeB.SamplesPerGridCell = 100; scopeB.CellSize = 35; scopeB.Width = 630; scopeB.Height = 470; scopeC.TriggerLevel1 = 2048; scopeC.TriggerLevel2 = 2048; scopeC.TriggerLevel3 = 2048; scopeC.AmplitudeScale1 = 300; scopeC.AmplitudeScale2 = 300; scopeC.AmplitudeScale3 = 300; scopeC.VerticalOffset1 = -2000; scopeC.VerticalOffset2 = -2000; scopeC.VerticalOffset3 = -2000; scopeC.SamplesPerGridCell = 100; scopeC.CellSize = 35; scopeC.Width = 630; scopeC.Height = 470; scopeD.TriggerLevel1 = 2048; scopeD.TriggerLevel2 = 2048; scopeD.TriggerLevel3 = 2048; scopeD.AmplitudeScale1 = 300; scopeD.AmplitudeScale2 = 300; scopeD.AmplitudeScale3 = 300; scopeD.VerticalOffset1 = -2000; scopeD.VerticalOffset2 = -2000; scopeD.VerticalOffset3 = -2000; scopeD.SamplesPerGridCell = 100; scopeD.CellSize = 35; scopeD.Width = 630; scopeD.Height = 470; #endregion } } // disable scope form controls if scope .dll error else { label_scopeA.Enabled = false; comboBox_scopeA0.Enabled = false; comboBox_scopeA1.Enabled = false; comboBox_scopeA2.Enabled = false; comboBox_scopeAtrig.Enabled = false; label_scopeB.Enabled = false; comboBox_scopeB0.Enabled = false; comboBox_scopeB1.Enabled = false; comboBox_scopeB2.Enabled = false; comboBox_scopeBtrig.Enabled = false; label_scopeC.Enabled = false; comboBox_scopeC0.Enabled = false; comboBox_scopeC1.Enabled = false; comboBox_scopeC2.Enabled = false; comboBox_scopeCtrig.Enabled = false; label_scopeD.Enabled = false; comboBox_scopeD0.Enabled = false; comboBox_scopeD1.Enabled = false; comboBox_scopeD2.Enabled = false; comboBox_scopeDtrig.Enabled = false; } // Create new DAQ32 data object data = new DAQ32data(); // Start for update timer formUpdateTimer = new Timer(); formUpdateTimer.Interval = 50; formUpdateTimer.Tick += new EventHandler(formUpdateTimer_Tick); formUpdateTimer.Start(); }