Jump to content

RaspberryPi ComDriver problem


hullumajahull

Recommended Posts

Hi.

I have a V570 that collects temperature readings and stores those on SD card. PLC itself is connected to local network and so is RaspberryPi that is supposed to work as a web server, that on request grabs that datatable from plc, makes it into nice graph and shows it to client. The thing is that currently when my RP tries to run the test code(below), it says that it is unable to connect to PLC with that unitID. In my PLC settings I have set unitID to 0. When I run same code on my PC, it works like it is supposed to.

Thanks in advance.

using System;
using Unitronics.ComDriver;
namespace RTTest
{
	class MainClass
	{
		static PLC plc;
		public static void Main (string[] args){
			Ethernet eth = new Ethernet ("192.168.1.190", 20256, EthProtocol.TCP, 3, 3000);
			Console.WriteLine(eth.Connected);
			try{
				plc = PLCFactory.GetPLC(eth, 0);
				plc.EventAbortCompleted+=new PLC.AbortCompletedDelegate(plc_EventAbortCompleted);
			}catch(Exception e){
				eth.Disconnect();
				Console.WriteLine ("Error1:"+e.Message+"-->("+e.TargetSite+")"+e.StackTrace+"-->"+e.Source);
			}
			try{
				Console.WriteLine(plc.Version.OPLCModel);
				Console.WriteLine (plc.PlcName);
				Console.WriteLine(eth.Connected);
				Console.WriteLine(plc.UnitId);
			}catch(Exception e){
				eth.Disconnect();
				Console.WriteLine ("Error2:"+e.Message+"-->("+e.TargetSite+")"+e.StackTrace);
			}
			Console.Read ();
		}
		public static void plc_EventAbortCompleted(){
			Console.WriteLine ("dunno");
		}
	}
}
Link to comment
Share on other sites

I think that an inner exception is causing the problem.

You can use the given source codes in order to debug the communication driver.

 

My first guess is that when the driver is trying to extract the PLCs xml, the OS is preventing it.

 

You can set the following then the program starts:

 

PLCFactory.WorkWithXmlInternally = true;

 

If the problem is the XML, then it should solve your problem.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...