Beispiel #1
0
        private void button18_Click(object sender, EventArgs e)
        {
            if (imp_mode == false)
            {
                UInt32   imp_length_val = Convert.ToUInt32(imp_length.Text, 10), period, delay;
                UInt32[] imp_array = new UInt32[imp_length_val];
                if (imp_state1.CheckState == CheckState.Checked)
                {
                    period = Convert.ToUInt32(imp_period1.Text, 10);
                    delay  = Convert.ToUInt32(imp_delay1.Text, 10);
                    for (UInt32 j = delay; j < period + delay; j++)
                    {
                        imp_array[j] = imp_array[j] + 1;
                    }
                }
                if (imp_state2.CheckState == CheckState.Checked)
                {
                    period = Convert.ToUInt32(imp_period2.Text, 10);
                    delay  = Convert.ToUInt32(imp_delay2.Text, 10);
                    for (UInt32 j = delay; j < period + delay; j++)
                    {
                        imp_array[j] = imp_array[j] + 2;
                    }
                }
                if (imp_state3.CheckState == CheckState.Checked)
                {
                    period = Convert.ToUInt32(imp_period3.Text, 10);
                    delay  = Convert.ToUInt32(imp_delay3.Text, 10);
                    for (UInt32 j = delay; j < period + delay; j++)
                    {
                        imp_array[j] = imp_array[j] + 4;
                    }
                }
                if (imp_state4.CheckState == CheckState.Checked)
                {
                    period = Convert.ToUInt32(imp_period4.Text, 10);
                    delay  = Convert.ToUInt32(imp_delay4.Text, 10);
                    for (UInt32 j = delay; j < period + delay; j++)
                    {
                        imp_array[j] = imp_array[j] + 8;
                    }
                }
                if (imp_state5.CheckState == CheckState.Checked)
                {
                    period = Convert.ToUInt32(imp_period5.Text, 10);
                    delay  = Convert.ToUInt32(imp_delay5.Text, 10);
                    for (UInt32 j = delay; j < period + delay; j++)
                    {
                        imp_array[j] = imp_array[j] + 16;
                    }
                }
                if (imp_state6.CheckState == CheckState.Checked)
                {
                    period = Convert.ToUInt32(imp_period6.Text, 10);
                    delay  = Convert.ToUInt32(imp_delay6.Text, 10);
                    for (UInt32 j = delay; j < period + delay; j++)
                    {
                        imp_array[j] = imp_array[j] + 32;
                    }
                }
                if (imp_state7.CheckState == CheckState.Checked)
                {
                    period = Convert.ToUInt32(imp_period7.Text, 10);
                    delay  = Convert.ToUInt32(imp_delay7.Text, 10);
                    for (UInt32 j = delay; j < period + delay; j++)
                    {
                        imp_array[j] = imp_array[j] + 64;
                    }
                }
                if (imp_state8.CheckState == CheckState.Checked)
                {
                    period = Convert.ToUInt32(imp_period8.Text, 10);
                    delay  = Convert.ToUInt32(imp_delay8.Text, 10);
                    for (UInt32 j = delay; j < period + delay; j++)
                    {
                        imp_array[j] = imp_array[j] + 128;
                    }
                }
                if (imp_state9.CheckState == CheckState.Checked)
                {
                    period = Convert.ToUInt32(imp_period9.Text, 10);
                    delay  = Convert.ToUInt32(imp_delay9.Text, 10);
                    for (UInt32 j = delay; j < period + delay; j++)
                    {
                        imp_array[j] = imp_array[j] + 256;
                    }
                }
                if (imp_state10.CheckState == CheckState.Checked)
                {
                    period = Convert.ToUInt32(imp_period10.Text, 10);
                    delay  = Convert.ToUInt32(imp_delay10.Text, 10);
                    for (UInt32 j = delay; j < period + delay; j++)
                    {
                        imp_array[j] = imp_array[j] + 512;
                    }
                }
                if (imp_state11.CheckState == CheckState.Checked)
                {
                    period = Convert.ToUInt32(imp_period11.Text, 10);
                    delay  = Convert.ToUInt32(imp_delay11.Text, 10);
                    for (UInt32 j = delay; j < period + delay; j++)
                    {
                        imp_array[j] = imp_array[j] + 1024;
                    }
                }
                if (imp_state12.CheckState == CheckState.Checked)
                {
                    period = Convert.ToUInt32(imp_period12.Text, 10);
                    delay  = Convert.ToUInt32(imp_delay12.Text, 10);
                    for (UInt32 j = delay; j < period + delay; j++)
                    {
                        imp_array[j] = imp_array[j] + 2048;
                    }
                }
                if (imp_state13.CheckState == CheckState.Checked)
                {
                    period = Convert.ToUInt32(imp_period13.Text, 10);
                    delay  = Convert.ToUInt32(imp_delay13.Text, 10);
                    for (UInt32 j = delay; j < period + delay; j++)
                    {
                        imp_array[j] = imp_array[j] + 4096;
                    }
                }
                if (imp_state14.CheckState == CheckState.Checked)
                {
                    period = Convert.ToUInt32(imp_period14.Text, 10);
                    delay  = Convert.ToUInt32(imp_delay14.Text, 10);
                    for (UInt32 j = delay; j < period + delay; j++)
                    {
                        imp_array[j] = imp_array[j] + 8192;
                    }
                }
                if (imp_state15.CheckState == CheckState.Checked)
                {
                    period = Convert.ToUInt32(imp_period15.Text, 10);
                    delay  = Convert.ToUInt32(imp_delay15.Text, 10);
                    for (UInt32 j = delay; j < period + delay; j++)
                    {
                        imp_array[j] = imp_array[j] + 16384;
                    }
                }
                if (imp_state16.CheckState == CheckState.Checked)
                {
                    period = Convert.ToUInt32(imp_period16.Text, 10);
                    delay  = Convert.ToUInt32(imp_delay16.Text, 10);
                    for (UInt32 j = delay; j < period + delay; j++)
                    {
                        imp_array[j] = imp_array[j] + 32768;
                    }
                }

                imp_mode = true;
                //запись в буфер платы (постоянный режим)
                if (imp_single.CheckState == CheckState.Checked)
                {
                    hnd.StreamsEnable(X502.Streams.DOUT);
                    hnd.PreloadStart();
                    hnd.PrepareData(null, null, imp_array, imp_length_val, X502.DacOutFlags.VOLT, null);
                    hnd.Send(imp_array, imp_length_val, 10);
                    hnd.StreamsStart();
                }
                else if (imp_single.CheckState == CheckState.Unchecked)
                {
                    hnd.StreamsEnable(X502.Streams.DOUT);
                    hnd.OutCycleLoadStart(imp_length_val);
                    hnd.Send(imp_array, imp_length_val, 10);
                    hnd.OutCycleSetup(X502.OutCycleFlags.FORCE);
                    hnd.StreamsStart();
                    updateControls();
                }
            }
            else
            {
                hnd.StreamsStop();
                hnd.AsyncOutDig(0, 0);
                imp_mode = false;
                updateControls();


                imp_state1.CheckState  = CheckState.Unchecked;
                imp_state2.CheckState  = CheckState.Unchecked;
                imp_state3.CheckState  = CheckState.Unchecked;
                imp_state4.CheckState  = CheckState.Unchecked;
                imp_state5.CheckState  = CheckState.Unchecked;
                imp_state6.CheckState  = CheckState.Unchecked;
                imp_state7.CheckState  = CheckState.Unchecked;
                imp_state8.CheckState  = CheckState.Unchecked;
                imp_state9.CheckState  = CheckState.Unchecked;
                imp_state10.CheckState = CheckState.Unchecked;
                imp_state11.CheckState = CheckState.Unchecked;
                imp_state12.CheckState = CheckState.Unchecked;
                imp_state13.CheckState = CheckState.Unchecked;
                imp_state14.CheckState = CheckState.Unchecked;
                imp_state15.CheckState = CheckState.Unchecked;
                imp_state16.CheckState = CheckState.Unchecked;
            }
        }