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 - maxketcham

Pages: [1] 2
1
Support Questions / Re: OPC connection to remote server
« on: August 24, 2016, 12:07:55 AM »
no matter, Callback would have been convenient, but I can poll just as effectively so that's what I'll do. besides I only need to write and read every second or so for the poll and it will only be 16 bits this time. Love your software, has made my life a lot easier so no complaints.
Thanks for the help

2
Support Questions / Re: OPC connection to remote server
« on: August 23, 2016, 12:28:10 PM »
nope, never called back, it initializes them all to false, then updates once, but callback is never activated. Guess I'm down to polling

3
Support Questions / Re: OPC connection to remote server
« on: August 22, 2016, 08:11:32 PM »
LOL, I can understand that feeling of cringing. I did get it using your method, turned out when I checked it was a DCOM  problem, that is fixed, now I can connect, but the connection will only last 2-3 changes of a bit, then never changes again. This I have no clue about. Your driver does do a callback does it not? or does it poll?

4
Support Questions / OPC connection to remote server
« on: August 22, 2016, 11:33:07 AM »
using OpcDaCom, I am tryint to connect to an OPC server on a remote server the server address is  10.224.220.109 using OPC expert https://opcexpert.com/ I can connect by just adding the address of the opc server and it finds Kepware.KEPServerEX.V5 and allows me to connect to it. Why can't I connect to it with Advanced HMI? I have tried changing opcda://localhost to remotehost, the IP address, and several other thnigs but nothing seems to work. What am I doing wrong?

5
Support Questions / Re: direct reading and writing to OPC in AHMI
« on: August 05, 2016, 03:38:46 PM »
Thanks Archie

6
Support Questions / direct reading and writing to OPC in AHMI
« on: August 05, 2016, 11:28:51 AM »
I know it's here in the forum but after 2 days searching I give up. Could someone point me to how to read and write to an opc server in AHMI without using a control, I have an need in my app for direct reads/writes to OPC and  to/from a database,  I use controls in some places but the direct reads and writes are easier. I found them here once, but now I can't find them and with 5TB of code on my hard drive I can't find it there either, any help would be appreciated, thanks in advance
Loving AHMI!!!!
and have posted about it more than once on FB LOL
ps only need the direct read and write code for OPC, I have the database handled, lol

7
Support Questions / Re: DataSubscriber 2
« on: February 04, 2016, 02:00:09 PM »
yes I am as soon as I can get this part of it to work. I Have several programs that just access opcdaauto,dll and they work OK, just didn't want to have to deal with that plus the graphics too.

8
Support Questions / DataSubscriber 2
« on: February 04, 2016, 01:31:10 PM »
OK I'm going to try this again. My company just upgraded their server and I can't send or receive any attachment period so I'll have to cut and paste the code. The problem I am having is I'm trying to add items using a loop and the  code  DataSubscriber21.PLCAddressValueItems.Add(New AdvancedHMIDrivers.PLCAddressItem() With {.SubscriptionID = CInt(records(x, 3)) - 1, .PLCAddress = records(x, 1)}) where Records is a string array containing the address I want to look at. I'm using the OPC driver and the program works fine except for one thing, It is taking 4.5 hours to add 772 items to the subscriber? I also just added this code a = e.PlcAddress.ToString & " = " & e.Values(0).ToString & "; subscription ID = " & e.SubscriptionID & vbCrLf & TextBox1.Text and I think that it has shown me what the problem is, but I don't know how to cure it. It seems that when you add an Item to the datasubscriber, it is using soe type of recursion to add it? anyways what I see is an output to the textbox of item 1 printed, item 1 printed, item 1 item two printed, item 1 printed, item 1 item 2 printed, item 1 item 2 1tem 3 printed, ant it progresses that way for each item I add. I'll paste all the code from main form below, the module named tracking only has 1 textbox on it and the data file is comma delimited and consists of two items per line of 772 lines, I'll include a 12 item list at end for sample purposes, but you'll have to make your own as OPC will have to be working for this example to run and the tags will have to exist on that opc server. Could someone tell what is going on and how to fix it. Aslo I've been programing since dartmouth basic came out so please lay off my style comment on on actual errors in code, not how I program. LOL


