Jump to content

Chris Graf

Members
  • Posts

    7
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Chris Graf's Achievements

Newbie

Newbie (1/4)

0

Reputation

  1. I used your program and got the connected message box now. Thank you so much for you help, as this is all new to me and I still have much to learn. Chris
  2. Hi, I'm sorry to keep asking you questions, but I am still having problems trying to get the PLC and the PC to communicate. I have made all the changes that you have suggested and I even made a different c# program that concentrates on just trying to connect with the PLC. I have researched on the forums, the internet, and have read documentations that Unitronics has provided and I still don't understand exactly what I am doing wrong. I've tried using both TCP and UDP in the PLC to initiate the call to the PC but it doesn't connect. I have included my VisiLogic program and c# program for references. I hope you can help and I appreciate any feedback. Thanks in advance. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Unitronics.ComDriver; using Unitronics.ComDriver.Messages.DataRequest; using System.Runtime.Remoting.Messaging; using System.Reflection; namespace Ethernet { public partial class Form1 : Form { private PLC plc; const int LOCAL_PORT = 20260; delegate void SetControlValueCallback(Control oControl, string propName, object propValue); public Form1() { InitializeComponent(); Listener(); } private void Listener() { try { EthernetListener listener = PLCFactory.GetChannel(LOCAL_PORT); if (listener == null) listener = new EthernetListener(LOCAL_PORT, 3, 3000); listener.OnListenerConnectionAccepted += new EthernetListener.ListenerConnectionAcceptedDelegate(OnConnect); PLCFactory.GetPLC(listener); } catch { MessageBox.Show("Could not connect"); } } private void OnConnect(PLC oPlc) { plc = oPlc; MessageBox.Show("Connected"); } } } TCP.vlp
  3. Hi Saragani, I have checked that the PLC is trying to connect to the PC. I have the PLC and the PC connected to each other by a switch on its own network. The PLC has an IP address of 192.168.0.106 and the PC has an IP address 192.168.0.205. I have Socket 1 initialized and set the protocol to ICMP. My firewall has been disabled so I know that is not an issue. I used the Ping function in the PLC and I also used Wireshark (a packet sniffer program) to verify that the PLC is trying to communicate to the PC. As far as I can tell, the PLC is trying to connect to the PC. I have included my program so you may see what I am referring to. The program "Reading MIs using Ethernet Listener - C# Example" is not working for me. I changed the LOCAL_PORT in the program to match port 20260 that I am using in the PLC and OnConnect is still not being executed. Yes we are sure that we want to use a Listener for this project because we are wanting the PLC to call onto the PC and not the other way around. TCP.vlp
  4. Hi Saragani, I sent my program to you but I'm not sure if you have received it or not. I think I have narrowed down my problem however. The program will read the line (it does not crash the program) but it will not execute and then proceed to the next line of code. Since it does not execute this line of code, the PLC does not establish a connection to the PC and is not able to read any data from the PLC. I am not sure if this is an Unitronics driver issue (I do have the latest driver downloaded) or if I am missing something within my code. Hopefully I have given you enough information to help. If you need more please let me know. Chris
  5. I used the ; instead of {} because it was typed that way in the example. I changed it like you stated, however I am still having a hard time understanding exactly how this works. I created a smaller program just trying to communicate to the PLC without any success. Would it be possible to send you that program so you may take a look at it and hopefully tell me what I am doing wrong?
  6. Hi Saragani, I have 108 errors. Some are "invalid token" and some are 'ListenerTest.Form1.listener' is a 'field' but is used like a 'type'. Hopefully I have attached the code I have so far this time so you can see how I am writing the code. Right now I just need 1 connection listener. Chris
  7. Hi, I am fairly new to programming and C#. I'm trying to create my own program using Visual Studio 2010 .NET 4 platform. I have read the pdf file for Communication Driver for Dot Net and I'm having a little trouble trying to set my PC up as an Ethernet Listener. Currently I am using a button click method to read/ write all the MI's in the PLC. I tried using the examples that came with Unitronics Communication Driver but the program wouldn't build. I have the most current DLL version (1.0.0.43) being used. I am using XP 32-bit OS. Here is a snapshot of the code. I am wanting to take out the button method and setting this up to be a listener. (* raw HEX image data removed - need to upload image and attach, rather than just paste. Pasting results in a large block of HEX(MIME?) data rather than the image. I don't now why - MOD *) Any help will be greatly appreciated and thanks in advanced. Chris
×
×
  • Create New...