Sign in to follow this  
Followers 0
Guest anti-guest

word subtract

5 posts in this topic

I have a big problem!!!! I'm on probation and i need to conclued a exercise based on timers and counters. My problem is that i need to subtract three consecutive words with other three consecutive words, (s,s+1,s+2) - (s1,s1+1,s1+2) and the result should be placed in d,d+1,d+2. The plc that i'm using is Cj1h-h from Omron, and the software is the cx-programmer 3.0, can anyone helpme???

Share this post


Link to post
Share on other sites
I tried a few values and they seemed to work. Try this out:

Share this post


Link to post
Share on other sites
Sorry but I have to add something. You have to start with CLC before the first subtract. If you don't then if the CARRY was ON before this calculation, the answer will be smaller by "1" then the correct answer. CLC-carry reset -BCDL(417) - subtract the lower portion and if needed set carry to 1 (borrow) -BCD (416) - subtract the higher portion with the present carry position - if answer is negative carry is set. maybe you want to use in here Gili

Share this post


Link to post
Share on other sites
If you give students the whole answer, what do they learn?

Share this post


Link to post
Share on other sites
Thanks, now i understand the bcd instruction.

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