Jump to content

Recommended Posts

Posted
Hmm...I just noticed that there doesn't seem to be a nice way to take an Integer Value in a WORD and convert that to a Binary Ouput or MASK move out. In other words, not a built in FUNCTION. Looks like I got take my %R value and move it into a %M which is byte aligned. Then it will directly drive some binary handshaking I need. Is this the best way to convert an %R to some outputs? Assume %R = 5 Next I need to Map over my %R word to a byte aligned %M like %M17 then %M17 turn on %Q1 directly. %M18 turn on %Q2 directly. %M19 turn on %Q3 directly. %M20 turn on %Q4 directly. Then make sure I don't use %M21 through %M32 when %M17 is binary 1 = %Q1 = output on when %M18 is binary 2 = %Q2 = output off when %M19 is binary 4 = %Q3 = output on when %M20 is binary 8 = %Q4 = output off Final Handshake in binary... Is that the best way in GE to do what I need?

Posted
That's how I would do it. I would use T's as they are intended for "Temporary" use but it doesn't really matter. If you are worried about using up values, reuse the bits as long as you're careful of the scan order: Move %r into %m's(or %t's) Link %m's into %q's Move New %r into same %m's link %m's to new %q's Etc. As long as the %r is reloaded into the %m's before each output this is no problem.
Posted
You could use the MOVE_BIT instruction. In your example, use a LEN of 4, put the %R address at the IN node and %Q001 at the Q node. The MOVE_BIT with a length parameter set at 4 will copy the first four bits from the %R register to the four consecutive %Qs starting at the address you specify.

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.   Restore formatting

  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.

×
×
  • Create New...