public modulacaoSenoidal(PaginaInicial parent, tela1 tela1, int tamanho_palavra)
 {
     this.parent = parent;
     this.tela1  = tela1;
     InitializeComponent();
     this.tamanho_palavra = tamanho_palavra;
 }
Пример #2
0
 public dutyCycleFixo(PaginaInicial parent, tela1 tela1, int tamanho_palavra)
 {
     this.parent          = parent;
     this.tela1           = tela1;
     this.tamanho_palavra = tamanho_palavra;
     InitializeComponent();
 }
        public void comunicacao()
        {
            //repete 10x e diz que foi bem sucedido
            contador = 1;
            while (contador < 11)
            {
                textBox6.Text = contador.ToString();
                //Teste de Comunicacao
                int i;
                for (i = 0; i < tamanho_palavra; i++)
                {
                    buffer[i] = 0x41;
                }

                byte[] buffer2 = new byte[tamanho_palavra];
                serialPort1.Write(buffer, 0, tamanho_palavra);
                serialPort1.Read(buffer2, 0, tamanho_palavra);

                string[] texto = new string[tamanho_palavra];
                for (i = 0; i < tamanho_palavra; i++)
                {
                    texto[i] = buffer[i].ToString();
                }

                textBox4.Text = texto[0] + texto[1] + texto[2] + texto[3] + texto[4] + texto[5] + texto[6] + texto[7] + texto[8];


                string[] texto2 = new string[tamanho_palavra];
                for (i = 0; i < tamanho_palavra; i++)
                {
                    texto2[i] = buffer[i].ToString();
                }

                textBox5.Text = texto2[0] + texto2[1] + texto2[2] + texto2[3] + texto2[4] + texto2[5] + texto2[6] + texto2[7] + texto2[8];

                if (contador == 10)
                {
                    textBox9.Text = "Verificacao com sucesso";
                    timer1.Enabled = true;
                    tela1 tela = new tela1(this, tamanho_palavra);
                    Enabled = false;
                    tela.Show();
                }
                contador++;
            }
        }