Jump to content

Recommended Posts

Posted

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?


Posted

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).

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
×
×
  • Create New...