AdvancedHMI Software

General Category => Feature Request => Topic started by: Godra on March 29, 2015, 03:38:13 PM

Title: Have a Keypad write to any PLCAddress
Post by: Godra on March 29, 2015, 03:38:13 PM
It would be like "on the fly" change of the controls PLCAddressKeypad field.

Could be useful only to those who know their PLC tags by heart.

Just an idea.
Title: Re: Have a Keypad write to any PLCAddress
Post by: Godra on March 29, 2015, 06:32:40 PM
Here is a Keypad control I created using mostly Archie's code. It is sufficient just to add it to PurchasedControls folder as existing item.

This control is in the form of a button and a combobox which allows either direct input of a PLCAddress or displaying available PLCAddresses from a collection of string PLCAddressKeypad addresses, that needs to be populated by a user at DesignTime. If identical PLC addresses are entered by mistake into collection they will be displayed as one entry but will not be removed, so it's up to user to organize the collection.
Those manually entered addresses at Runtime, will be used by a keypad but will not be saved into collection.

The collection also allows string separator so descriptive comments could be entered along with a PLCAddress (see the attached picture). The same PLCAddress with and without descriptive comment, if entered, will be displayed and point to exactly the same address.
Current separator is space + 2 forward slashes (" //") but can be changed since there is a public property created.

The control appears to be working fine as it is.
Title: Re: Have a Keypad write to any PLCAddress
Post by: Darrell on May 09, 2015, 11:36:26 AM
Good stuff Godra , I've used this on a few of my HMI's and I must say , it's a  useful component that I added to my toolbox and continue to use. and its nice to see a keypad location was added

A few additions would be nice

- When key pad pops up,  the option of also seeing the comment would be good
- Limits on what can be entered
- Possibly the collection could be read from a spreadsheet or something like that

Darrell
Title: Re: Have a Keypad write to any PLCAddress
Post by: Godra on May 09, 2015, 01:54:19 PM
Thank you Darrell, it is nice to see that somebody is using this control.

Here are my answers to your questions:

- To see a comment just change the following line in the cbPLCAddressKeypad_SelectedValueChanged sub:

Code: [Select]
Me.KeypadText = Me.PLCAddressKeypad.ToString
to

Code: [Select]
Me.KeypadText = Me.cbPLCAddressKeypad.SelectedItem.ToString
- Limitation of any kind is not really what this control is all about (check my initial post). Since the control could be used with different PLCs, addresses or tags would be different and the user really needs to know what they are entering (while observing the current string separators).

- As I stated in my previous post, it is really up to a user to organize the collection. If a spreadsheet or any other file is already organized with addresses and comments then it is just a simple matter of copy/paste into the collection at Design Time <-- all the organizing is done at Design Time while at Runtime the control only displays it.
Title: Re: Have a Keypad write to any PLCAddress
Post by: Godra on May 10, 2015, 06:01:09 PM
Darrell here is some additional information:

- When it comes to limiting what can be entered, you can decide whether to disable that feature completely by commenting out or removing the following sub:

Code: [Select]
Private Sub cbPLCAddressKeypad_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cbPLCAddressKeypad.TextChanged
        Dim stringAddress() As String
        stringAddress = Me.cbPLCAddressKeypad.Text.Split(stringSeparators, StringSplitOptions.None)
        Me.PLCAddressKeypad = stringAddress(0)
        Me.KeypadText = Me.PLCAddressKeypad.ToString
    End Sub

Also change the following line in Keypad_Click sub from:

Code: [Select]
If Me.cbPLCAddressKeypad.SelectedItem = "Select or Enter PLCAddress" Then Exit Sub

to:

Code: [Select]
If (Me.cbPLCAddressKeypad.SelectedItem = "Select or Enter PLCAddress" OrElse Me.PLCAddressKeypad = "Select or Enter PLCAddress") Then Exit Sub

This will still allow users to select from available addresses and since you might be organizing the collection that could implement additional limitation for users to see only addresses you want them to see.
Title: Re: Have a Keypad write to any PLCAddress
Post by: Godra on May 10, 2015, 08:30:56 PM
Here is a new version of this control now with Admin and User features (Darrell asked for limitations so here are some).

2 collections of addresses can be individually set, 1 for User and 1 for Admin, and at Runtime only the User will be visible while the Admin is password protected and can be accessed by holding Ctrl + Alt keys and clicking KeypadPopUp Button. The same combination of keys is used to switch back to User.

3 incorrect attempts to enter the password and the button will be disabled but the password box can still be accessed by using the keyword, entered under Unlock public property, typed directly inside the combobox and followed by the Enter key (default keyword is "!Unlock!").

Password is created as Public Property and is not masked (default password is 4 zeroes = "0000"), is set at Design Time and can be seen by anyone who can open the project in Visual Studio. So be careful of who has access to the project.

