Jump to content
Sign in to follow this  
Pawks666

Math exponentiation

Recommended Posts

Hello,

 

Is there an option to use exponentiation function in u90ladder?

I see that there is a function of square root, but no exponentiation.

 

Thank you,

 

Best regards,

 

Pawks

Share this post


Link to post
Share on other sites

Hi Pawks,

Jazz 2 (JZ20) does not support exponential function.

Jazz 2 have limited Long support and no float point support.

What kind of calculations do you need?

What is a formula?

What is an input and output numbers range?

You can look at Internet, how to realize approximate exponent calculation in integer numbers.

If you are in need of math functions, you can use Samba PLC, which have support of Exp function and Floating Point support.

BR

Share this post


Link to post
Share on other sites

Hi,

 

Thank you for answer.

 

I only needed 2^x, where x is an integer up to around 10 max, so the results are 2,4,8,....,1024.

 

If anyone else would like to know i used loop function.

every loop i multiply number by 2 and decrease x by 1 until x equals zero.

 

Not a big problem, i just thought that such function already existed.

 

Thanks again,

 

Regards,

Pawks
 

Share this post


Link to post
Share on other sites

Hello Pawks,

 

have you thought about using the shift register special function?  When shifting an MI to the right, you are multiplying the number by 2 each shift.  So for 2^5, you could use the shift register function and shift the bits by 5 to the right.  The only issue is when the number becomes very large - if you shift the bits in the MI too far, the bits at the end will drop resulting in an incorrect number.

 

Shift function:

 

SI 87 = number to be shifted

SI88 = number of bits to shift

Set SB 87 to shift to the left

Set SB 88 to shift to the right

 

Hope this helps.

Share this post


Link to post
Share on other sites

Hi,

 

well, i was thinking about that function, but something in my head said to me that it wouldn't work...i guess my head at that point was too tired to think properly... :D

Anyway, you're right, shift is exactly what i need, thank you... :)

Regards,

Pawks

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...