Public Class MainForm
    '*******************************************************************************
    '* Stop polling when the form is not visible in order to reduce communications
    '* Copy this section of code to every new form created
    '*******************************************************************************
    Private FinishedStartUp As Boolean = False
    Private start_time As DateTime
    Private stop_time As DateTime
    Private WriteToSQL As Boolean = False
    Dim elapsed_time As TimeSpan
    Dim firstscan As Boolean = False
    Private First_start_time As DateTime
    Private AlarmArray(2001) As String
    Private WriteToTracking As Boolean = False
    '*******************************************************************************
    '* Stop polling when the form is not visible in order to reduce communications
    '* Copy this section of code to every new form created
    '*******************************************************************************
    Private NotFirstShow As Boolean
    Public records(773, 4) As String
    Private Sub MainForm_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
        Tracking.Hide()
        Me.Hide()
        AdvancedHMIDrivers.Utilities.StopComsOnHidden(components, Me)
        DataSubscriber21.PLCAddressValueItems.Clear()
        OpcDaCom1.DisableSubscriptions = True
        OpcDaCom1.Dispose()
        Tracking.Dispose()
        Me.Dispose()
    End Sub
    Private Sub MainForm_Load(sender As Object, e As EventArgs) Handles Me.Load
        First_start_time = Now
        Dim TempText As String
        Tracking.Show()
        Dim a As String = ""
        Dim b As Integer = 0
        ReadCSV()
        DataSubscriber21.PLCAddressValueItems.Clear()
        For x = 1 To 10 Step 1
            If records(x, 2) <> "" Then
                DataSubscriber21.PLCAddressValueItems.Add(New AdvancedHMIDrivers.PLCAddressItem() With {.SubscriptionID = CInt(records(x, 3)) - 1, .PLCAddress = records(x, 1)})
                TempText = Tracking.TextBox1.Text
                Tracking.TextBox1.Text = x.ToString & " - Tag name = " & records(x, 1) & ", error description = " & records(x, 2) & ", Subscription Id = " & records(x, 3) & vbCrLf & TempText
                Tracking.TextBox1.Refresh()
                Me.Refresh()
            End If
        Next x
        stop_time = Now
        Dim elapsed_Time As TimeSpan = DateTime.Parse(stop_time.ToString).Subtract(DateTime.Parse(First_start_time.ToString))
        TempText = Tracking.TextBox1.Text
        Me.Refresh()
        Tracking.TextBox1.Text = "Time to load all parameters was" & elapsed_Time.ToString & vbCrLf & TempText
        Me.Refresh()
    End Sub
    Private Sub ReadCSV() 'FileName As String)
        Try
            Dim WholeFile As String = ""
            Dim LineData() As String
            Dim FieldData() As String
            Dim ParmCount As Integer = 1
            Dim VarCount As Integer = 1
            Dim FilePath As String = "C:\work\Alarm message lean.csv"
            WholeFile = My.Computer.FileSystem.ReadAllText(FilePath)
            LineData = Split(WholeFile, vbNewLine)
            For Each LineOfText As String In LineData
                VarCount = 1
                FieldData = LineOfText.Split(",")
                For Each WordOfText As String In FieldData
                    records(ParmCount, VarCount) = WordOfText
                    VarCount += 1
                Next WordOfText
                records(ParmCount, 3) = (ParmCount - 1).ToString
                ParmCount += 1
            Next LineOfText
        Catch EX As Exception
            Dim A As String
            Dim CurrentDateTime As DateTime = DateTime.Now
            Dim TimeStamp As String = vbCrLf & "current date and time = " & CurrentDateTime.ToString("yyyy/MM/dd - HH:mm:ss.ffffff") & vbCrLf
            Dim ErrorLocation As String = "In - Form1 Private Sub ReadCSV(FileName As String)" & vbCrLf
            Dim ErrorString As String = " current error = " & ErrorToString() & vbCrLf
            Dim B As String = Tracking.TextBox1.Text
            A = TimeStamp & ErrorLocation & ErrorString & B & vbCrLf
            Tracking.TextBox1.Text = ""
            Tracking.TextBox1.Text = A
        End Try
    End Sub
    Private Sub INSERTDATA(ByVal MAIN_ASSY_VAR As String, ByVal SUB_ASSY_VAR As String, ByVal SUB_ASSY_NUM_VAR As String, ByVal CURRENT_STATE_VAR As String, ByVal SENDER_NAME_VAR As String, ByVal SENDER_VALUE_VAR As String, ByVal FULL_DATE_TIME_VAR As String, THIS_DATE_VAR As String, ByVal THIS_TIME_VAR As String, ByVal THIS_ID_VAR As String)
        If WriteToSQL = False Then Exit Sub
        Try
            Dim MyConnect As New SqlClient.SqlConnection
            MyConnect.ConnectionString = "Data Source=MESTEST\ONLINE;Integrated Security=False;User ID=SPIRE_SUN_SIMULATOR;Password=SPIRE_SUN_SIMULATOR;Connect TimeOut=15;Encrypt=False;TrustServerCertificate=False"
            Dim MyCommand As SqlClient.SqlCommand = New SqlClient.SqlCommand()
            Dim TodayTime1 As DateTime = Now
            Dim ID As Guid
            ID = Guid.NewGuid
            MyCommand.Connection = MyConnect
            MyCommand.CommandText = "INSERT INTO dbo.MACHINE_TIME (MAIN_ASSY, SUB_ASSY, SUB_ASSY_NUM, CURRENT_STATE, SENDER_NAME, SENDER_VALUE, FULL_DATE_TIME, THIS_DATE, THIS_TIME, THIS_ID) VALUES (@MAIN_ASSY, @SUB_ASSY, @SUB_ASSY_NUM, @CURRENT_STATE, @SENDER_NAME, @SENDER_VALUE, @FULL_DATE_TIME, @THIS_DATE, @THIS_TIME, @THIS_ID)"
            MyConnect.Open()
            MyCommand.Parameters.AddWithValue("@MAIN_ASSY", MAIN_ASSY_VAR)
            MyCommand.Parameters.AddWithValue("@SUB_ASSY", SUB_ASSY_VAR)
            MyCommand.Parameters.AddWithValue("@SUB_ASSY_NUM", SUB_ASSY_NUM_VAR)
            MyCommand.Parameters.AddWithValue("@CURRENT_STATE", CURRENT_STATE_VAR)
            MyCommand.Parameters.AddWithValue("@SENDER_NAME", SENDER_NAME_VAR)
            MyCommand.Parameters.AddWithValue("@SENDER_VALUE", SENDER_VALUE_VAR)
            MyCommand.Parameters.AddWithValue("@FULL_DATE_TIME", FULL_DATE_TIME_VAR)
            MyCommand.Parameters.AddWithValue("@THIS_DATE", THIS_DATE_VAR)
            MyCommand.Parameters.AddWithValue("@THIS_TIME", THIS_TIME_VAR)
            MyCommand.Parameters.AddWithValue("@THIS_ID", THIS_ID_VAR)
            MyCommand.ExecuteNonQuery()
            MyConnect.Close()
        Catch EX As Exception
            Dim A As String
            Dim CurrentDateTime As DateTime = DateTime.Now
            Dim TimeStamp As String = vbCrLf & "current date and time = " & CurrentDateTime.ToString("yyyy/MM/dd - HH:mm:ss.ffffff") & vbCrLf
            Dim ErrorLocation As String = "In - Form1 Private Sub InsertData()" & vbCrLf
            Dim ErrorString As String = " current error = " & ErrorToString() & vbCrLf
            Dim B As String = TextBox1.Text
            A = TimeStamp & ErrorLocation & ErrorString & B & vbCrLf
            TextBox1.Text = ""
            TextBox1.Text = A
        End Try
    End Sub
    Private Sub Form_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.VisibleChanged
        If NotFirstShow Then
            AdvancedHMIDrivers.Utilities.StopComsOnHidden(components, Me)
        Else
            NotFirstShow = True
        End If
    End Sub
    Private Sub DataSubscriber21_DataChanged(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles DataSubscriber21.DataChanged
        Dim a As String
        Dim temptext As String = TextBox1.Text
        a = e.PlcAddress.ToString & " = " & e.Values(0).ToString & "; subscription ID = " & e.SubscriptionID & vbCrLf & TextBox1.Text
        stop_time = Now
        TextBox1.Text = a & vbCrLf & temptext
        Dim elapsed_Time As TimeSpan = DateTime.Parse(stop_time.ToString).Subtract(DateTime.Parse(First_start_time.ToString))
        temptext = TextBox1.Text
        TextBox1.Text = "Elapsed time = was" & elapsed_Time.ToString & vbCrLf & temptext
        Me.Refresh()
    End Sub
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        End
    End Sub
    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        WriteToSQL = Not WriteToSQL
        If WriteToSQL = True Then
            Button3.BackColor = Color.Blue
        Else
            Button3.BackColor = Color.Red
        End If
    End Sub
End Class


Module Line Omron PLCs.Lay Up 01.Alarm
  • .Alarm[0000],[0]ETHERCAT COMMUCATION ERROR

Module Line Omron PLCs.Lay Up 01.Alarm
  • .Alarm[0001],[1]ETHERCAT Node 01 ERROR

Module Line Omron PLCs.Lay Up 01.Alarm
  • .Alarm[0002],[2]ETHERCAT Node 02 ERROR

Module Line Omron PLCs.Lay Up 01.Alarm
  • .Alarm[0003],[3]ETHERCAT Node 03 ERROR

Module Line Omron PLCs.Lay Up 01.Alarm
  • .Alarm[0004],[4]ETHERCAT Node 04 ERROR

Module Line Omron PLCs.Lay Up 01.Alarm
  • .Alarm[0005],[5]ETHERCAT Node 05 ERROR

Module Line Omron PLCs.Lay Up 01.Alarm
  • .Alarm[0006],[6]ETHERCAT Node 06 ERROR

Module Line Omron PLCs.Lay Up 01.Alarm
  • .Alarm[0007],[7]ETHERCAT Node 07 ERROR

Module Line Omron PLCs.Lay Up 01.Alarm
  • .Alarm[0008],[8]ETHERCAT Node 08 ERROR

Module Line Omron PLCs.Lay Up 01.Alarm
  • .Alarm[0009],[9]ETHERCAT Node 09 ERROR

Module Line Omron PLCs.Lay Up 01.Alarm
  • .Alarm[0010],[10]ETHERCAT Node 10 ERROR

Module Line Omron PLCs.Lay Up 01.Alarm
  • .Alarm[0011],[11]ETHERCAT Node 11 ERROR


9
Tips & Tricks / Re: Move and Resize Controls at Runtime
« on: February 03, 2016, 09:11:38 AM »
I've used that code before in other projects, it really is useful if you have a form you want to print, say a barcode and product label, and you want the user to both be able to move the items around to suit them and get it to print in a certain location of the label.

10
Tips & Tricks / Re: DataSubscriber2 Walk Through
« on: February 01, 2016, 01:34:20 PM »
Unfortunately I lost my whole project, won't do that again. not the first time, for some reason if there is an error in the program and you clean the solution, it erases every control on the form. not sure why but it's not the first time this has happened to me. once they are gone, that's it gotta start over. to make it worse it erase every damned handles clause associated with the controls that are now gone so just putting everything back isn't a solution. have to rewrite all code to. I know it's not your code, it is something wrong in Visual studio had it happen before with other programs using custom controls. Almost makes it not worth using them.

11
Tips & Tricks / Re: DataSubscriber2 Walk Through
« on: February 01, 2016, 12:02:24 PM »
Forgot to mention I'm using the OPC driver and the error is object does not match target type.

12
Tips & Tricks / Re: DataSubscriber2 Walk Through
« on: February 01, 2016, 12:00:06 PM »
When I try to use the DataSubscriber2 It will not allow me to add anything to the PLCAddress, see attached image. Am I doing something wrong or do I need to do something to the control to make it work? VB2013 VS2013 Pro.

13
Open Discussion / Re: Text entry and display
« on: October 22, 2015, 10:31:07 AM »
I'm using OPCda, I get a string when I look at my bar code readers, but not when I look at my PLC's (omron NJ's) but I've fixed a work around now, just read all the bytes from the string and input/output programmatically. I found out later that it was the OPCServer (kepware) and the plc's lack of talking correctly about data types to each other (kepware refuses to see it as string data, keeps seeing it as individual integers) everywhere in the program and outside HMI's it is treated as an ASCII string with no problem. It seems to have to do with the OMRON Kepware driver, the kepware driver I'm using for keyence treats string like strings without a problem. Gotta love, or hate it, none of them are worth a shit, but it's what I'm stuck with. Thanks for the quick update Archie, sorry but I'm so busy now I couldn't get back to post this til now. Got to say you got one hell of a good piece of software here, wish there was a good manual for it. later

14
Open Discussion / Text entry and display
« on: October 21, 2015, 02:25:35 PM »
is there a way to display plc text data?

15
Support Questions / Re: opcda driver
« on: October 04, 2015, 10:55:02 PM »
Sorry, been away for the weekend, won't be back at work until Tuesday. But yes I could see the label update from true to false. The BasicLabel.Valuechanged, or BasicLabel.Textchanged (I tried them both) event did not fire, though it did fire when I saw it change from false to true. I'll try the break point you suggested when I get back Tuesday morn., thanks. By the way I'm using VB2013 Professional. and Windows 8.1 along with the latest and greatest AdvancedHMI V3.99a.

Pages: [1] 2