ElectronGuru

STRING data type

3 posts in this topic

I'm working with Studio5000 and read the following in the compare instruction help section:

"Tip: Immediate string literals are only applicable to the CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers."

What the heck is a "Literal string"? I understand that STRING data type is numbers and letters, but I don't know what a literal string is.

Share this post


Link to post
Share on other sites

variables and constants are memory locations accessible by name. literal type is neither. it is a hardcoded value of whatever type

if today=="Friday" then
    MsgBox("almost there...")
endif

unlike today, "Friday" is a literal... it is a hardcoded value that is not accessible by name.

 

same goes for any other data type (INT, REAL, BOOL...)

if error=TRUE then 

TRUE is a literal, error is either a variable or constant

 

A= B + 7

A is a variable (this is an assignment and if it was a constant, this line would cause a fault), B could be either a constant or variable, 7 is a literal

1 person likes this

Share this post


Link to post
Share on other sites

So when the help section says string literals only apply to the L8 controllers, I'm assuming they mean you can't use a string literal in L7 and below controllers. Would a date in STRING format (such as "10JAN2021") be considered an example of a string literal?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now