Esempio n. 1
0
        public void send()
        {
            double val = System.Convert.ToDouble(maskedTextBox1.Text);

            if (val >= 0 && val <= 100)
            {
                SerialBoardDriver.WriteData(0x378, 0, 0, _index, 3, val);
            }
            else
            {
                MessageBox.Show("Please enter a value between 0 and 100");
            }
        }
Esempio n. 2
0
 private void btn_CLK_Click(object sender, EventArgs e)
 {
     //22 = signal, 24 = clock
     if (flag == 0)
     {
         SerialBoardDriver.WriteData(0x378, 0, 0, 24, 3, 100);
         controls[24].maskedTextBox1.Text = "100";
         flag         = 1;
         lbl_CLK.Text = System.Convert.ToString(flag);
     }
     else
     {
         SerialBoardDriver.WriteData(0x378, 0, 0, 24, 3, 0);
         flag         = 0;
         lbl_CLK.Text = System.Convert.ToString(flag);
         controls[24].maskedTextBox1.Text = "0";
     }
 }
Esempio n. 3
0
 public void reset()
 {
     SerialBoardDriver.WriteData(0x378, 0, 0, _index, 3, 0);
     maskedTextBox1.Text = "0";
 }
Esempio n. 4
0
        private void btn_Parse_Click(object sender, EventArgs e)
        {
            code = textBox1.Text.ToUpper().ToCharArray();
            int    i = 0;
            String temp;
            bool   flag = false;

            while (i < code.Length - 1 && flag == false)
            {
                switch (code[i])
                {
                default:
                    i++;
                    break;

                case 'S':
                    if (code[i + 1] == 'T' && code[i + 2] == 'O' && code[i + 3] == 'P')
                    {
                        flag = true;
                        return;
                    }
                    break;

                case 'W':
                    i++;
                    switch (code[i])
                    {
                    case 'S':         //seconds
                        i++;
                        temp = new String('0', 0);
                        while ((code[i] >= '0' && code[i] <= '9') || i == code.Length)
                        {
                            temp += code[i];
                            if (i == code.Length - 1)
                            {
                                break;
                            }
                            i++;
                        }
                        WaitS(System.Convert.ToInt16(temp));
                        break;

                    case 'M':         //minutes
                        i++;
                        temp = new String('0', 0);
                        while ((code[i] >= '0' && code[i] <= '9') || i == code.Length)
                        {
                            temp += code[i];
                            if (i == code.Length - 1)
                            {
                                break;
                            }
                            i++;
                        }
                        WaitM(System.Convert.ToInt16(temp));
                        break;

                    case 'H':         //hours
                        i++;
                        temp = new String('0', 0);
                        while ((code[i] >= '0' && code[i] <= '9') || i == code.Length)
                        {
                            temp += code[i];
                            if (i == code.Length - 1)
                            {
                                break;
                            }
                            i++;
                        }
                        WaitH(System.Convert.ToInt16(temp));
                        break;
                    }
                    break;

                case 'R':
                    if (code[++i] == 'A')
                    {
                        for (int x = 0; x < Form1.getnumPorts(); x++)
                        {
                            SerialBoardDriver.reset(x);     //reset all
                        }
                    }
                    i++;
                    break;

                case 'P':
                    i++;

                    string temp2 = new string('0', 0);
                    while (code[i] >= '0' && code[i] <= '9')
                    {
                        temp2 += code[i];
                        if (i == code.Length - 1)
                        {
                            break;
                        }
                        i++;
                    }
                    int port = System.Convert.ToInt16(temp2);
                    i++;
                    temp = new String('0', 0);
                    while (code[i] >= '0' && code[i] <= '9')
                    {
                        temp += code[i];
                        if (i == code.Length - 1)
                        {
                            break;
                        }
                        i++;
                    }
                    double voltage = System.Convert.ToDouble(temp);
                    SerialBoardDriver.WriteData(0x378, 0, 0, port, 3, voltage);
                    Form1.controls[port].maskedTextBox1.Text = String.Copy(temp);
                    break;
                }
            }
            MessageBox.Show("The code has stopped running.");
        }