Paolo_911 Posted July 11, 2018 Report Posted July 11, 2018 In GXWorks2, using a Q03UDECPU, is it possible to move data with length specified in bytes (8bits) rather than words? I have data coming from a Datalogic scanner, which overwrites data rather than resets/clears it. This data length is specified in bytes, and so I am currently doing math (dividing by 2) to get the number of words to move. This is a problem because it obviously rounds and so sometimes I move an extra byte of data that affects my process. Example: / D3012 K2 D3013 (D3012 is 8bit/byte length) and D3013 is word length MOV D3013 D200 (I want to use D3012 here, but can't) If I can't use byte length, then maybe there is a way to check to see if D3012 is an odd number. If it is an odd number then I could clear out the last half (8 bits) of D200, after I move the data over?
kaare_t Posted July 12, 2018 Report Posted July 12, 2018 You can use "MOD" instruction to check if it's dividable by 2: MOD D3012 K2 -> NE 0 -> "FlagIndicatingOdd" If you receive the flag, it indicates that you have an odd number, and you can remove the 8 bits and possibly generate a number of words increased by one (compared to the division by 2 earlier).
Veganic Posted July 12, 2018 Report Posted July 12, 2018 Check for ODD or EVEN IF EVEN move upper 8 bits only IF ODD move all bits.
Veganic Posted July 12, 2018 Report Posted July 12, 2018 Edit is not working: I have left an deliberate mistake for you to find :)
Paolo_911 Posted July 12, 2018 Author Report Posted July 12, 2018 Thank you both! Thanks Veganic for the mystery haha. Would it be WAND HFF00 in the top rung and WAND HFFFF in the bottom?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now