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

Pages: [1] 2
1
I believe I'm subscribing to each element individually.  I just noticed the "NumberOfElements" option.

2
Thanks Archie, that worked.  Now, how would I pull each value from the DataSubscriber?

Basically, the code should work like this:

ElseIf e.PlcAddress = "N20:33" Or e.PlcAddress = "N20:34" Or e.PlcAddress = "N20:35" Or e.PlcAddress = "N20:36" Then

Value1 = 'whatever is in N20:33
Value2 = 'whatever is in N20:34
Value3 = 'whatever is in N20:35
Value4 = 'whatever is in N20:36

I tried using Value1 = e.Values(0), Value2=e.values(1)... but got an error saying the index is out of range, so I don't think that is the correct way to do it.

3
Is it possible to test multiple addresses using the e.PLCaddress condition?

My program is giving me an error when I run it, pointing to the following line of code:

ElseIf e.PlcAddress = "N20:33" Or "N20:34" Or "N20:35" Or "N20:36" Then ...

The error is attached

4
Thanks Archie, I didn't know that page existed.  Good info on there!

5
Ok, so I set up a DataSubscriber2 for each PLC address I am wanting to continuously update.  Now how would I convert those values from integer, to hex, and then combine them to display a floating point value?  I assume I would put the code in the DataSubscriber21_DataChanged event, but how would I address each value?

6
I am using AdvancedHMI 3.98t with a Micrologix 1100.

I am working with a sensor that outputs a Hex string message.  The message contains multiple pieces of data, using different units for each piece of data.  Some pieces of data are 2 bytes, some pieces of data are 8+ bytes.  In the Micrologix PLC, the entire message gets imported to an integer array.  In RsLogix, if I open the integer array and change the 'Radix' option to "Hex/BCD" then I can see the Hex data that is equal to the message being sent from the sensor.  So, for example, N1:0=AAAA, N1:1=BBBB, N1:2=CCCC, etc.

One of the pieces of information I am interested in is made up of 8 bytes of data, meaning it is spread across 4 consecutive integer values.  For example, N1:0=4151, N1:1=8AFC, N1:2=7FFC, N1:3=BADE.  The actual value I'm interested in is a SP Float with the hex string value "41518AFC7FFCBADE," or a decimal equivalent of "4598769.99."

I currently have the program set up to where I can click a button, and the decimal value is displayed in a text box.  The code for the button press is shown below:

Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click

Dim Value1() As Integer = EthernetIPforSLCMicroCom1.ReadInt("N1:0", 2)
Dim Value1Hex As String = Value1(0).ToString("X4")
Dim Value2() As Integer = EthernetIPforSLCMicroCom1.ReadInt("N1:1", 2)
Dim Value2Hex As String = Value2(0).ToString("X4")
Dim Value3() As Integer = EthernetIPforSLCMicroCom1.ReadInt("N1:2", 2)
Dim Value3Hex As String = Value3(0).ToString("X4")
Dim Value4() As Integer = EthernetIPforSLCMicroCom1.ReadInt("N1:3", 2)
Dim Value4Hex As String = Value4(0).ToString("X4")
Dim Value14digithex As String = Value1Hex.Substring(Value1Hex.Length - 4, 4)
Dim Value24digithex As String = Value2Hex.Substring(Value2Hex.Length - 4, 4)
Dim Value34digithex As String = Value3Hex.Substring(Value3Hex.Length - 4, 4)
Dim Value44digithex As String = Value4Hex.Substring(Value4Hex.Length - 4, 4)
Dim ValueHex As String = Value14digithex & Value24digithex & Value34digithex & Value44digithex
Dim I64 As Int64 = Int64.Parse(ValueHex, Globalization.NumberStyles.HexNumber)
Dim Value As Double = BitConverter.Int64BitsToDouble(I64)
TextBox1.Text = Value.ToString("#.##")

End Sub



This approach has worked so far, but it takes a few seconds for the value to show up in the textbox.  I'm guessing the delay is due to the fact that the program has to read each value from the PLC, and then convert the values into a form that is meaningful (in this case, a decimal value).  I would like to eliminate the button, and have the value continuously update on one of the screens with as minimal delay as possible.  Does anyone have any tips on how to approach this?

