Sign in to follow this  
Followers 0
ABlearner

How to use exponential in gx works 2

3 posts in this topic

Hello,

I have to make a ladder diagram in GX works 2. I have to use a logic which is calculate the the power of a number.

Example: 2^0 = 1; 2^4 = 16............. and so on.

Which insutruction can I use ? and how ?

Can someone give me an example ?

I have found EXP and POW instruction, but they are not really works for me. Its important the base can be always 2 I would like to change only the numbers.

Thanks ahead.

Share this post


Link to post
Share on other sites

Both POW and EXP can work for that, and also the simple bit logic always works.

If base is  2, exponent is always number with only one bit High.

2^0 = DEC 1 = BIN 0001

2^1 = DEC 2 = BIN 0010

2^2 = DEC  4= BIN 0100

2^3 = DEC 8 = BIN 1000

 

And so on...

Share this post


Link to post
Share on other sites

The POW instruction is used for calculating S1^S2 and storing the result in D.  If your PLC supports this instruction, it will work.  (see image)

The EXP instruction has a fixed base and is used for calculating e^S and storing the result in D.  This instruction will not help you here. (see image)

 

10-30-24 temp2.PNG

10-30-24 temp1.PNG

Edited by Integrator_99
Duplicate image

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