Currently the User cannot manually input the address since the sub mentioned in the previous post is commented out (change it if you need different and also change "Select PLCAddress" strings back to "Select or Enter PLCAddress"). This doesn't apply for the Unlock keyword, it can still be entered.

There is now KeypadShowComments public property to enable/disable showing comments along with the address on the KeypadPopUp.
Title: Re: Have a Keypad write to any PLCAddress
Post by: Godra on May 12, 2015, 09:52:40 PM
For those who downloaded this new version, a few bugs were corrected and a new "Unlock" public property was added and the attached file was replaced.

The text in the previous post was also edited so read it again.
Title: Re: Have a Keypad write to any PLCAddress
Post by: Darrell on May 18, 2015, 10:34:16 AM
For some reason I cant get it to show the comment on the key like your previous version ,

what would be nice is to have the option in the properties window , show comment  true / false
also disable entering a plc address that is not in the collection  true / false
Also have a problem getting the tool tip to show. keep up the good work I really like this component.

Darrell
Title: Re: Have a Keypad write to any PLCAddress
Post by: Godra on May 18, 2015, 01:41:27 PM
Darrell,

A file was replaced and now with KeypadShowComments property.

User is already prevented from entering any PLC address and only Admin can do such thing. I am not sure how else to prevent it.

Can you remind me of what tooltips were showing before?
Title: Re: Have a Keypad write to any PLCAddress
Post by: Darrell on June 09, 2015, 06:57:51 AM
I was able to add this to purchased controls in V398m but get this error in the latest ver.

Darrell
Title: Re: Have a Keypad write to any PLCAddress
Post by: Godra on June 09, 2015, 07:48:26 PM
I couldn't see that line in the files that were posted.

Can you attach the file that you are currently using?

You can always try downloading and adding one of the files posted in this topic.
Title: Re: Have a Keypad write to any PLCAddress
Post by: Darrell on June 09, 2015, 08:43:20 PM
my apologies , I had a couple of different versions and tried to use the wrong one , downloaded the lasted one and works fine.

Thanks


Darrell
Title: Re: Have a Keypad write to any PLCAddress
Post by: Godra on June 12, 2015, 11:10:20 PM
Attached is the latest version which should be used with AHMI post 3.98n versions (should work fine with prior versions as well but not with OpcDaCom driver).
Title: Re: Have a Keypad write to any PLCAddress
Post by: Godra on June 30, 2015, 02:13:52 PM
Archie,

How would you go about setting a different driver from within control itself (or just enumerating available drivers)?

For example, if the control's CommComponent shows (none), OpcDaCom1 and ModbusTCPCom1 as available drivers in the property window, I would kind of like to include a combobox in the control that would show all these drivers exactly as they appear in the property and then select one of them.

I have attached BasicIndicator properties window as an example.

Edit: I did figure out one solution for KeypadHMI control itself. The other simpler solution is to put a button or combobox on the MainForm and have it change the driver for the control.
Title: Re: Have a Keypad write to any PLCAddress
Post by: Godra on July 04, 2015, 02:30:20 PM
I have modified the control to be able to change drivers on-the-fly.

There is one catch, if drivers are added or removed after the control has been placed on the form then the form will have to be closed and re-opened, so the control can refresh its list, and then in the control's property window click CollectionOfDrivers and then click OK. This should add/remove the driver from combobox at Runtime.

The following combinations of keys are used to switch back and forth:

SHIFT + Click --> switch between Keypad and Drivers buttons/combobox

CTRL + ALT + Click --> switch between User and Admin combobox


An exception might be thrown if incorrect tags are used with incorrect drivers so try to keep your tags organized and remember what driver is currently selected (I might try to place that indication somewhere on the control).
Title: Re: Have a Keypad write to any PLCAddress
Post by: Godra on July 04, 2015, 11:03:44 PM
The file in the previous post was replaced with new one that now shows the current driver (because of the complexity of how this control works, I couldn't add an option to enable/disable showing of the current driver, so it's always showing).

The initial Runtime screen will show general type of the currently selected driver but once the driver is changed it will have an instance number next to it as well. Here is an example:

You have the following drivers: OpcDaCom1, OpcDaCom2, ModbusTCPCom1 and currently selected driver is OpcDaCom1.
The initial screen will show as "KeyPadPopUp [OpcDaCom]" and if you don't remember which instance it is (1 or 2) then change the driver and then you will get instance number next to it.

I couldn't figure out showing the instance number on the initial screen since DesignMode and Runtime values were just different.

Take it as it is.
Title: Re: Have a Keypad write to any PLCAddress
Post by: Godra on July 08, 2015, 11:41:14 PM
Here is the latest and slightly different version of the KeypadPopUp control (I currently consider it to be the best choice).

