Beispiel #1
0
        private void button12_Click(object sender, EventArgs e)
        {
            timControleAngulo.Enabled = true;

            frmIni frmTel = new frmIni();

            frmTel.ShowDialog();
        }
Beispiel #2
0
        private void tmTXdata_Tick(object sender, EventArgs e)
        {
            var instance = new frmIni();

            int p = instance.ler_delta(0);


            if (testeM2000PE)
            {
                //M2000PE
                Boolean flagtx = false;
                byte[]  txdata = { 3, 0 };
                if (spControle.IsOpen)
                {
                    while (spControle.BytesToRead > 0)
                    {
                        int ntemp = spControle.ReadByte();
                        ValidaBloco(ntemp);
                        //spControle.Write(txdata, 0, 1);
                        //buffeRX[contabuffeRX++] = ntemp;
                        //dadoRX = dadoRX + " " + ntemp.ToString("X2");
                        flagtx = true;
                    }

                    if (flagtx == true)
                    {
                        spControle.Write(txdata, 0, 1);
                        //contabuffeRX = 0;
                        textBox1.Text = dadoRX;
                    }
                }
            }

            else
            {
                if (spControle.IsOpen)
                {
                    //string s = Encoding.ASCII.GetString(new byte[] { 65 });
                    string rxdadotemp = "";
                    while (spControle.BytesToRead > 0)
                    {
                        leitura    = spControle.ReadByte();
                        rxdadotemp = rxdadotemp + Encoding.ASCII.GetString(new byte[] { (byte)leitura });
                        ValidaBlocoEntrada(leitura);
                        if (leitura == 13)
                        {
                            textBox1.Text = rxdadotemp + textBox1.Text;
                            rxdadotemp    = "";
                        }
                    }
                }
            }
        }