help with a ladder function.

amirk

Member
Join Date
Dec 2012
Location
Rishon le zion
Posts
13
hi guys
i just bought a idec FC4A-D20RK1 plc.
im using the windldr software.
my question is:
lets say i have a 11 (0-9+enter) digit board, each digit is connected to a different input.
i want to use those digits to preset a counter\timer value.

lets say, for example, i press two times on the digit 4, and than i press the ENTER to set it.
i want the preset value will change to 44 seconds.

i assume i can't use math because 4+4 will set it to 8, that isnt what i want.

how do i do that?

thanks.
 
Welcome to the forum,

You may try to write into a string address upon key pressed and when enter is pressed convert it to integer before moving to your timer preset value.

Regards
 
you could do math...
the math would be [key1]+([key2]x10)+([key3]x100)+([key4]x1000)+([key5]x10000) etc. = number, then use that number for the counter/timer

so basically for your example:
4+(4x10)+(0x100)+(0x1000)+(0x10000)=44 seconds
simplified:
4+40+0+0+0=44
hitting enter will execute the math, and no keypress is equal to 0

i think the simpler way to do it tho would probably be what chavak suggested. i just wanted to suggest another way to do it. but it would take more code

to do the above example, you would increment a counter up by 1 each time(starting at 0) a numerical key is pressed, and execute the math for each keypress as you go. enter will execute the math then put that number into the preset and then put the counter back at 0.
the math would be
[stored number] + [key pressed]*10 to the power of counter accumulated value = [new stored value]
so for your example:

(4*10^0)+(4*10^1)+(0*10^2) etc = stored number
simplified
(4*1)+(4*10)+(0*100) = stored number
simplified again
4+40+0 = stored number

so it can be done with math, basically the counter is determining which significant digit you are on and the 10 to the power of signifigant digit is the calculation when using the decimal system (0-9)
 
Last edited:
so it can be done with math, basically the counter is determining which significant digit you are on and the 10 to the power of signifigant digit is the calculation when using the decimal system (0-9)
As with any key entry method, the problem is how to handle input errors and accidental key presses. You have to have some method to correct errors in entry, maybe as simple as allowing each entire number input to be reentered and corrected at any time.
 
hi guys thanks for the replays.
that math method looks like a tough one to complete. i will start working on it see where i get.

can you expain a little bit more about chavak's method? what function is it that i need to use?
i just want to say that im taking a plc course at the moment and we didnt get that far yet :)
 
Can you expain a little bit more about chavak's method? what function is it that i need to use?
It depends on the capabilities of your HMI display device. Because the IDEC brand Microsmart FC4A-D20RK1 micro PLC has no built-in display device, then I AssUMe that you are using one of the IDEC accessory display units. I have not yet found a online manual for those, so I cannot say how a number or string could be entered. However, for most other display units, an entry box can be set up on the screen, which you designate to accept a Number type (Integer, Floating-Point, etc), or a String type with letters or numbers, into which box you can enter a series of key presses followed by the ENTER key or some other character that designates end-of-entry.
Lets say that I have a 11 (0-9+enter) digit board, each digit is connected to a different input. I want to use those digits to preset a counter\timer value.
That is not the typical HMI control and display device method to handle inputs. Typically the user is allowed to set up boxes on the screen, and assign a tag or PLC address to each box. However your small micro PLC may be limited.

What is the brand and model number for your HMI display device?

For the Idec FC4A-PH1 HMI module (for the Idec FC4A-D20RK1 PLC), see Page 12 of this brochure for instrutions on how to enter Timer preset values. However this module only has ^ Up and v Down arrow buttons, not 10, so I don't know which HMI you have.
http://www.idec.com/language/english/brochure/MicroSmartBrochure.pdf
 
Last edited:
Amirk, I think what you really have is the packaged Development Kit, Idec MM-SMART-20, which includes the FC4A-D20RK1 PLC and a HG1X HMI, along with cables, software, and a manual. I think your HMI must be the HG1X-452, which has the 10 tactile number keys as you described. I have found a link to the HG1X User Manual. See page 10 of the attached link for instructions on how to set up a "Register Data Entry". You must define or program 2 of the 8 Function Keys with the built-in functions of "Accept Data Entry" and "Clear Data Entry" in order to enter a complete number for a counter or timer preset value in your PLC program.

http://www.galco.com/techdoc/idec/hg1x-452_opm.pdf
 
