Automate Memory Type and Offset Extraction in PLC Programs for VAR1 at %R101

Question:

Hello everyone, Is it feasible within a PLC program to extract the memory type and offset from a variable like VAR1, which is located at the address %R101? I'm looking for a way to automate this process because my project involves numerous Comm_Req blocks. Each of these blocks necessitates explicit identification of the memory type and the variable's offset, which leads to a significant amount of manual configuration. It would be fantastic if I could just present the variable to the code and let it automatically determine the memory type and offset for me. Your insights on this would be greatly appreciated!

Top Replies

The GFK-2224 manual provides comprehensive information regarding the ComReq command block values in section 9.2.2. Each address type is assigned a specific value: for instance, %R corresponds to a decimal value of 8, while %AI represents a decimal value of 10, among others. Additionally, section 9.2.2 indicates that the CRS word address offset is set to zero. Therefore, if you are looking for %R101, the fourth word in the ComReq command block should be a decimal value of 100. For a complete understanding, you can download the GFK-2224 user manual here: https://digitalsupport.ge.com/en_US...munications-User-Manual-GFK-2224D-DO2008-enUS.

Sapper307 highlighted that the GFK-2224 manual outlines command block values in Section 9.2.2. Each type of address is represented by a specific value— for instance, %R corresponds to a decimal 8 and %AI to a decimal 10, among others. Importantly, Section 9.2.2 also states that the CRS word address offset is set to zero. Therefore, if you need to reference %R101, the fourth word of the command block should be represented as decimal 100. For those looking to download the GFK-2224 manual, you can find it here: [GFK-2224 Communications User Manual](https://digitalsupport.ge.com/en_US...munications-User-Manual-GFK-2224D-DO2008-enUS). While I'm familiar with this structure, it necessitates manual adjustments in multiple instances to effect a simple program change. For example, if my status register is at %R101 and I aim to change it to %R201, I must first ascertain if it is utilized in a communication request block. If so, I need to manually set the constants as necessary, keeping in mind that the offset operates on a base 0 system. This dependency on manual adjustments for ensuring program accuracy would be considered unacceptable in any other programming realm and would typically be regarded as a significant flaw in coding practices. What I'm aiming for is a solution where I can input a reference like %R101 and automatically retrieve the values 8 and 100. This would help eliminate one of the most problematic aspects of PLC programming— the human element involved in coding.

Let’s consider a hypothetical scenario: can you achieve your objectives if you utilize default variable names? When you define a new variable assigned to %R101, it automatically receives the default identifier R00101. Furthermore, COMMREQ instructions facilitate indirect addressing; however, it's important to note that this won't assist you with discrete memory types.

Steve Bailey mentioned: Just a thought, but could you achieve your goals by utilizing default variable names? When you create a new variable assigned to %R101, it will automatically take on the default designation of R00101. Additionally, COMMREQ instructions allow for indirect addressing, although this won't assist you with discrete memory types. Furthermore, if you're referring to the concept of aliased variables, it’s worth noting that default names can be quite troublesome. Would you like to explore this further?

As I am not entirely clear on your specific goals, I'm sharing some suggestions that you may have already explored. While I haven't personally created a function block using the Rx3i, I've learned that it allows for user-defined function blocks programmed in C. You can break down the default variable name, using the first character to assign an integer that indicates the memory type, while the subsequent characters can be converted into an integer that represents the memory offset. Is the memory location you're trying to access being specified by a Human-Machine Interface (HMI)? If that's the case, you could easily prompt the operator to input a string like "R101," then write a script to parse that input into the corresponding memory type and offset effectively.

More Replies →

Streamline Your Asset Management
See How Oxmaint Works!!

âś…   Work Order Management

âś…   Asset Tracking

âś…   Preventive Maintenance

âś…   Inspection Report

We have received your information. We will share Schedule Demo details on your Mail Id.

To add a comment, please sign in or register if you haven't already..   

Frequently Asked Questions (FAQ)

Ready to Simplify Maintenance?

Join hundreds of satisfied customers who have transformed their maintenance processes.
Sign up today and start optimizing your workflow.

Request Demo  â†’