Author Topic: INDIRECT ADDRESSING  (Read 1553 times)

DavidSr

  • Full Member
  • ***
  • Posts: 170
    • View Profile
INDIRECT ADDRESSING
« on: February 28, 2019, 12:55:02 PM »
Been searching for a control in AHMI to use for indirect addressing Not finding what I want.
I would like to have a list of items with values assigned to them. When one is selected it writes the value to another integer. 

I was looking at combining a thumb wheel or such like with a message display by value to show which item is selected then a button to write the value to the destination word. This isnt actually indirect addressing but I don't see indirect addressing supported in AHMI- Am I wrong?
I have done this in AB Panelviews. What is there in AHMI to do this?

Thank you. I have Open ears for any better ways of doing this.
David

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: INDIRECT ADDRESSING
« Reply #1 on: February 28, 2019, 02:13:05 PM »
The most direct method would be to add an event handler when your thumbwheel changes to write the value to the MessageDisplayByValue property of Value. For example if you wanted to control the message being displayed with a NumericupDown:
Code: [Select]
    Private Sub NumericUpDown1_ValueChanged(sender As Object, e As EventArgs) Handles NumericUpDown1.ValueChanged
        MessageDisplayByValue1.Value = NumericUpDown1.Value
    End Sub

You will not be able to use the PLCAddressValue property otherwise the PLC will quickly overwrite what the NumericUpDown set.

DavidSr

  • Full Member
  • ***
  • Posts: 170
    • View Profile
Re: INDIRECT ADDRESSING
« Reply #2 on: February 28, 2019, 03:30:43 PM »


Is there a AHMI control to use for a simulated thumbwheel so we don't need to call up the keypad. I don't want to use ini files
David

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: INDIRECT ADDRESSING
« Reply #3 on: February 28, 2019, 03:41:57 PM »
Using multiple NumericUpDown's with some code would be the closest thing to a thumbwheel. Or something from the Analog Input expansion pack.

An example:
https://www.advancedhmi.com/forum/index.php?topic=178.msg509#msg509

Or maybe this:

https://www.advancedhmi.com/forum/index.php?topic=1939.msg10837#msg10837

DavidSr

  • Full Member
  • ***
  • Posts: 170
    • View Profile
Re: INDIRECT ADDRESSING
« Reply #4 on: February 28, 2019, 03:56:02 PM »
Using multiple NumericUpDown's with some code would be the closest thing to a thumbwheel. Or something from the Analog Input expansion pack.


Just bought the expansion pack, have those controls been upgraded to 399y yet,? if not I will try to do it and send them to you.

I'll try both methods,
David

DavidSr

  • Full Member
  • ***
  • Posts: 170
    • View Profile
Re: INDIRECT ADDRESSING
« Reply #5 on: February 28, 2019, 04:06:08 PM »
............................ have those controls been upgraded to 399y yet,? if not I will try to do it and send them to you.


Took care of it. I'll send them to you if you want-
David

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: INDIRECT ADDRESSING
« Reply #6 on: February 28, 2019, 04:10:11 PM »
I have updated versions of them.

DavidSr

  • Full Member
  • ***
  • Posts: 170
    • View Profile
Re: INDIRECT ADDRESSING
« Reply #7 on: February 28, 2019, 04:19:05 PM »
I think the updown counter will work but help me understand what this additional code does.

The simplest way is to add a numeric up/down from the ToolBox to your form, then double click it to get back to the code, then add this code:

Code: [Select]
    Private Sub NumericUpDown1_ValueChanged(sender As System.Object, e As System.EventArgs) Handles NumericUpDown1.ValueChanged
        ModbusTcpCom1.Write("40001", NumericUpDown1.Value)
    End Sub
David

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: INDIRECT ADDRESSING
« Reply #8 on: February 28, 2019, 04:23:07 PM »
I think the updown counter will work but help me understand what this additional code does.
Anytime the NumericUpDown's value is changed, it will run that piece of code. The sample code I supplied would be if you are using the Modbus driver. It directly accesses the driver and writes the current value in the NumericUpDown to the PLC Address of 40001.

That code will change based on which driver you are using.

DavidSr

  • Full Member
  • ***
  • Posts: 170
    • View Profile
Re: INDIRECT ADDRESSING
« Reply #9 on: February 28, 2019, 04:30:15 PM »

That code will change based on which driver you are using.
Ok If I  try to modify it for what I am doing then is it just a matter of changing the driver and the destination address? and where is the prefered place in the code to add this?

if  i have trouble I will beg your assistance,
David

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: INDIRECT ADDRESSING
« Reply #10 on: February 28, 2019, 04:38:52 PM »
If you are using the EthernetIPforSLCMicroCom driver, then you code would look something like this:
Code: [Select]
Private Sub NumericUpDown1_ValueChanged(sender As System.Object, e As System.EventArgs) Handles NumericUpDown1.ValueChanged
        EthernetIPForSLCMicroCom1.Write("N7:0", NumericUpDown1.Value)
End Sub

The easiest way to get the code in the correct place is to do this:

- Add a NumericUpDown to the form
- In the Properties Window, click the lightening bolt in the tool bar
- Look for ValueChanged in the list
- Double click to the right of ValueChanged and it will take you to the code and add some of it for you
You will only need to manually add the 1 line of code.