示例#1
0
 private void SetAcquisition(ScopeViewControlChannel channel, string Symbolname)
 {
     if (scopeViewControl2.Charts.Count == 0)
     {
         MessageBox.Show(this, "Please create a chart first!", "No chart connected!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     else if (scopeViewControl2.Charts[0].Axes.Count == 0)
     {
         MessageBox.Show(this, "Please create an YAxis first!", "No axis connected!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     else if (scopeViewControl2.Charts[0].Axes[0].Channels.Count == 0)
     {
         MessageBox.Show(this, "Please create a Channel first!", "No channel connected!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     else
     {
         // AmsNetId und AmsPort benötigen die TwinCAT.Ads.dll
         channel.Acquisition.AmsNetId      = AmsNetId.Parse("192.168.0.2.1.1");
         channel.Acquisition.TargetPort    = 851;
         channel.Acquisition.IsSymbolBased = true;
         channel.Acquisition.SymbolName    = Symbolname;
         channel.Acquisition.DataType      = DataTypeConverter.AdsToScope2Datatype(AdsDatatypeId.ADST_REAL64);
         channel.Acquisition.SampleTime    = (uint)(1 * TimeSpan.TicksPerMillisecond);
     }
 }
示例#2
0
 private void SetAcquisitions()
 {
     //AmsNetId and AmsPort need the TwinCAT.Ads.dll
     adsAcquisition.AmsNetId            = amsAddressTask.NetId;
     adsAcquisition.TargetPort          = 350;
     adsAcquisition.SymbolBased         = true;
     adsAcquisition.SymbolName          = "Object1 (SignalsDemo).Outputs.Value";
     adsAcquisition.DataType            = DataTypeConverter.AdsToScope2Datatype(AdsDatatypeId.ADST_INT32);
     adsAcquisition.SampleTime          = (uint)(10 * TimeSpan.TicksPerMillisecond);
     acquisitionInterpreter.Acquisition = adsAcquisition;
     channel.AddMember(acquisitionInterpreter);
 }