Sign in to follow this  
Followers 0
poovs

ZCP and Arithmetic Flags

3 posts in this topic

So, I have an application where I need to do some data evaluation in a similar fashion numerous times... Basically I want to check if any words within a range of data have become non-zero between each cycle, and if so set a bit (used to push items onto a stack). In the past I've manually done this by XFER'ing the source data range [D100-D199] to another evaluation data range [D200-D299]. Then I would compare, each word [= D100 D200], [= D101 D201],... and have the output be my 'data has changed' bit. This is fine for small ranges (10 words at most)... What if I need to evaluate 100 words? I certainly don't want to have to program multiple lines of ladder just for evaluation... (as well as "waste" evaluation data ranges) It seems that the ZCP instruction will do what I need by providing [ZCP #0 D100 D199]. If any of the source data range is non-zero, it should set the Arithmetic Flag NE (not equal) // or inversely the EQ (equal flag) should be OFF. My problem is that when I have subsequent evaluations in rungs below using the ZCP instruction, the Arithmetic Flags seem 'delayed'? I have even tried inserting a [ZCP #0 #0 #0] before my next evaluation to "reset" the Arithmetic Flag to EQ, but... again it seems like the Arithmetic Flags remain set ( perhaps for an entire cycle?) Can anyone shed some light on this for me? Or suggest an alternative method...

Share this post


Link to post
Share on other sites
Nice, makes perfect sense... just didn't occur to me to use an IR & loop. thanks for the elegant solution...

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