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.


Topics - bachphi

Pages: [1] 2 3 ... 6
1
Open Discussion / All I want for this Christmas
« on: December 01, 2023, 07:34:54 PM »
Is an easier way to read the UDT tags with AAHMI.

My recent experience with node-red is blowing me away with how easy it is to read/subscribe tags including UDT tags.

First, the Tag Browser brings up all tags in the processor, then clicking on the tag that you want to read/subscribe will get it into the Tag list with proper data type automatically defined.


In the 1st screenshot, DTCurrent is a UDT tag that contains date time info  AND a custom string length of 20. The FreeRunning tag is a TIMER. As you can see, in the node-red they are STRUCT type.


In the 2nd screenshot, showing all the atomic data type and the debug data from the two tags



The ethernet driver module that I use is the 'node-red-contrib-cip-st-ethernet-ip'  and on Github: 
https://github.com/st-one-io/node-red-contrib-cip-ethernet-ip

2
Tips & Tricks / GetTagList into a Treeview
« on: November 19, 2023, 08:35:03 PM »
Courtesy from Archie:
Code: [Select]
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        EthernetIPforCLXCom1.IPAddress = TextBox1.Text
        EthernetIPforCLXCom1.ProcessorSlot = TextBox2.Text

        '* Retreive the tags from the PLC
        Dim AllTags() As AdvancedHMI.Drivers.CLXTag = EthernetIPforCLXCom1.GetTagList

        '* Clear anything in the TreeView
        TreeView1.Nodes.Clear()

        '* Add all tags to the tree view
        For i = 0 To AllTags.Length - 1
            Dim Node As New TreeNode(AllTags(i).TagName)

            If AllTags(i).ArrayElements1 > 0 And AllTags(i).ArrayElements2 <= 0 Then
                Node.Text &= " [" & AllTags(i).ArrayElements1 & "]"
            ElseIf AllTags(i).ArrayElements2 > 0 And AllTags(i).ArrayElements2 <= 0 Then
                Node.Text &= " [" & AllTags(i).ArrayElements1 & "," & AllTags(i).ArrayElements1 & "]"
            ElseIf AllTags(i).ArrayElements3 > 0 Then
                Node.Text &= " [" & AllTags(i).ArrayElements1 & "," & AllTags(i).ArrayElements1 & "," & AllTags(i).ArrayElements3 & "]"
            End If

            '* If the Tag is a UDT, then add the structure name in parentheses
            If (AllTags(i).IsStructure) Then
                Node.Text &= " (" & AllTags(i).UDTStructure.Name & ")"
            End If

            TreeView1.Nodes.Add(Node)

            '* If the Tag is a UDT, then add the structure definition as a tree node
            AddSubNode(Node, AllTags(i).UDTStructure)
        Next
    End Sub


    Private Sub AddSubNode(node As TreeNode, UDTstructure As AdvancedHMI.Drivers.CIP.CLXTemplateObject)
        If UDTstructure IsNot Nothing Then
            For i = 0 To UDTstructure.Members.Count - 1
                Dim SubNode As New TreeNode(UDTstructure.Members(i).Name)
                node.Nodes.Add(SubNode)

                '* If the member is a UDT, then recursively add the UDT structure as a sub node
                AddSubNode(SubNode, UDTstructure.Members(i).SubTemplate)

                '* If the member is an array, then add the element count in brackets
                If UDTstructure.Members(i).ArrayElements > 0 Then
                    SubNode.Text &= " [" & UDTstructure.Members(i).ArrayElements & "]"
                End If

                '* If the member is another UDT, then add the name in parentheses
                If UDTstructure.Members(i).SubTemplate IsNot Nothing Then
                    SubNode.Text &= " (" & UDTstructure.Members(i).SubTemplate.Name & ")"
                End If
            Next
        End If
    End Sub

3
Open Discussion / Zombie posts
« on: June 08, 2023, 07:28:38 AM »
Archie,

There are too many zombie posts lately and it's really annoying. 
Can you take a look at the process of creating a new username and see if you can beef it up. 
Have a moderator to kill & ban these types of posts. 
Do not allow a new username the ability to post until at least  a few days later.

4
How to communicate to a 1734-AENT, 1734-AENTR rack with EEIP Ethernet/IP library.

