Sign in to follow this  
Followers 0
mos89

Multiply And Divide Cj1

4 posts in this topic

Hi all I have a question : i try to make some computation : LD 0.00 *UL(423) N1 N2 R2 *UL(423) R1 N3 R2 /UL (433) R2 N4 R3 my symbole declaration : N1 UDINT D200 0 N2 UDINT D202 0 N3 UDINT D204 0 N4 UDINT D206 0 N5 UDINT D208 0 R1 ULINT D300 0 R2 ULINT D304 0 R3 ULINT D308 0 R4 ULINT D312 0 R5 ULINT D316 0 my preset values N1=&635 N2=&635 N3=&314 N4=&4000000 R1=&403225 R2=&126612650 R3=&216068727985 R3 should be 31 or 32 what is wrong with my code ?

Share this post


Link to post
Share on other sites
Why is R2 used for results twice? Try changing the first line to read *UL(423) N1 N2 R1 then the answer is 31.6531625 or &31 in D308 Edited by benbrad

Share this post


Link to post
Share on other sites
... Also be careful with long divide or multiply instructions, the results 'spill over' into 4 words. You will need to allocate your results words no less than 4 words apart. See Table: (also see CS/CJ instructions reference guide for further information) Nibroc

Share this post


Link to post
Share on other sites
I could get the result as 324EB324B1. So R3 is 32 in D308 If change R3 ULINT D308 to Hexa, one can able to see 32. Edited by lchamarthi

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