Author Topic: Display Position By Integer Value  (Read 1107 times)

AabeckControls

  • Full Member
  • ***
  • Posts: 193
    • View Profile
Display Position By Integer Value
« on: December 16, 2017, 09:25:30 AM »
I am updating a panel that has an iFix HMI presently that has a hoist graphic that moves across the screen as the X-Axis value changes. The way I did something similar was to have the PLC check the position value and set one of 23 bits and use the bits as Visible bits for 23 graphics. For this system I would need 76 graphics. I am writing this using v399x.

Is there a way in VS of putting the horizontal position value as a PLC integer as iFix does? I tried to enter the tag address a few different ways in the position box but it pops up a window 'Property value is not valid'

Phrog30

  • Guest
Re: Display Position By Integer Value
« Reply #1 on: December 16, 2017, 09:29:48 AM »
I would only create one graphic and display it on the form using x and y position properties. I've done this on a few projects in the past. I could post code snippets later if necessary, but it's pretty straight forward and you can search Google on how to do it.

AabeckControls

  • Full Member
  • ***
  • Posts: 193
    • View Profile
Re: Display Position By Integer Value
« Reply #2 on: December 16, 2017, 10:47:34 AM »
Phrog,

Thanks - I found some differing instructions though. The common way seems to be:
         PictureBox2.Left = 300

I couldn't find a way to use an integer read from the PLC instead of a set value.

Also, one video says that this can't be placed in the code for the object, but to use it in the form's code - do you know if that is right & where to put it properly?

I really would appreciate it if you could post an example, I am new to VS

Phrog30

  • Guest
Re: Display Position By Integer Value
« Reply #3 on: December 16, 2017, 12:37:15 PM »
Open the form, drag a datasubscriber2 to the form.  It will get added below the form.  Double-click the datasubscriber2 component you just added.  VS will add some code for you and open up the code editor.  Add this code within, create one for each address you add in the subscriber:

Code: [Select]
        If e.ErrorId = 0 AndAlso e.Values IsNot Nothing AndAlso e.Values.Count > 0 Then

            If e.PlcAddress = "North_Trolley_HMI_Position.Output" Then
                pnlNorthTrolley.Left = e.Values(0)
                pnlNorthTrolleyConv.Left = e.Values(0)
            End If

        End If

You will need to replace what's in quotes with your address.  For each object you want to move on the screen replace everything before ".Left".  Depending on how fast you want this object to move, you may want to create another comm driver set to a faster poll rate and point the datasubscriber to this driver.

That's basically it.

Edit, one more thing, you will need to do some scaling to put the object on the correct point(s) on the form.  I would scale in the PLC.

James
« Last Edit: December 16, 2017, 12:40:54 PM by Phrog30 »

AabeckControls

  • Full Member
  • ***
  • Posts: 193
    • View Profile
Re: Display Position By Integer Value
« Reply #4 on: December 16, 2017, 01:14:32 PM »
Phrog,

Thanks.

I already started the scaling in the PLC, just need to tweak the screen position as the hoist position ranges from 85 to 31,800

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5261
    • View Profile
    • AdvancedHMI
Re: Display Position By Integer Value
« Reply #5 on: December 17, 2017, 11:35:58 AM »
You can try this:

- In the AdvancedHMIControls project, right click ImageDisplayByValue and select view code
- Look for the #End Region around line 314
- Insert this line just above that:

    Public Property PLCAddressLeft As String

- Build the project
- On your form add an ImageDisplayByValue
- Set the Image property
- Set the PCLAddressLeft property to the address that has the X Position value

Run the application and the Image will move based on your PLC value