Are you looking for a way to clear a string tag in RSLogix5000? I attempted using COP with a zero value as the source and the string tag as the destination, but encountered an error message stating "COP, Operand 0: Invalid kind of operand." I also tried MOV with a zero value as the source, but received an error stating "MOV, Operand 1: Invalid type." Unfortunately, using DEL is not feasible as the exact length of the string is unknown. Do you have any suggestions or guidance on how to clear a string tag effectively in RSLogix5000?
Experiment with CLR (clear command) by using the syntax CLR my_string.DATA[0]. This command provides clear instructions for resetting specific data elements within a string.
Yes, I was able to solve the issue. It turns out that adding a zero to the .DATA[0] element of the string tag is necessary. The correct syntax is: MOV Source: 0 Dest: MyString[1].DATA[0]. Alternatively, using CLR would also be effective in this case. Thank you for your assistance.
One user, recondaddy, encountered an error message when attempting to use MOV with a numeric value as the source and a string tag as the destination. The error message stated "MOV, Operand 1: Invalid type," indicating the issue of trying to move a numeric value into a string. To resolve this issue, it is suggested to use a null string (string = "") as operand 1 instead. This adjustment is likely to work correctly in this scenario.
If you want to erase all characters from a string, use the FLL function instead of CLR or MOV. FLL effectively clears the entire string by setting its length to 0. Just pass in the appropriate parameters: FLL, 0, string_tag.data[0], x, where "x" represents the length of the string. This method ensures a complete deletion of all characters within the string.
Doug-P pointed out the error message "MOV, Operand 1: Invalid type," indicating that a numeric value should not be moved into a string. To resolve this issue, consider using a null string (string = ""). But how can one obtain a null string if there are no String Literals? Just a string that has not been assigned any value. On a side note, IEC61113-3 is preferred over AB, despite having to use ABI. The hatred for ABI dates back to high school when this thread was initiated.
You might want to try using the AFI instruction. This instruction will create a fault so you should handle it with a JSR to a separate rutine. This route is typically used when you have no other choice and need to reset a string. Do it by calling a routine using JSR and in that subroutine, place the AFI, then the string you want to reset. It is essential to follow the AFI with an OTL for the fault bit to prevent the PLC from going into fault mode. Be careful using this approach, though, as it essentially tricks the PLC into clearing the string. Always consider safety measures in your PLC programming.
✅ Work Order Management
✅ Asset Tracking
✅ Preventive Maintenance
✅ Inspection Report
We have received your information. We will share Schedule Demo details on your Mail Id.
Answer: 1. How can I clear a string tag effectively in RSLogix5000? - One way to clear a string tag in RSLogix5000 is to use the FLL instruction. By setting the length of the string to zero, you can effectively clear the contents of the string tag.
Answer: - The errors you are encountering with the COP and MOV instructions may be due to incorrect operand types or kinds. Make sure you are using the correct data types and operand configurations to clear a string tag successfully.
Answer: - If the exact length of the string tag is unknown, using the FLL instruction with a length of zero can still effectively clear the string contents without needing to know the exact length in advance.
Join hundreds of satisfied customers who have transformed their maintenance processes.
Sign up today and start optimizing your workflow.