This time the initial screen will wait for the driver to be selected first and will populate the combobox with tags specific to that driver only.

String collections for either User or Admin have to be organized for each driver by starting with line separators (star, star, space (** ) which cannot be changed) and the name of the driver. Once all the tags are entered for that specific driver, there has to be the same line separators, and optionally any text, placed after the last tag. Check the attached picture for string collection example. Also attached is a picture of the screen outputs for the mentioned string collection. If tags are not organized this way then there should be no tag showing in the combobox.

Descriptive Comments for tags can still be entered, as with previous versions (default separators are space, slash, slash ( //) and can be changed").

Check the last post on the 1st page of this topic for available button combinations and instructions of what to do when adding/removing drivers after the control has been placed on the form.
Title: Re: Have a Keypad write to any PLCAddress
Post by: Godra on July 09, 2015, 06:17:58 PM
The latest version has been slightly changed:

1) Line separators can be changed now but the new string needs to be used in the User/Admin collections as well
2) Once the driver is selected then it is sufficient just to click the button to go to KeypadPopUp screen (instead of using SHIFT key)

The new file is attached.
Title: Re: Have a Keypad write to any PLCAddress
Post by: Godra on July 19, 2015, 02:08:44 PM
A new addition to KeypadHMI is a screen that shows Allen Bradley PLC type that the control is connected to (check the attached picture). It only works for DF1Com and EthernetIPforPLCSLCMicroCom drivers.

The screen is accessed by pressing CTRL button and clicking on either of KeypadPopUp or Select Driver buttons. Clicking the label will take you back to the previous screen.

If you do get the number showing in brackets but no description then report the number and type of PLC you are using so it could be added to the list. Also report if the description doesn't match your PLC.

The control doesn't work in v3.98t since there was a change in DF1Com driver. If you need to use version t then you can always add, as Existing Item, DF1Com driver from previous version. This control did work in previous versions p, r, s.

Title: Re: Have a Keypad write to any PLCAddress
Post by: Godra on September 04, 2015, 02:05:59 AM
Archie,

DF1Com driver in V399 doesn't work properly.

It is already set to return &H49 processor value and even if I force it to return &H58 it still doesn't communicate with MicroLogix 1000.
I used the DF1Com driver from V398r and it works fine.

For those using KeypadHMI control, attached is a slightly modified version to work with V399 (this due to changed names of the drivers).
Title: Re: Have a Keypad write to any PLCAddress
Post by: Godra on September 05, 2015, 02:22:33 AM
A new addition to KeypadHMI control is a Basic Button which allows quick setting of the boolean type PLC addresses (for other addresses it can perform WriteValue but I would suggest to use KeypadPopUp instead).

Its output type can be changed on-the-fly by right-clicking the button.

The button is accessed by pressing Alt + KeypadPopUp buttons (and switch back to KeypadPopUp button in the same manner).
Title: Re: Have a Keypad write to any PLCAddress
Post by: Godra on November 23, 2016, 07:18:40 PM
This is the latest version of KeypadHMI control which appears to be working fine with v3.99r and v3.99s. It might be somewhat difficult to use this control without a keyboard, this since CTRL / ALT / SHIFT buttons are used to perform switching (for touchscreens this might help http://advancedhmi.com/forum/index.php?topic=1532.0).

The feature to show AB PLCs was removed due to new drivers architecture.

ToolTip will pop-up on MouseHover for both buttons (Keypad and BasicButton). It shows how different combinations of keyboard buttons work:

          CTRL+ALT+Click  switch between Admin / User mode
          SHIFT+Click         switch between Keypad / Drivers mode
          ALT+Click             switch between Keypad / BasicButton

The BasicButton feature is currently available for Admin use only. This implies that ALT+Click functionality is currently only available in Admin mode. 2 lines of code inside btnKeypad_Click sub are marked that could be commented out to enable this button for User as well.

The attached version of the BasicButton could be used instead of the stock version (it allows writing only with the left click of the mouse while the right click will show pop-up menu to change the OutputType of the button on-the-fly  <-- Archie might make these available in the next release).

Also attached is a text file with example strings that could be used in CollectionOfPLCAddress User or Admin.

Try adding the KeypadHMI control after you have placed all the drivers on the form.

If you add/remove drivers after the control is placed on the form, then do either of the following:

-- save all the User/Admin strings/tags, remove the existing KeypadHMI control, save and then add a new KeypadHMI control and populate its User/Admin collections with the saved tags

-- close and re-open the form and then perform a "dummy" update of the CollectionOfPLCAddressUser (literally add word dummy at the end of the collection, close and save and then remove the word and close and save <-- this is a kind of a bug in the control since the Visual Studio updates the drivers collection in the DesignMode but not for Runtime until some additional change has been made).