Understanding the significance of the K value in a compare block in GX Works 2

Question:

Hello, I am currently in the process of transferring a program from a Mitsubishi FXCPU to an Omron CP2E. I am manually transferring the code, but I am unsure about the significance of the K value in the compare block. Can anyone please help me understand its use? Below is the compare instruction I have written for reference: [CMP K10 D245 M7]. This program was originally created using GX Works 2. Thank you for your assistance. - John

Top Replies

The "K" in the old GXDeveloper format of GXDeveloper serves as a constant indicator. In most other IDEs, K10 simply represents the value 10. When it comes to timers in Mitsubishi, the use of K may vary depending on the timer setting - 10 could mean either 100ms (for timers with a 10ms timebase) or 100ms for standard timers. GXworks 2 offers two modes, with the assumption that the ladder-compatible mode (Old GXDeveloper) in the Structured project FDB/LAD does not utilize the K suffix. It is likely that only timers T0 to T199 with a timebase of 100ms are utilized, where K10 indicates 1 second. An interesting point to note is that the old CMP instruction's "M7" serves as a pointer to M7, M8, or M9 bits - M7 being greater than 10, M8 equal to, and M9 less than. When using the AND=, AND<, or AND> function, only one bit is required as these are in-line functions. Therefore, it is important to determine whether =, >, or < is used for your logic by checking which of the 3 bits are in play in your case.

Hi John, in a Mitsubishi PLC, the prefix 'K' refers to a constant value which, in your case, is 10. The CMP function is a compare function. Your statement [CMP K10 D245 M7] is basically comparing the constant value 10 with the contents of the data register at D245, then outputting the result to M7. When rewriting this for your Omron CP2E you'll have to use the equivalent instruction for comparison, as the syntax may not be identical. Be sure to check the Omron instruction manual for the correct syntax and equivalent operations.

Hi John! The K value in your compare instruction represents a constant used for comparison in the controller logic. In your example, the instruction `[CMP K10 D245 M7]` is checking if the value in Data Register D245 equals 10. If it does, the condition will trigger the output to M7. It's important because it allows you to make decisions based on specific thresholds or conditions without needing additional variables. Just make sure you double-check the equivalent data types and structures in the Omron environment, since the syntax and handling might differ a bit from the Mitsubishi system. Good luck with your transfer!

Hi John! The K value in your compare instruction signifies a constant value used in the comparison. In your example, CMP K10 D245 M7 means you’re comparing the value in data register D245 with the constant value of 10. If D245 equals 10, the result will set M7 to true (or high). This helps in conditionally executing parts of your program based on that comparison. If you're transferring to the Omron CP2E, just ensure to adjust for any differences in how constants are handled in the new programming environment. Good luck with the transfer!

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)

FAQ: 1. What is the significance of the K value in a compare block in GX Works 2?

Answer: - The K value in a compare block represents a constant value that is being compared with the data in the specified memory area. It is used to set the comparison criteria for the instruction.

FAQ: 2. How does the K value impact the comparison process in GX Works 2?

Answer: - In a compare block like [CMP K10 D245 M7], the K value of 10 would be compared with the data stored in memory address D245. The comparison result would determine the flow of the program based on the comparison outcome.

FAQ: 3. What is the role of the compare block when transferring programs between different PLCs like Mitsubishi and Omron?

Answer: - The compare block helps ensure that the logic and functionality of the program are accurately transferred between different PLC platforms by making sure that the values being compared remain consistent regardless of the underlying hardware.

FAQ: 4. Can you provide an example of how the K value is utilized in a compare instruction within GX Works 2?

Answer: - Sure, in a compare instruction like [CMP K10 D245 M7], the value 10 (K10) is being compared with the data stored in memory address D245. Depending on the result of the comparison, the program will proceed accordingly.

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  β†’