With the current market supply situation, getting a PLC may be an issue for some,
and for a simple job, you may not need to have a PLC, but using just  I/O via Point IO ethernet adapter/coupler 1734-AENT and EEIP ethernet/ip library. 
The EEIP library can be downloaded from Sourceforge web site.
There are sample codes as well as a Youtube video (https://www.youtube.com/watch?v=NLCXnVpDgl4). 

But after following their sample and instruction, I could not get my solution running, and keep getting error:
An unhandled exception of type 'Sres.Net.EEIP.CIPException' occurred in EEIP.dll
Connection failure, General Status Code: 1 Additional Status Code: 789 Invalid segment in connection path.
From what I can see, other people ran into the same  issue.

Below is my actual working solution and its setup:

I set up the AENT with a static IP address, and a rack size of 4 ( AENT + IB8 + OB8E + IB8).
I  set Slot 1 Input bit 3 to be ON, and slot 3 input bit 5 ON.

Code: [Select]
Imports System
Imports Sres.Net.EEIP

Module Program


    Sub Main(args As String())

        ' The Following Hardware Configuration Is used in this example
        '  Allen-Bradley 1734-AENT Ethernet/IP Coupler
        '  Allen-Bradley 1734-IB8 8-Channel Digital Input Module [Input 3 ON]
        '  Allen-Bradley 1734-OB8E 8-Channel Digital Output Module w Status
        '  Allen-Bradley 1734-IB8 8-Channel Digital Input Module [Input 5 ON]

        '  This example also handles a reconnection procedure if the Impicit Messaging has Timed out
        '  (If the Property "LastReceivedImplicitMessage" Is more than one second ago)

        Dim eeipClient As EEIPClient = New EEIPClient()

        Try
            eeipClient.IPAddress = "192.168.10.11"  ' IP address
            eeipClient.TCPPort = &HAF12             ' port 44818

            eeipClient.RegisterSession()

            'From the eds file, the path for the Exclusive Owner Assembly Connection Is:
            '"20 04 24 66 2C 64 2C 65" ( Class 4, Config Assy. 102, Output Assy. 100, Input Assy. 101)
            eeipClient.ConfigurationAssemblyInstanceID = &H66   '102

            ' Parameters from Originator -> Target [OUTput from O=>T for 'Consumsed']
            eeipClient.O_T_InstanceID = &H64    ' Instance ID of the OUTput Assy. 100
            eeipClient.O_T_Length = 1          '#OfOutputModules The Method "Detect_O_T_Length" detect the Length using an UCMM Message
            eeipClient.O_T_RealTimeFormat = Sres.Net.EEIP.RealTimeFormat.Header32Bit    ' Header Format
            eeipClient.O_T_OwnerRedundant = False
            eeipClient.O_T_Priority = Sres.Net.EEIP.Priority.Scheduled  'implicit msg
            eeipClient.O_T_VariableLength = False
            eeipClient.O_T_ConnectionType = Sres.Net.EEIP.ConnectionType.Point_to_Point
            eeipClient.RequestedPacketRate_O_T = 100000     ' 500ms is the Standard value

            ' Parameters from Target -> Originator [T Produced to O as Inputs]
            eeipClient.T_O_InstanceID = &H65    '' Instance ID of the INput Assy. 101
            eeipClient.T_O_Length = 11          ' 8-bytes status header + 2In + 1 OutInstance
            eeipClient.T_O_RealTimeFormat = Sres.Net.EEIP.RealTimeFormat.Modeless
            eeipClient.T_O_OwnerRedundant = False
            eeipClient.T_O_Priority = Sres.Net.EEIP.Priority.Scheduled
            eeipClient.T_O_VariableLength = False
            eeipClient.T_O_ConnectionType = Sres.Net.EEIP.ConnectionType.Multicast
            eeipClient.RequestedPacketRate_T_O = 100000     ' RPI in  500ms is the Standard value

            ' Forward open initiates the Implicit Messaging
            eeipClient.ForwardOpen()

            While Console.ReadKey().Key <> ConsoleKey.Enter

                Dim ReturnedData As Byte() = eeipClient.AssemblyObject.getInstance(&H65)
                Console.WriteLine("State of 1st Input byte: " & ReturnedData(8))
                Console.WriteLine("State of 2nd Output byte: " & ReturnedData(9))
                Console.WriteLine("State of 3rd Input byte: " & ReturnedData(10))

                'eeipClient.O_T_IOData(0) = 3                'Write to Slot 2 Output Bit 0 & 1
                System.Threading.Thread.Sleep(500)

            End While


        Catch ex As Exception
            Console.WriteLine("Exception:" & ex.ToString)

        Finally
            ' Close & Unregister the Session
            eeipClient.ForwardClose()
            eeipClient.UnRegisterSession()
        End Try



    End Sub
End Module



5
Open Discussion / RSLogix 5000 Find Priority
« on: October 17, 2022, 12:36:57 PM »
This post is inspired by the question from PLCTalk site

Code: [Select]
There are 5 Hoppers. Each with 2 level sensors; one is at the 75% full level and the other is at the 25% full level.
I need to fill hoppers that fall below the 25% level (High Priority) first, then any that fall below the 75% level (Normal Priority).







6
Open Discussion / RS Logix 5000 bit toggle
« on: October 13, 2022, 08:34:15 PM »



7
Open Discussion / Tag name with a new Datatype HMIBC
« on: July 13, 2022, 11:14:22 AM »
With the advance of Panelview 5510, Rockwell introduced  a new data type called HMIBC.

I tried to use it with BasicButton, when pressing on the button, I'd get a 'CIP Priviledge violation' message.

I also tried to access its tag bit/bool level to no avail:  ButtonState, EnableOut, Out.

8
Micrologix 1400 has a string data type ST, however sending it directly will not work. MicroLogix/SLC/PLC5 platform stores data in Big-Endian Motorola format. And the newer Control/Compactlogix stores CIP data in Little-Endian Intel format , Little-endian is an order in which the "little end" (the least-significant byte) is stored first.

On the Control/CompactLogix side, SourceString is copied to INT_Array_Temp, then used SWPBYTE to reverse the order, store it in the  INT_Array_OUT, next write it  to ML1400 to N10:0 integer file




On the ML1400 side, the integer file N10:0 is then copied to STRING file ST16 as final result is display


9
Support Questions / BasicLabel.vb and ClxDriver Standalone.
« on: April 23, 2022, 11:00:20 AM »
Archie,

What the easy way to integrate the BasicLabel.vb to the ClxDriver.DLL?

Few Errors that I need to resolve:

MfgControl.AdvancedHMI.Controls.IKeyboard
MfgControl.AdvancedHMI.Controls.KeypadEventArgs 

Thanks.

10
Open Discussion / VS2022 and .NET/.NET Core and .NET Framework
« on: April 09, 2022, 07:55:39 PM »
I am trying out the new VS2022. 
When creating a new project , there is a difference between a new windows forms app and a new windows forms app(.NET framework).

If select (.NET framework), you can target your project between ( 4 - 4.8 ).  I quickly test AHMI with 4.8, it seemed to work no problem.

Next, I created a new project with windows forms app , select the target to be .NET 6. After jumping through a few hoops, I was able to see a basicLabel working properly.

One nice thing with VS2022, copy an exist folder to the project folder, it will automatically added to the project, no need to do 'include to project' anymore.

Some additional info for Archie:
Code: [Select]
Build started...
1>------ Build started: Project: Dotnet6, Configuration: Debug Any CPU ------
1>C:\MACH\VS\ZebraPrinter\Dotnet6\Dotnet6\Drivers\BaudRateEditor.vb(8,2): warning SYSLIB0003: 'PermissionSetAttribute' is obsolete: 'Code Access Security is not supported or honored by the runtime.'.
1>C:\MACH\VS\ZebraPrinter\Dotnet6\Dotnet6\Drivers\BaudRateEditor.vb(8,53): warning SYSLIB0003: 'SecurityAction' is obsolete: 'Code Access Security is not supported or honored by the runtime.'.
1>C:\MACH\VS\ZebraPrinter\Dotnet6\Dotnet6\Controls\SubscriptionDetail.vb(106,24): warning BC40000: 'Public Shared Overloads Function Copy(str As String) As String' is obsolete: 'This API should not be used to create mutable strings. See https://go.microsoft.com/fwlink/?linkid=2084035 for alternatives.'.
1>C:\MACH\VS\ZebraPrinter\Dotnet6\Dotnet6\Controls\SubscriptionDetail.vb(118,31): warning BC40000: 'Public Shared Overloads Function Copy(str As String) As String' is obsolete: 'This API should not be used to create mutable strings. See https://go.microsoft.com/fwlink/?linkid=2084035 for alternatives.'.
1>Dotnet6 -> C:\MACH\VS\ZebraPrinter\Dotnet6\Dotnet6\bin\Debug\net6.0-windows\Dotnet6.dll
1>Done building project "Dotnet6.vbproj".
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

Note:  .NET core is no longer, merged into .NET 5,6,7,8.
           You cannot copy & paste controls between .NET framework 4.x and .NET .

11
Support Questions / Second BasicLabel is not read/function?
« on: January 14, 2021, 05:26:42 PM »
I have two basic labels. The first label display data (more than what it actually has) but not the second label, not sure why??
As you see in the first pic, Print_TxtArray[0] has a length=6 and Print_TxtArray[2] has length=25
Code: [Select]
BasicLabel1.PLCAddressValue = Print_TxtArray[0]
BasicLabel2.PLCAddressValue = Print_TxtArray[2]      '[1] is too long






The textbox grab the lengthy data from BasicLabel1.

12
Open Discussion / Copy display data from DataGridView to Excel using EPPLUS
« on: November 29, 2020, 09:58:27 AM »
I have a Datagridview that display data from a SQL query. Noted that , the dgv. have some hidden columns [visible=false]. The hidden columns are for higher level access. I want to copy the display data to excel using EPPLUS.

I was able to copy/paste to Excel using Microsoft.Office.Interop. But this approach require Excel installed at the target.  I prefer to use EPPLUS. EPPLUS do not seem to have copy/paste.

With EPPLUS, I can get ALL data[including hidden columns] from the dgv. then remove the unwanted columns.
It would be better if I can get only display data in one shot.

Any ideas?  Thanks.

13
Tips & Tricks / Journey to the Pi
« on: November 15, 2020, 08:04:53 PM »
Journey to the Pi

Since the regular Raspian included more stuff than  what I need, I decided to use thebarebone  Raspian Lite Image.
After download, use WinFlashTool  [or SDFormatter/Win32DiskImager] to write image to SD card. Winflash allow resize partition.
Eject the SD card  and put it in the Pi . Connect keyboard, mouse, Ethernet and power.
Turn on and login with default username/password: pi/raspberry  [passwd to change pw]

first, config your raspian system
Code: [Select]
sudo raspi-config    expand file system  . Finish. Reboot. [not needed if used WinFlashTool in previous step]
   Localized Options, change locale to en_US.UTF8, uncheck en_GB.UTF8 ( use spacebar)
   set timezone, adjust keyboard layout, wifi country
   Interface options:  enable SSH, VNC.
   Advance option:  update tool . Finish.
Code: [Select]
ifconfig // to check ip address [192.168.x.x]
Code: [Select]
sudo reboot  –h now____________________________________________________________________________________
To access remotely  from your laptop : Use BitviseSshClient (much better than putty)  to open a new terminal window  and login to pi.
Code: [Select]
sudo apt-get update // copy & simply right mouse-click to paste into terminal window
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
sudo apt-get clean
sudo reboot –h now // close disconnected window   
BitVise client will autologin after rebooting. Open a new terminal console window when its ready.
Code: [Select]
sudo apt-get install xrdp -y // install remote desktop
[ sudo apt-get install tightvncserver –y  ]  // Full Raspbian only, otherwise not needed.
Next are the steps for installing GUI to run .NET windows apps:
Code: [Select]
sudo apt-get install --no-install-recommends xserver-xorg
sudo apt-get install --no-install-recommends xinit
sudo apt-get install raspberrypi-ui-mods    //install PIXEL UI
sudo apt-get install lightdm // (not needed) install lightDM login manager
sudo reboot –h now // close disconnected window
On the PC window, use command MSTSC to run remote desktop connection to the Pi:, you should now see a graphical desktop pi.
Now back to BitVise client and open a new terminal window to install mono the right way:
Code: [Select]
sudo apt install apt-transport-https dirmngr gnupg ca-certificates
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/debian vs-raspbianbuster main" | sudo tee /etc/apt/sources.list.d/mono-official-vs.list
sudo apt update
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install mono-complete -y                   // coffee break
sudo apt-get install mono-vbnc -y
sudo apt-get clean
sudo reboot –h now // close disconnected window

Note: You can change password with “passwd” command. Dont forget to save a new profile in BitVise client

Use Bitvise SFTP to drag and drop .NET Debug folder to the pi, also some icon files ,ie. AHMI00.ico
To create an application shortcut on the desktop
Code: [Select]
sudo nano /home/pi/Desktop/hpe  // filename=hpe
[Desktop Entry]
Type=Application
Comment=AdvancedHMI Tool
Name=HPE EXE
StartupNotify=true
Exec=mono /home/pi/AHMI/Debug/AdvancedHMI.exe
Icon=/home/pi/AHMI/Debug/AHMI00.ico
Terminal=false
Categories=Utility
StartupNotify=true
Save.Exit.  then change excution mode :  sudo chmod +x hpe
To create an app. shortcut on launch bar:
Code: [Select]
sudo nano /usr/share/applications/hpe.desktop.   add same [Desktop Entry] entries as above
also place a copy in:
Code: [Select]
sudo cp /usr/share/applications/hpe.desktop /usr/share/raspi-ui-overrides/applications/You may need to reboot , then right click File Manager to bring up Application Launch Bar: under Installed application – Accessories, you will see your app shortcut. Double click to add to launch bar

Code: [Select]
sudo cat /sys/firmware/devicetree/base/model;echo // to show pi version
sudo nano  /etc/xdg/lxsession/LXDE-pi/autostart

______________________________________________________________________________________________
With the recent .NET 5 release, it maybe now possible to run some .NET directly
Install .NET 5 6

Code: [Select]
wget https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-linux-arm.tar.gz
sudo mkdir -p /usr/share/dotnet
sudo tar -zxf dotnet-sdk-latest-linux-arm.tar.gz -C /usr/share/dotnet
sudo ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet




 



Pages: [1] 2 3 ... 6