Sign in to follow this  
Followers 0
Theo V

FX1N Count up and down

3 posts in this topic

Hi all, Im looking for a function to add and substract in a simple ladder program in a FX1N PLC. I use GX-Works2 V1.98c. The idea is to write a program to control the speed of a dustcollector fan in 3 steps low-mid-high speed. The more machines are switched on the higher the fan speed of the dustcollector must be and reverse. If one machine is started the fan must start too at low speed. If a second machine starts I like to add up a counter that increases a D word. If machines are stopped I like to count down and the result of the D Word must set the speed of the dustcollector by using a compare command. I tried a function [DMOVP K3X3 D3] and at the same time [DINCP D3] but that results not in adding 1 per machine (machines are conected to inputs X3-X4-X5. I like to use a PLS to the inputs to add up and PLF to substract the number of machines. I hope this explaination is clear enough for you all to make a suggestion which function is best to add and substract in the above situation. Kind regards, Theo V.

Share this post


Link to post
Share on other sites
Why K3X3? The K3 part tells it 3 digits, which is 12 bytes. What I would do is MOV K1X3 to a register, like D0. That would be 4 bits, don't use the 4th. Then use the SUM command to count the number of bits on in the word.

Share this post


Link to post
Share on other sites
Thank you Crossbow for the explaination, The K3X3 came from an example from my trainingbook but I could not see it trough how this would work. I assumed that the K3X3 was reading the status of the 3 input positions starting from input X3. So I assumed that if X3 and X5 where high, the reading is 2 but it wasn't. After testing at the workbench I know this was not what I was looking for and made a simple workaround with a rising edgde of the inputs X3-X4-X5 and INC D100 and falling edge to DEC D100 and compare the result in D100 with a constant value K1/K2/K3. After a comparisment [D110 = K1] etc. I made the outputs Y0-Y1-Y2 switching on/off. It worked but I'm not satisfied yet. I will try your suggestion and see what happens and see if this is easier to use and at least learn from it. Thank again. Best regards, Theo V.

Share this post


Link to post
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
Sign in to follow this  
Followers 0