7
Support Questions / Program locks up if connection is interrupted
« on: April 17, 2017, 04:42:42 PM »
I'm using a Micrologix 1100 PLC with a tablet running AdvancedHMI 3.98t.

One of the issues that I've run into is that when the tablet screen is locked, the connection to the PLC gets disconnected.  Then when the screen is unlocked, the program locks up, and doesn't appear to be communicating with the PLC anymore.  If I exit the program, and restart it, the program works fine.

I was wondering if there is any way to prevent this from happening.  Or, if there is a way to make a button to re-establish the connection with the PLC.  Then I could make a popup dialog box saying "Connection interrupted, Click OK to re-establish the connection" or something along those lines.  Thanks.

8
Support Questions / Re: Any way to run AdvancedHMI without PLC connection?
« on: December 08, 2016, 10:56:56 AM »
Thanks Archie.  I went through and set DisableSubscriptions to True on all the forms.  That seems to have worked, but when I click a FormChangeButton to switch from one screen to another, it is taking about 10-15 seconds to switch to the new screen?  Any ideas what to do to speed this up?

9
Support Questions / Any way to run AdvancedHMI without PLC connection?
« on: December 07, 2016, 11:44:02 PM »
I would like to demonstrate our control software (using AdvancedHMI), and won't have access to our equipment with the PLC.  Is there any way to run the program without a PLC connection?  When I try launching the program, it's very unresponsive, and all the labels read "Failed to get processor type."  I would like to be able to click through the screens, show the screen layouts, and have some "example info" entered into the fields that would normally be filled by PLC values.

10
Support Questions / Re: Integer Data Out of Range
« on: August 16, 2016, 11:39:31 AM »
or
Code: [Select]
        Dim hexString As String = "8AFA"  'to 16 bit signed integer
        Dim num As Integer = Int16.Parse(hexString, System.Globalization.NumberStyles.HexNumber)

I used this one, and it worked.  Thanks!

11
Support Questions / Re: Integer Data Out of Range
« on: August 15, 2016, 04:46:33 PM »
I'm trying to write a value as an integer to a Micrologix 1100 PLC, using the EthernetIPforSLCMicroCom1 driver.  I'm trying to write the value 35578, and I'm getting an error "unhandled exception" saying that the data is out of range (-32768 to 32767).  Is there any way to do this?

Just to clarify a little bit, I'm starting with the hex string '8AFA' which is what I want to write to the PLC.  I'm writing to an integer array, so I did a convert.toint32 before using the EthernetIPforSLCMicroCom1.write command.  I want to write an integer with the hex equivalent of '8AFA' to the PLC.  Thanks!

12
Support Questions / Integer Data Out of Range
« on: August 15, 2016, 03:36:12 PM »
I'm trying to write a value as an integer to a Micrologix 1100 PLC, using the EthernetIPforSLCMicroCom1 driver.  I'm trying to write the value 35578, and I'm getting an error "unhandled exception" saying that the data is out of range (-32768 to 32767).  Is there any way to do this?

13
Support Questions / Re: Question about using BasicLabels
« on: August 04, 2016, 12:13:42 PM »
That worked.  Thanks Archie!

14
Support Questions / Question about using BasicLabels
« on: August 03, 2016, 02:06:16 PM »
I'm using a touchscreen for my HMI, with no keyboard, and the BasicLabel has been great for having user's enter values because of the pop-up keypad.

On one of the screens, I need to add an entry field for the user to enter a decimal number.  This value is not going to be written to the PLC directly, but will need to go through a few programming steps and formatting changes before being sent to the PLC.  Normally, I would just use a regular textbox from the Windows common controls, but that doesn't have a popup keypad when the user clicks on the field.  I tried adding a BasicLabel from the AdvancedHMI controls, but nothing happens when I click on it.

Is that because I don't have anything in the PLCAddress Properties?

Do I need to have a PLC Address entered, in order for the keypad to pop up?

Is there a simple way to have the AdvancedHMI keypad pop up when the user click's on a regular textbox from the common controls?

15
Gorda, I really appreciate the info.  I am using the Ethernet driver (not serial), so when I wrote the code I got an error on the "Me.EthernetIPforSLCMicroCom1.BeginWrite...." line. 

"BeginWrite' is not a member of 'AdvancedHMIDrivers.EthernetIPforSLCMicroCom'.

Pages: [1] 2