Exemple #1
0
        public static void CorvusManagerTest()
        {
            CorvusManager cm = new CorvusManager("COM6", 57600);

            cm.rmove(-6, -5, -2);
            Thread.Sleep(5000);
            cm.rmove(6, 5, 2);
        }
Exemple #2
0
        // Constructor
        public CoDASyncWindow()
        {
            InitializeComponent();

            CM      = null; //new CorvusManager("COM6", 57600);
            IsCMSet = false;

            DM      = null;
            IsDMSet = false;

            // initialize locker for signaling condition that computation is done
            done         = true;
            __doneLocker = new Object();


            __readSerialEvent      = new AutoResetEvent(false);
            __readDAQEvent         = new AutoResetEvent(false);
            __bufferReadyCountdown = new CountdownEvent(3);


            position     = null;
            sample       = null;
            sample_array = null;
            time         = null;
            output       = "";

            // output file name
            outputFileName           = "";
            outputStream             = null;
            __outputFileStreamLocker = new Object();

            // configure timer general parameters
            samplingTimer           = new System.Timers.Timer();
            __timerLocker           = new Object();
            samplingTimer.Elapsed  += TimerHandler;
            samplingTimer.AutoReset = true;
            acquisitionInProgress   = false;

            // create threads
            readSerialThread = null;
            readDAQThread    = null;
            storeDataThread  = null;

            // listing variables
            execInProgress     = false;
            executionThread    = null;
            __execThreadLocker = new Object();
        }
Exemple #3
0
        public static void CorvusManagerTestPos()
        {
            CorvusManager corman = new CorvusManager("COM6", 57600);

            Console.WriteLine("Getting position...");
            String s = null;

            if (corman.pos(ref s))
            {
                Console.WriteLine("Position successfully read: " + s);
            }
            else
            {
                Console.WriteLine("Impossible to read position.");
            }

            Console.WriteLine("Moving Origin to point 3, 2, -1.5");

            if (corman.setpos(3, 2, (float)1.5))
            {
                Console.WriteLine("Origin Successfully moved!");
            }
            else
            {
                Console.WriteLine("Faled to move origin!");
            }

            Console.WriteLine("Getting new position.");
            if (corman.pos(ref s))
            {
                Console.WriteLine("New position is " + s);
            }
            else
            {
                Console.WriteLine("Impossible to read new position.");
            }

            Console.WriteLine("Moving to origin");
            if (!corman.move(0, 0, 0))
            {
                Console.WriteLine("Impossible to move to origin");
            }

            corman.Close();
        }
Exemple #4
0
        public void ConnectPortButton_Click(object sender, EventArgs e)
        {
            try {
                if (IsCMSet && CM.IsOpen)
                {
                    CM.Close();
                }
                CM      = new CorvusManager(PortTextBox.Text, Int32.Parse(BaudRateTextBox.Text));
                IsCMSet = true;
            } catch (Exception ex) {
                MessageBox.Show(
                    "Invalid port or baud rate configuration",
                    "Corvus Configuration Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error
                    );
            }
            this.updateCorvusConnectionStatus();

            CM.sc = displayLineToLog;
        }
Exemple #5
0
        public void TestPeriodicalAcquisition()
        {
            CM      = new CorvusManager("COM6", 57600);
            IsCMSet = true;

            int[] channels = { 0, 1, 2, 3, 4, 5 };
            DM      = new DAQManager("Dev2", channels);
            IsDMSet = true;


            System.Timers.Timer t = new System.Timers.Timer(1000);
            t.Elapsed  += TimerHandler;
            t.AutoReset = true;


            Thread thread_store = new Thread(Store);

            thread_store.Start();

            Thread thread_serial = new Thread(ReadSerial);

            thread_serial.Start();

            Thread thread_daq = new Thread(ReadDAQmx);

            thread_daq.Start();

            t.Enabled = true;

            Thread.Sleep(10000);

            thread_store.Abort();
            thread_daq.Abort();
            thread_serial.Abort();

            Console.WriteLine("Test ended, press enter to exit.");
            Console.Read();

            File.WriteAllText("D:\\OrigliaMarco\\CoDASync\\Acquisition.txt", output);
        }