# How to work with a large number of inputs?

## Recommended Posts

The machine I've built punches holes into long strips of sheet metal. The sheet metal is fed through the machine in 1/4" increments. The operator inputs the position of the holes into the PLC. For example, if the part needs a hole punched at 2", 3.5" and 6", the operator keys in the 8th, 14th, and 24th location (since each position is 1/4").

The PLC then keeps track of the number of increments the sheet metal has moved and activates the hole punch at the appropriate time.

My problem is that I want to allow the operator to enter a large quantity of numbers, and the way I'm writing my ladder now would make that very messy. I am trying to figure out vectors or arrays for this, but I am new to visilogic and don't understand the best way to go about doing it. I assume this form of data entry is very common and there is probably a good way to go about doing it. Could anyone point me in the right direction?

The way I am doing it now is I have an "Equal To" function block, and I compare the current position of the sheet metal to the entered value. If that's true, the hole gets punched. For example, if the metal is at position 10 (2.5") and the user had entered position 10, the hole gets punched. The problem with this is I have to write a separate function block for each user entered position.

I apologize if this doesn't make sense. I have only taken a couple classes in PLC programming and we did not cover this.

##### Share on other sites

I am not an expert by any means, but wouldn't "multiply by" 4 do it? Operator enter the desired number into an MI and multiply block will do the calculation. If the amount of sizes are less than say 40-50, you could make a button for each dimensions and the operator would only hit the desired size button instead of entering a keypad all the time.

##### Share on other sites

• MVP 2023

No reason the operator has to enter in any numbers - just have a button or spot on the screen for each hole position (use binary text element, with "toggle") and have the operator touch each position that will have a hole. At each position if the bit is on (has been toggled by the operator), then the hole is punched. Reset all the buttons at the end of the metal strip, or as each hole is punched as a visual indicator of progress.

##### Share on other sites

I am not an expert by any means, but wouldn't "multiply by" 4 do it? Operator enter the desired number into an MI and multiply block will do the calculation. If the amount of sizes are less than say 40-50, you could make a button for each dimensions and the operator would only hit the desired size button instead of entering a keypad all the time.

Thanks for your reply, but I think I may have mis-stated what I'm trying to do. Yes, multiplying by four (or rather in my case, dividing by four) would give me the conversion between what the operator enters and where I want the hole punched, but that's not what I'm having trouble with.

I do like your idea of just placing a button for each location, though my screen isn't that big (V350 model). I'll try to make something like that work.

No reason the operator has to enter in any numbers - just have a button or spot on the screen for each hole position (use binary text element, with "toggle") and have the operator touch each position that will have a hole. At each position if the bit is on (has been toggled by the operator), then the hole is punched. Reset all the buttons at the end of the metal strip, or as each hole is punched as a visual indicator of progress.

I like something like this, though on my small screen I'll have to be careful that each button can easily be pressed.

However, if I wanted to turn a keypad input into a certain bit being turned on, how would I do that? For instance, the user enters "12" and that turns the twelfth bit of a series to true. Knowing how to do this would save me a lot of time.

Thanks!

##### Share on other sites

• MVP 2023

Look at the "Set Bit" instruction under the Logic menu.  This instruction sets a bit in an MI array.  You could examine the bits with the "Test Bit" instruction (located in the same place) with a pointer incremented by your program after the user sets it up.  Use the "Fill" instruction under the Vector menu and fill the MI array with 0s to initialize it.

If you do it right you should be able to achieve what you want in just a couple of networks.

Joe T.

• 1

## Create an account

Register a new account

×