
Dr. Glenn (Customer) asked a question.
I need to parse a double-word value (DoMore Dxxxx) to TWO successive V-memory locations
I need to find a way to "break" a double-word (Example: 123456789) into at the fifth digit: (12345) and place in in the first V-memory location, then put the rest (6789) into the next V-memory location. Why do you ask? I need to transmit a block of data to Dataworx, and it only accepts V-memory transfers. I'm using a DoMore.
Any hints or ideas welcome.
How about using MEMCOPY?
You can specify by bytes how many digits to use.
I have converted to HEX so you can see the actual bits have been split.
I hope this helps you out.
Regards,
Garry
https://accautomation.ca/series/brx-do-more-plc/
You want it split at decimal digits, not binary digits. Use modulo arithmetic in a MATH along with integer division.
V0 = D0 % 10000
V1 = D0 / 10000
so D0 123456789
V0 equal to 6789
V1 equal to 12345
Thank you, Franji1
I came up with that very solution two minutes prior to your thoughtful solution. Thank you!
I'm guessing that going from signed to unsigned may be the problem, maybe, I don't know what Dataworx is doing when it recombines the two words. But one might take a look at casting; help topic DMD0309
Or there might be bigendian smallendian problem
I did try casting but it didn't give me what I wanted. Converting from Signed to Unsigned proved problematic: the values changed. Thank you for answering!