Beispiel #1
0
        public string MessagaMes(string message)
        {
            WriteMessage(message);
            HandlerCpu.Delay(200);
            var data = ReadMessage();

            return(data);
        }
Beispiel #2
0
 private void MonitorThread()
 {
     do
     {
         var outputs = Convert.ToString(SM_ReadDigitalOutputs(0, DigitalOutput.Count).Sum(b => b), 2)
                       .PadLeft(DigitalOutput.Count, '0')
                       .Select(c => c.ToString()).ToList().Select(c => Convert.ToBoolean(Convert.ToInt32(c))).ToList();
         for (var j = 0; j < DigitalOutput.Count; j++)
         {
             DigitalOutput[j].Value = outputs[j];
         }
         HandlerCpu.Delay(100);
     } while (Monitor);
 }
Beispiel #3
0
 /// <summary>
 /// Triger Device
 /// </summary>
 public void Trigger()
 {
     HandlerError.ClearErrors();
     try
     {
         ResourceIO.IO.AssertTrigger(Ivi.Visa.Interop.TriggerProtocol.TRIG_PROT_ON);
         HandlerCpu.Delay(1);
     }
     catch (Exception ex)
     {
         HandlerError.ErrorOccurred = true;
         HandlerError.ErrorMsg      = "Trigger command VisaCom Method. " + ex.Message;
         throw new Exception(HandlerError.ErrorMsg);
     }
 }
Beispiel #4
0
 public void Single_Cycle_Latch(string commands)
 {
     HandlerError.ClearErrors();
     try
     {
         CloseChannel(commands);
         HandlerCpu.Delay(500);
         OpenChannel(commands);
     }
     catch (Exception e)
     {
         HandlerError.ErrorOccurred = true;
         HandlerError.ErrorMsg      = "Data Adquisition Agilent 34970A. " + e.Message;
         throw new Exception(HandlerError.ErrorMsg);
     }
 }
Beispiel #5
0
 /// <summary>
 /// Read values
 /// </summary>
 /// <param name="buffer">buffer is variable to show result</param>
 protected void ReadCommand(out double buffer)
 {
     HandlerError.ClearErrors();
     try
     {
         var    tmpbuffer = ResourceIO.ReadString();
         double dbuffer;
         double.TryParse(tmpbuffer, out dbuffer);
         buffer = 0;//buffer = dbuffer;
         HandlerCpu.Delay(1);
     }
     catch (Exception ex)
     {
         buffer = 0;
         HandlerError.ErrorOccurred = true;
         HandlerError.ErrorMsg      = "Read command VisaCom Method. " + ex.Message;
         throw new Exception(HandlerError.ErrorMsg);
     }
 }
Beispiel #6
0
        /// <summary>
        /// Scanner Serial
        /// </summary>
        /// <returns>Serial Number</returns>
        public string ScannerRead()
        {
            string data  = "";
            int    count = 0;

            try
            {
                do
                {
                    WriteCom(Trigger);
                    HandlerCpu.Delay(50);
                    data = ReadCommand();
                    count++;
                } while ((data == "") && (count < 3));
            }
            catch (Exception ex)
            {
                throw new Exception("command VisaCom Method. " + ex.Message);
            }
            return(data);
        }
Beispiel #7
0
        public void Looping(string commands, int cicles)
        {
            HandlerError.ClearErrors();
            int loopCounter = 1;

            try
            {
                do
                {
                    CloseChannel(commands);
                    HandlerCpu.Delay(500);
                    OpenChannel(commands);
                    loopCounter = loopCounter + 1;
                } while (cicles > loopCounter);
            }
            catch (Exception e)
            {
                HandlerError.ErrorOccurred = true;
                HandlerError.ErrorMsg      = "Data Adquisition Agilent 34970A. " + e.Message;
                throw new Exception(HandlerError.ErrorMsg);
            }
        }
Beispiel #8
0
        private void MonitorThread()
        {
            do
            {
                var outputs = Convert.ToString(SM_ReadDigitalOutputs(0, DigitalOutput.Count).Sum(b => b), 2)
                              .PadLeft(DigitalOutput.Count, '0')
                              .Select(c => c.ToString()).ToList().Select(c => Convert.ToBoolean(Convert.ToInt32(c))).ToList();
                DigitalOutput.ForEach(n => outputs.ForEach(m => n.Value = m));
                //for (var j = 0; j < DigitalOutput.Count; j++)
                //{
                //    DigitalOutput[j].Value = outputs[j];
                //}
                HandlerCpu.Delay(100);

                var inputs = Convert.ToString(SM_ReadDigitalInputs(0, DigitalInput.Count).Sum(b => b), 2)
                             .PadLeft(DigitalInput.Count, '0')
                             .Select(c => c.ToString()).ToList().Select(c => Convert.ToBoolean(Convert.ToInt32(c))).ToList();
                DigitalInput.ForEach(n => inputs.ForEach(m => n.Value = m));
                //for (var j = 0; j < DigitalInput.Count; j++)
                //{
                //    DigitalInput[j].Value = inputs[j];
                //}
            } while (Monitor);
        }