コード例 #1
0
        private void Button6_Click(object sender, EventArgs e)
        {
            ACDCForm popup = new ACDCForm();

            calcMRBits();

            popup.setACPopupLeft(acFreq, acVoltageMode, acVoltageVal, acLimMode, acLimVal, acRangeMode, acRangeVal, acLowZ);
            popup.setACPopupRight(acTrigger, acDCBiasMode, acDCBiasVal, acSpeed, acAvg, acDelay, acSyncMode, acSyncVal);


            DialogResult dialogresult = popup.ShowDialog();

            if (dialogresult == DialogResult.OK)
            {
                //Console.WriteLine("You clicked OK");
                updateAC(popup);
                updateDC(popup);
            }
            else if (dialogresult == DialogResult.Abort)
            {
                // Console.WriteLine("You clicked either Cancel or X button in the top right corner");
            }


            popup.Dispose();
        }
コード例 #2
0
 public void updateDC(ACDCForm popup)
 {
     /*Init DC info
      * textBox18.Text = dcVoltage.ToString();
      * textBox19.Text = dcRange;
      * textBox20.Text = dcLowZ;
      * textBox21.Text = dcSpeed;
      * textBox22.Text = dcAvg;
      * textBox23.Text = dcAdj;
      * textBox24.Text = dcDelay.ToString("N5");
      * textBox25.Text = dcAdjDelay.ToString("N5");
      * textBox26.Text = dcLFreq.ToString("N5");
      */
 }
コード例 #3
0
        public void updateAC(ACDCForm popup)
        {
            //Console.WriteLine(popup.acFreq);
            acFreq        = popup.acFreq;
            acVoltageMode = popup.acVoltageMode;
            acVoltageVal  = popup.acVoltageVal;
            acLimMode     = popup.acLimMode;
            acLimVal      = popup.acLimVal;
            acRangeMode   = popup.acRangeMode;
            acRangeVal    = popup.acRangeVal;
            acLowZ        = popup.acLowZ;
            acTrigger     = popup.acTrigger;
            acDCBiasMode  = popup.acDCBiasMode;
            acDCBiasVal   = popup.acDCBiasVal;
            acSpeed       = popup.acSpeed;
            acAvg         = popup.acAvg;
            acDelay       = popup.acDelay;
            acSyncMode    = popup.acSyncMode;
            acSyncVal     = popup.acSyncVal;

            serialPort1.NewLine = Environment.NewLine; // Sets the line feed code to CR+LF

            serialPort1.Open();
            serialPort1.WriteLine(":LEV " + acVoltageMode);     // Signal level: Open-circuit voltage
            serialPort1.WriteLine(":LEV:VOLT " + acVoltageVal); // Signal level: 500 mV signal level
            serialPort1.WriteLine(":FREQ " + acFreq);           // Measurement frequency: 1kHz
            serialPort1.WriteLine(":LIM " + acLimMode);         // Set ACLimit Mode
            serialPort1.WriteLine(":LIM:VOLT " + acLimVal);     // Set ACLimit Value
            // SKIP RANGE
            serialPort1.WriteLine(":RANG:LOWZ " + acLowZ);      // Set LOWZ mode
            //TRIGGER FIXED TO EXTERNAL
            serialPort1.WriteLine(":DCB " + acDCBiasMode);      // Set (AC) DC Bias Mode
            serialPort1.WriteLine(":DCB:LEV " + acDCBiasVal);   // Set (AC) DC Bias Value
            serialPort1.WriteLine(":SPEE " + acSpeed);          // Set Speed of measurement
            serialPort1.WriteLine(":AVER " + acAvg);            // Set Speed of measurement
            serialPort1.Close();


            //Init AC info
            textBox7.Text = acFreq.ToString("N2").Replace(",", "");
            textBox8.Text = acVoltageVal.ToString();
            if (acLimMode.Equals("OFF"))
            {
                textBox9.Text = acLimMode;
            }
            else if (acLimMode.Equals("ON"))
            {
                textBox9.Text = acLimVal.ToString();
            }
            textBox10.Text = acRangeMode;
            textBox11.Text = acLowZ;
            textBox12.Text = acTrigger;
            if (acDCBiasMode.Equals("OFF"))
            {
                textBox13.Text = acDCBiasMode;
            }
            else if (acDCBiasMode.Equals("ON"))
            {
                textBox13.Text = acDCBiasVal.ToString();
            }
            textBox14.Text = acSpeed;
            textBox15.Text = acAvg.ToString();
            textBox16.Text = acDelay.ToString("N5");
            if (acSyncMode.Equals("ON"))
            {
                textBox17.Text = acSyncVal.ToString("N5");
            }
            else if (acSyncMode.Equals("OFF"))
            {
                textBox17.Text = acSyncMode;
            }
        }