PLCnext on LinkedInPLCnext on Instagram  PLCnext on YouTube Github PLCnext CommunityStore PLCnext Community

  1. Jason Feusner (I.S.A. Corporation)
  2. PLCnext Engineer
  3. Wednesday, 22 July 2020

So does anyone one have a better way of simplifying creating a INT value for these buttons?  I am going cross eyed figuring out the INT value every time i want to write a different color panel to these buttons. 

 

Or what is the process for making a custom function block to control these buttons.  Something that could be used in may other programs.

That would have the subindex (1-11) for advanced mode as separate INT input on the function block..  

I have attached the Data Map PDF..   

Hope someone has a better way than i do.. 

 

Thank you.. 

Attachments (2)
Martin PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo

Hi Jason,

This does look like a good candidate for a custom function block.

what is the process for making a custom function block to control these buttons. Something that could be used in may other programs.

Here is a short video that shows the process for creating your own Function Block (FB) library in PLCnext Engineer, containing a simple function block that can be used in other projects.

 

In your case, the function block Outputs would be the nine Octects that contain the LED control data. The Inputs would be the settings like Animation Type, Animation Direction, etc. It makes sense that each of these FB inputs would be defined as "Enum" types in PLCnext Engineer. There is infornmation on how to create Enum types in the PLCnext Engineer help system - screen shot below:

 

2020 07 22 9 28 18

Hope this helps.

~ Martin.

Phoenix Contact Electronics Headquarters - PLCnext Runtime Product Management and Support

Jason Feusner (I.S.A. Corporation) Accepted Answer Pending Moderation
0
Votes
Undo

Thank you Martin for your quick response.. 

 

I did not realize creating a function block is so simple to create..   I will used this many time in the future for sure.  Funny i did not know this being a long time PCWorx user.. 

 

My question now is how do you hold the Bit Spacing in the Octects for "0" Bits.   I added a few screen shots of where i am at with this.. 

 

Example:

Animation_Type is 4 Bits long

Animation_Direction is 1 Bit long

Animation_Pattern is 3 Bits Long

and so on.. 

 

If each one of those init values = 1 then the output of the function block on a bit level would be "111" and not the required "00110001"

 

Also would the 9 Octlets be a ByteArray9 if so int can not be added to bit array.

 

Any help would be greatly appreciated.. 

 

 

Attachments (3)
Martin PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo

Hi Jason,

One solution is to use the bit-access operators, e.g. Animation_Type.X0 to read bit 0, and K50_WRITE[0].X0 to write bit 0 of byte 0.

You can only use these operators on "ANY_BIT" variables:

2020 07 22 222002

... so you would need to change the type of your Input parameters if you want to use this operator.

To see more about "Partial Access" operators, search the PLCnext Engineer help system for "Partial Access to ANY_BIT Variables".

If you are going to use Enums for the inputs, then you can define the type of the Enum to be one of the ANY_BIT types, so you can still use the partial access operators on Enums.

And because ANY_BIT types come in 1, 8, 16, 32 and 64 bit widths, you can chose the smallest one for the width of the input variable. For example, you can declare Animation_Type as a BYTE, and Animation_Direction as a BOOL (or Enums of those types).

Hope this helps.

~ Martin.

Phoenix Contact Electronics Headquarters - PLCnext Runtime Product Management and Support

Jason Feusner (I.S.A. Corporation) Accepted Answer Pending Moderation
0
Votes
Undo

Thank you Martin..  

I will keep this thread updated on progress.    I must have had a complete mental block as i have used ANY_Bit no less thank 200 times in PCWorx...    

 

?

Martin PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo

OK, great.

If you end up with an FB library that you think would be generally useful for other Community members, please consider adding it to the PLCnext Store.

I am sure that your Banner sales rep would be delighted with anything that makes their products easier to use ... perhaps you can negotiate a discount with them on future purchases ...   ;-)

~ Martin.

Phoenix Contact Electronics Headquarters - PLCnext Runtime Product Management and Support

thekrel Accepted Answer Pending Moderation
0
Votes
Undo

Martin,

 

I built function blocks for the Banner K50, Banner K50PT, and the Banner TL50.  How do I create a library of functions for the PLC Next Store? I didn't use enum values, but did use structured data types to make mode selections easier. 

 

Josh

Martin PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo

Hi Josh,

The first thing you will need is a Function Block library (i.e. a .pcwlx file), created in a similar way as we discussed above. Once you are happy that the FB library is ready to be published, you can make it available on the PLCnext store.

To load something to the Store, you need to be a "contributor":

 

2020 07 28 8 03 25 1

After you become a contributor, then in your Store Profile you have the option of creaing new apps. In this case it will be a "Library" type app.

2020 07 28 8 07 04

 

 To create the Store entry, you just need to fill out a form - partly shown below - and upload the FB library.

2020 07 28 8 07 51

 

It's as easy as that!

Note that there is a PLCnext Store Info Center, which you can reach from the "Knowledge Base" menu above, but this only describes the non-library app types which take a bit more work to prepare for the Store.

Hope this helps.

~ Martin.

Phoenix Contact Electronics Headquarters - PLCnext Runtime Product Management and Support

Jason Feusner (I.S.A. Corporation) Accepted Answer Pending Moderation
0
Votes
Undo

Josh - 

 

That is great..  I have both the K50 and TL50 on this project..   Just have not had a chance to build any blocks yet.. 

 

I will be anxiously awaiting your posing of those function blocks.. 

 

Thank you. 

 

Jason 

thekrel Accepted Answer Pending Moderation
0
Votes
Undo

Jason,

I've got the files ready, working my way through the PLC Next store contributor process now.

@Martin What tool do you use to create the .msi file? That's my last step and none of the tools I've found so far are working for me.

Josh

Martin PLCnext Team Accepted Answer Pending Moderation
0
Votes
Undo

Hi Josh,

I think we use Wix internally here, but I haven't used it myself so I can't give any advice on this (sorry).

~ Martin.

Phoenix Contact Electronics Headquarters - PLCnext Runtime Product Management and Support

thekrel Accepted Answer Pending Moderation
0
Votes
Undo

Martin,

I found a tool called MSI Wrapper: https://www.exemsi.com/download/

The library is published. I have not built a help file yet, but the code is heavily commented. The batch file should copy the library directly to the correct location. Give it a try and see if it works. 

Josh

Rob Huisken Accepted Answer Pending Moderation
0
Votes
Undo

Good to know about the MSI Wrapper. Thank you. 

I have a handful of FB's that I would like to create a library with, but haven't taken time to mess with the installer or documentation. If you share any words of wisdom for creating the help file, I would greatly appreciate it. 

Automation Engineer - Grand Rapids, MI, USA

  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.