Sign in to follow this  
Followers 0
lchamarthi

Correct Instruction-Reg

6 posts in this topic

Hi Everybody! I would like to welcome suggestion in achieving the following task..... I have 4 inputs and 4 outputs named as X1, X2,X3 & X4 and outputs as Y1, Y2, Y3 & Y4. Here there is no output fixed to perticular input.Explaing in a better way i want to give choice to operator to enable which outputs enable for which inputs. Operator enters the data in the following way. X1 ---- 0001 means Y1 only enabled ---- 0010 means Y2 only enabled ---- 0100 means Y3 only enabled ---- 1000 means Y4 only enabled ---- 1001 means Y4 & Y1 enabled ---- 0011 means Y2 & Y1 enabled -- -- -- -- Like wise for 4 position binary 15 combination comes. The same thing will be done/configured for X2, X3 and X4 too. Now to achieve this, I thought of In the Operator Entry, if 1Digit = 1, Give Y1 2Digit = 1 Give Y2 3Digit = 1 Give Y3 4Digit = 1 Give Y4 keeping as a function block which same can used for the X2,X3 and X4. Hope you understood the above. Which instruction supposrts to achieve the above logic? Otherwise any best/simple way of doing as i feel i am making it complicated? Thanks in advance guys Have a nice time Lchamarthi

Share this post


Link to post
Share on other sites
Use compare (CMP) or if a CS or CJ use =. When equals turn on a bit.

Share this post


Link to post
Share on other sites
Hi BobB, I can use Compare for the whole data register. But if i want compare whether 1st digit in a word is 0 or 1 which i can use? like wise 2nd digit in a same word....... Suppose D10 has the Data= 1010 ( Operator entered data stored in D10) here 1st digit is 0 here 2nd digit is 1 here 3rd digit is 0 here 4th digit is 1 Thanks Lakshmi

Share this post


Link to post
Share on other sites
Use ANDW D0010 #FFF0 D0020 etc. Try it in the simulator - it does work. It is can be used as a mask to mask out what you do not want to compare. I use ANDW all the time for masking out what I do not want to compare for the time clock. ANDW whatever then CMP (or = in CJ/CS). Edited by BobB

Share this post


Link to post
Share on other sites
I am sure "move digit" instruction can help for both editing d10's digits and comparing only digits for readability in the future.

Share this post


Link to post
Share on other sites
Been there as well many times. Quite frankly, find ANDW easier than constructing MOVD, making a mistake and having to re-do MOVD.

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