Last edited:
As with any key entry method, the problem is how to handle input errors and accidental key presses. You have to have some method to correct errors in entry, maybe as simple as allowing each entire number input to be reentered and corrected at any time.

very good point. i was just trying to show that you could do it with math.

EDIT; come to think of it, i kind of did that backwards. that way you are entering right to left instead of left to right lol
 
DW, Yes, I saw your point.

Apparently number entry for Amirk will be much simpler than he thought, if he has the Idec HG1X-452 HMI. That is the only Idec model that I could find that matched his description. When properly set up and programmed, this HMI allows entering ALL the digits of a PLC tag followed by the ENT key (as typical for most HMIs), not 1 digit per tag as Amirk first described.

I suppose it COULD be programmed to only allow one digit per tag, if a person enjoyed mind torture!
 
im not using HMI.
i was talking about a regular digit board like a telephones lets say.
simmilar to this:

Telephone_keys.jpg


i tought about connecting the "1" digit into I1, "2" digit into I2 and so on.. each one acts like a NO contact
than when i press 2 for example, i MOVE "2" into a data register and doing the math.


but its seems like a tought one to wirte, so i was thinking maybe there is a function that lets you "write" something and than execute.

sorry if i wasnt clear
Thanks!
 
I have never worked with Idec PLC, but I guess it have string functions in their instruction set. Read about 'String Concatenate' and 'String to Integer' functions in their help file, then

Say you connect

0 to I0
1 to I1
2 to I2
.
.
.
.
.
.
9 to I9
Enter key to I10

Say you assign your string input to an address St:1 [This may be different address in Idec PLC for string data type]. And you store your converted integer to N7:1

For each key press for I0 thru I9 you concatenate the respective string to St:1


I1
--||------------Concatenate
St:1
1
St:1

I2
--||------------Concatenate
St:1
2
St:1
.
.
.
I9
--||------------Concatenate
St:1
9
St:1

I10
--||------------String Convert
St:1
N7:1






Regards
 
Forgot to mention, after you convert, clear the contents of St:1
Add the following rung at the bottom


I10
--||-----------------Clear
St:1


 
Sorry, I thought that you had some type of HMI.

I don't think there are any string-handling functions on the Idec Micro PLCs. Your PLC model is very limited. It has very few 16-bit functions, and very few places to store a 16-bit data word. Your timer and counter preset values must be from decimal values 0 to 9999, so you must limit your number entry to 4 key presses plus "ENTER" to designate the end of the number.

Probably you are going to have to use Dan W's math method. You will probably have to set up D-memory locations to hold the numbers 0 to 9 (say M0090 = 0, up to M0099 = 9. You can move (MOV in the Idec WindLDR software) the numbers 0 to 9 into D-memory locations in a routine that runs 1 time at the beginning of your program). Then when a key is pressed, you multiply the corresponding D-memory location by the decimal place value, then add the result to a temporary storage location, say M0089. You need to enter your number from left to right, so that if you only need to enter say 2 digits to set a timer to 20 seconds, then you press "0", move M0090 to D-type unused timer location M0089, then press "2", multiply M0092 by 10, add the result to M0089. If there are two more digits, multiply by 100, then 1000, each time adding the result to M0089. Then when "ENTER" is pressed, do a MOV instruction from M0089 to Dxxxx where xxxx is the timer number that you are working on. Then immediately MOVE "0" to M0089 to get ready for the next change. Do not use memory locations M0089 to M0099 for anything else, because you need those memory word locations (or the equivalent in D-type memory) to hold your temporary data.

It is not going to be easy - a twisted and convoluted route in this PLC to enter data one press at a time. Is the programming work worth the price of the ($150 US) HG1X-452 HMI?
 
Last edited:

Similar Topics

please help me . I have to make this ladder diagram and I can’t figure it out :(
Replies
12
Views
217
Hello, I am trying to replicate a piece of logic on the PLC5 onto an SEL RTAC. I am using ladder on SEL and FBD. I am having issue on the ladder...
Replies
13
Views
190
Working on project will update after it is completed.
Replies
2
Views
356
Can someone help me piece this problem together. I have a lot of it down I think but cannot seem to get it right. Probably an easy one for most on...
Replies
1
Views
303
Hi everyone, I'm working on a project that involves using a Keyence LR-X100 sensor in Studio 5000 V35 ladder logic to determine the object's...
Replies
4
Views
677
Back
Top Bottom