Chris Elston Posted November 19, 2004 Report Posted November 19, 2004 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? Quote
DesertDog Posted November 19, 2004 Report Posted November 19, 2004 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. Quote
Steve Bailey Posted November 19, 2004 Report Posted November 19, 2004 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. Quote
Chris Elston Posted November 20, 2004 Author Report Posted November 20, 2004 Nice suggestion.... How come you always come up with the good ideas? I guess we can keep you around for awhile. BTY...I LOVE PROFIBUS...far easier than Device Net... Quote
Recommended Posts
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.