Jump to content

Unitronics V130 MB keypad entry


Recommended Posts

  • MVP 2023

Create a subroutine that only runs when the display is active.  Set it up from the "Links & Jumps" tab on the display - 

 image.png.5bc91c23da55d732ef567532ed1f5119.png

 

In that subroutine, hard code the key system bits to toggle your working bits - 

image.png.ccc0779d4b8e4845134873a7ca02cefd.png

 

Is this what you're looking for?  If not, post your code so we can see the whole story.

 

Joe T.

 

 

Link to comment
Share on other sites

  • MVP 2023

If these are truly Digital Inputs on your 130 like your screen shot implies, toggling them as Joe suggests may not actually achieve the result you want if the input is actually connected to a switching device.  The Device's state will always win.

cheers, Aus

Link to comment
Share on other sites

Thanks Joe Tauser.

This is not what I'm looking for.

In one display I have like 12 different MB's. (I run out of number keys).

It is also not user friendly... 

What I would like is to jump to variable and change/toggle its state with arrow keys. The same way you change MI's. 

 

 

Ausman

Only the first three MB's are trully MB's. And are RW type.

 

I'm attaching small sample with NOT working MB toggle...

Temp.vlp

Link to comment
Share on other sites

  • MVP 2023

Kratmel, (or others) can you please explain this a little more.  I think I might be about to learn something new.  And need to correct my previous statement!    I have always believed that nothing could alter an input's state from the initial read at scan start.

cheers, Aus

Link to comment
Share on other sites

Hi everyone,

I came out with an idea while reading this thread.

Let us put the MBs in a contiguous area of your PLC memory, for instance you have your 1st MB "MB0" and your last MB "MB8". 

Let us assume that these MB are in a grid of 3x3 in your display.

 

Let "MI0" be a counter variable. When you load your display, MI0 initiates to 0 and varies as follow

a. If you press Right arrow, MI increments by 1.

b. If you press left arrow, MI0 decrements by 1.

c. If you press bottom arrow, MI0 increments by 3.

d. If you press top arrow, MI0 decrements by 3.

If you want to toggle a given bit, press "Enter" when you are positioned correctly. By pressing "Enter", you need to trigger a bit toggle operand, going from MB0 to MB8 and shifted by MI0 value.

 

You can find a simple example of my idea attached to this post.

Cheers,

Sideway.

MB_grid.vlp

Link to comment
Share on other sites

Hi farcry,

I just gave an example on a new project, leaving the PLC config by default... which appears not to be V130 😛That's why i may have more options than you ^^

I think you can discard Marking View... Actually i only own a V130 myself ! So i do not even know what this option is doing ;) i was just assuming while writing the code.

The goal of my example was simply to show an alternative to toggle those bits on any vision screen.

I did not think deeper about it, but we may find a way to trigger some indication on the display that the bits are ON or OFF ! Like using the "Hide" function with a drawn rectangle surrounding each bit on the display ;)

Cheers, 

Sideway.

Link to comment
Share on other sites

Thanks again Sideway.

I have modified yours perfectly working code to work with V130.

I also used INVERSE bit to see which MB you are toggling.

The only downside of this method is, that you have to have LINED UP MB's. 

For example MB0 to MB7.

You can not have for example MB1,MB2 then MB8,MB9 and MB33, MB34.

Thanks again for yours excellent idea.

BR, Farcry. 

MB_grid_V130.vlp

Link to comment
Share on other sites

Hi farcry,

thank you for your kind reply. I may have a suggestion for you, if your MBs are in various places.

***EDIT : I thought a bit more about the following suggestion... Be careful with the Struct object, i did not test my solution yet but i think it may generate overflows since i load a MI 16-bit value within a bunch of MBs (there are not necessarily 16 of them).  Needs to be confirm by advised Uni-guru superheroes 😅

A solution i may have here is to add dummy bits if needed until you reach 16 bits /EDIT***

You may have a look at the Struct object (under vector functions list). This way, you can link every MB from any location with a contiguous register, such as an MI (which is basically 16 bits following eachother) for example. And actually, all you need to do is modify your MI value with the register toggle operand, which will toggle on/off your MBs indirectly.

 

You can have a look at the Struct function help in VisiLogic, which illustrates how the function works. If you want, i can rewrite my example code to show you ;)

 

Cheers,

Sideway.

Link to comment
Share on other sites

Thanks again Sideway.

I have modified project using STRUCT.

But unfortunable this STRUCT function doesn't work like I thought it would.

It creates ARRAY of MI's. Not just ONE MI...

I could do this using  SET/RESET bit, but this is time consuming and confusing method (If you use more MB's - like 30).

I have attached sample.

Do you have any other idea?

Struct.png

MB_grid_V130_V3.vlp

Link to comment
Share on other sites

Hi farcry,

 

That's what i was doubting about while writing my post 😕 It turns out you can only set packets of 8 bits (1 byte) with the Struct object, i forgot about that detail ^^ (for instance, according to what you wrote in your structure, your 1st byte sent in your MI vector is : [MB50 to MB57] stored in the bits 0 to 7 of MI150, then your 2nd byte is : [MB51 to MB 58] stored in  the bits 8 to 15 of MI150...  Then [MB55 to MB62] stored in the bits 0 to 7 of MI151... and so forth.

So yes, my advice was not the best ahah.

However, using the struct object would be fitting perfectly using words such as MI, ML etc. since they are packets of 16 and 32 bits ;) But it's not what you are trying to do :(

 

What i can suggest is simply the following :

Solution 1) Do as Flex suggested : you can move your MBs with the "Replace operand" function. It may be a bit tricky to use, so i will show you how to proceed down below.

Solution 2) Store your MBs that are in different locations to a contiguous MB vector. This way, you can keep your MB fields as they are, you just need to create more MBs : you may use contacts and direct coils to do this ==> Simply link a direct coil MB50 to a direct contact MB0 for instance, then MB51 to MB1, MB55 to MB2 etc. And then you work with your MB0 to MBx vector field.

 

Example for solution 1 :

Let's say you want to turn MB51 and MB52 into MB0 and MB1.

Open "Replace operand" function (under Edit panel) and do the following :

In "Select operand and Adress", write MB51. Press OK.

In the new window "Select  operand and Address to replace MB51", write MB0.

Then, in "Replace" window, write "Vector length" = 2. This way, it will take both MB51 and MB52 into account and turn them into MB0 and MB1. If you had only 1 value to change, you would write 1 in the vector length.

Check the boxes "Copy properties" and "Clear source operands".

Press OK. And you are done :)

 

 

Cheers,

Sideway.

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.