Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - headzero

Pages: [1]
1
Open Discussion / Re: C# Subscribe
« on: July 11, 2017, 03:15:16 PM »
Archie

After beating my head against it for quite some time (days), I decided to unzip a fresh copy of Ver.3.99w (I was using Ver.3.99w) and started from scratch. Everything worked perfectly. I don't know what the problem was or what solved it.

Thank you for your time and this amazing project.

2
Open Discussion / Re: C# Subscribe
« on: July 10, 2017, 04:11:47 PM »
I started over and created a C# project within the AdvancedHMI solution. I am still getting the same results.
This is not a big deal as I am just experimenting but I would like to get it working.
 

3
Open Discussion / Re: C# Subscribe
« on: July 10, 2017, 12:34:30 PM »
I should mention that I am only referencing your library from a raw C# program.

Here is my simple test program:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using AdvancedHMIDrivers;
using MfgControl;

namespace AHMI_TestSubscription
{
    public partial class Form1 : Form
    {
        EthernetIPforCLXCom testplc = new EthernetIPforCLXCom();
        string[] plcResults = new string[7];
        int subID;
        int t = 500;


        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            testplc.IPAddress = "192.168.100.99";
            testplc.ProcessorSlot = 0;
        }

        private void btnStart_Click(object sender, EventArgs e)
        {
            try
            {
                subID = testplc.Subscribe("dateTime[0]", 6, t, the_callback);
                testplc.PollRateOverride = 0;
            }
            catch (Exception ex)
            {
                MessageBox.Show(Convert.ToString(ex));
            }
            MessageBox.Show("Subscription " + Convert.ToString(subID) + " is subscribed" ,"Subscription ID");
        }

        private void the_callback(object sender, MfgControl.AdvancedHMI.Drivers.Common.PlcComEventArgs e)
        {
            txtOutput.Text = e.Values[0];
            label1.Text = "Connected";
        }

       
        private void button1_Click(object sender, EventArgs e)
        {
            plcResults = testplc.Read("dateTime[0]", 6);
            txtOutput.Text = plcResults[0];
        }

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            testplc.UnSubscribe(subID);
            MessageBox.Show(subID + " is unsubscribed");
        }


    }
}

4
Open Discussion / Re: C# Subscribe
« on: July 10, 2017, 11:58:09 AM »
Thank you for your reply. (I'm honored. I have followed your work since the VB6 days )

I have another button on the form that has a simple read and it works fine.


private void button1_Click(object sender, EventArgs e)
        {
            plcResults = testplc.Read("dateTime[0]", 6);
            txtOutput.Text = plcResults[0];
        }

5
Open Discussion / C# Subscribe
« on: July 10, 2017, 10:48:55 AM »
Hi

Can anyone tell me what I am doing wrong with my C# subscribe/callback here. I get the message back with a value of 1 for the subID but the call back never fires.

private void btnStart_Click(object sender, EventArgs e)
        {
            try
            {
                subID = testplc.Subscribe("dateTime[0]", 6, t, the_callback);
                testplc.PollRateOverride = 1000;
            }
            catch (Exception ex)
            {
                MessageBox.Show(Convert.ToString(ex));
            }
            MessageBox.Show("Subscription " + Convert.ToString(subID) + " is subscribed" ,"Subscription ID");
        }

        private void the_callback(object sender, MfgControl.AdvancedHMI.Drivers.Common.PlcComEventArgs e)
        {
            txtOutput.Text = e.Values[0];
            label1.Text = "Connected";
        }


6
Open Discussion / Re: DF1Comm()
« on: March 17, 2013, 12:54:27 PM »
I got it working. I just needed the Container.

7
Open Discussion / DF1Comm()
« on: March 16, 2013, 06:54:19 PM »
First off this is an awesome project! I have enjoyed testing your VB.net stuff against a few A/B processors. Although I have written and support many OPC applications in VB6 when it comes to .net I like to use C# .I have been playing with the AdvancedHMIDrivers and I have had success connecting and transferring data to/from ControlLogix PLCs but I would like to know what arguments I have to pass to the DF1Comm() to use it in my C# projects?

Pages: [1]