Exemplo n.º 1
0
        private void bn_Conect_Click(object sender, EventArgs e)
        {
            try
            {
                if (!m_conected)
                {
                    m_conected = m_tic.open(tic.PRODUCT_ID.T36V4);
                    m_tic.reinitialize();
//                    m_tic.reset();
                    m_tic.energize();
                    m_tic.clear_driver_error();

                    //m_tic.set_max_accel(100000);
                    //m_tic.set_max_decel(100000);
                    //m_tic.set_max_speed(50000000);
                    //m_tic.set_starting_speed(2000000);
                    m_tic.exit_safe_start();
                    m_tic.wait_for_device_ready();
                    bn_Conect.Text      = "Disconect";
                    labelConection.Text = "YES";
                }
                else
                {
                    m_tic.deenergize();
                    m_tic.close();
                    bn_Conect.Text      = "Conect";
                    labelConection.Text = "NO";
                    m_conected          = false;
                }

                buttonGoto.Enabled       = m_conected;
                buttonHome.Enabled       = m_conected;
                checkBoxJogLeft.Enabled  = m_conected;
                checkBoxJogRigth.Enabled = m_conected;
                buttonEnergize.Enabled   = m_conected;
            }
            catch (Exception ex)
            {
                m_conected = false;
                MessageBox.Show(ex.Message);
            }
        }