Industry Automation and Control Forum
This forum is addressing industrial automation design & engineering, operations, asset performance, cyber security and digital transformation for Plants & Machines.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-01-22 01:08 PM
I am using READ_VAR to read data from a slave device. It returns data as an Array of INTs. Using Function Block or Structured Text is there a way to copy this data to a DDT so that I don't have to extract the data register by register. I am currently assigning the Array and the DDT to the same address, but I have to turn off the Overlapping Address warnings. Wondering if there is a programmatic method?
Thanks
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-01-29 05:29 AM
Hi,
Use the extract function to copy memory zones.
EXTRACT (SRC := (*ANY*),
SRC_NELEM := (*UDINT*),
SRC_POS := (*UDINT*),
DST_POS := (*UDINT*),
CPY_NELEM := (*UDINT*),
DST => (*ANY*),
ERR => (*INT*));
Regards,
Juan
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-01-24 11:35 PM
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-01-24 11:35 PM
Dear colleagues, I'm also interested in this topic, are there SMART solution for that?
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-01-28 11:59 AM
There really isn't a "smart" way to do this. I would suggest using a DFB with structured text or FBD using moves to take the data from the INT array and move into the appropriate elements of the DDT you create. This would eliminate the issues you have with memory word alignment on REALs and DINTs.
Even if you were using a Modbus TCP DTM on a NOC module, it is not always possible to create a DDT items within the DTM instance because of this alignment constraint. In that case, a DFB to do the moves is still the best answer.
Of course, you could do those moves in a section of logic, but even for a one-off usage, creating a DFB encapsulates the code and simplifies your base logic.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-01-29 05:29 AM
Hi,
Use the extract function to copy memory zones.
EXTRACT (SRC := (*ANY*),
SRC_NELEM := (*UDINT*),
SRC_POS := (*UDINT*),
DST_POS := (*UDINT*),
CPY_NELEM := (*UDINT*),
DST => (*ANY*),
ERR => (*INT*));
Regards,
Juan
Link copied. Please paste this link to share this article on your social media post.
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.