-> Hier kostenlos registrieren
Ich versuche mich gerade mit B&R, PVI und C#. Mein SPS Programm läuft über Arwin. Die Simulation ist Online und der PVI-Manager laüft auch.
Wenn ich folgendes Programm laufen lasse:
Kommt in der Console leider der Fehler:
Error: Access Type not supported.
Weiß jemand Rat?
Wenn ich folgendes Programm laufen lasse:
Code:
using System;using System.Windows.Forms;
using BR.AN.PviServices;
namespace ConsoleApplication
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main(string[] args)
{
Console.WriteLine("Connecting Service, Cpu, Variable ...");
service = new Service("Service");
service.Error += new PviEventHandler(Error);
service.Connect();
cpu = new Cpu(service, "Cpu");
cpu.Connect();
cpu.Connection.DeviceType = DeviceType.TcpIp;
cpu.Connection.TcpIp.DestinationIpAddress = "127.0.0.1";
cpu.Connection.TcpIp.SourceStation = 98;
cpu.Connection.TcpIp.SourcePort = 11160;
cpu.Connection.TcpIp.DestinationPort = 11160;
cpu.Connect();
variable = new Variable(cpu, "variable1");
variable.Connect();
variable.Active = true;
variable.ValueChanged += new VariableEventHandler(ValueChanged);
// Start the message loop of the Application
Application.Run();
}
static void Error(object sender, PviEventArgs e)
{
Console.WriteLine(String.Format("Error:{0}", e.ErrorText));
// Error -> Exit the Application
Application.Exit();
}
static void ValueChanged(object sender, VariableEventArgs e)
{
Variable var = (Variable)sender;
Console.WriteLine("Value={0}", var.Value.ToString());
// Exit the Application
Application.Exit();
}
static Service service;
static Cpu cpu;
static Variable variable;
}
}
Kommt in der Console leider der Fehler:
Error: Access Type not supported.
Weiß jemand Rat?