Total beginner, Crimson 3.0 Questions

cgibsong002

Member
Join Date
Jul 2015
Location
Houston
Posts
14
So I hope I've stumbled upon a good source of help. I read the FAQ's but didn't see anything pertaining to specifically what type of material is ok to post here so please let me know!

I'm an EE working for my first time in Red Lion Crimson 3.0. I'm unfortunately pretty much just teaching myself how this all works. I'm developing a touchscreen and for the most part it's all very simple, I have my assortment of indicators and switches with everything tagged. I have a few items that are a bit more involved though that I'm unsure how to go about.

I'd like a single indicator to turn green only when a collection of conditions are met. I have three inputs, when all three are on, I'd like the indicator to turn on. I'm assuming this is done on the Indicator>Control>Status>Complex window (rather than using simple Tag), but I don't know how to write the code or what it's looking for. The help manual doesn't seem to say much for what type of coding it's looking for.

Could anyone provide any help here?

Thank you! Looking forward to learning.
 
The simplest way to do this (and what I do) is to use a simple rectangle or circle. I find the built in indicators to look too busy. Most of this method will work regardless.

1. Add a rectangle to your screen by dragging it from the basic primitives window.
2. Right click on the rectangle on the display and press the properties button.
3. Go to the "Figure" tab.
4. Under "Fill format", open up the drop-down menu for Color 1. (The default value is fixed).
5. Select the "2-state" option.
6. In the popup, select the colors you want.
7. In the "Control --> Value" option, press the "Edit..." button.
8. Drag or type your tags into the expression editor so you get something like this: "tag1 && tag2 && tag3".
9. Press a bunch of "OK" buttons and you're done.
 
The simplest way to do this (and what I do) is to use a simple rectangle or circle. I find the built in indicators to look too busy. Most of this method will work regardless.

1. Add a rectangle to your screen by dragging it from the basic primitives window.
2. Right click on the rectangle on the display and press the properties button.
3. Go to the "Figure" tab.
4. Under "Fill format", open up the drop-down menu for Color 1. (The default value is fixed).
5. Select the "2-state" option.
6. In the popup, select the colors you want.
7. In the "Control --> Value" option, press the "Edit..." button.
8. Drag or type your tags into the expression editor so you get something like this: "tag1 && tag2 && tag3".
9. Press a bunch of "OK" buttons and you're done.

Very cool. I already have a number of rectangular indicators being used so I needed to continue with one of those. Which appears to work just the same from what I can tell. I actually was doing what you said just as I read your reply. I found the actual user manual on their site, I didn't realize I had been using the reference manual which I guess is less in depth. So I saw how it explained using the &&'s for multiple conditions, but I still wasn't sure whether to do tag1=1 && tag2=1, etc. But it's just as simple as listing the tags huh? Cool.


edit: What if I want one of the conditions to be that a particular DI must be off? Luckily all 3 inputs I'm using for conditions we have wired to positive indication for both on and off states, but say, for example, I just had a DI for a particular device being on, and I need tag1=off && tag2 && tag3. I know that's not correct but how would I do that? I can't seem to find that in the manual.
 
Last edited:
To specify an inverted (NOT) condition, precede the tagname with an exclamation point.

For example:
!tag1 && tag2

will evaluate true only if tag1 is OFF and tag2 is ON.
 
A few more tips:

|| denotes an OR combination just as && denotes AND.
"tag1 && tag2" is the same as "tag1==true && tag2==true"
"tag1 || !tag2" is the same as "tag1==1 || tag2==0"

(The double equal sign used to be required for comparison statements--in Crimson 3 I think you can just use a single.)
 
(The double equal sign used to be required for comparison statements--in Crimson 3 I think you can just use a single.)

I would check this before I used a single equal sign. I have a vague recollection of getting myself in trouble a few years ago with this (structured text uses single equal signs for equality checks and ":=" for the assignment operator). I think that you can inadvertently assign values to each other instead of comparing them to each other.
 
Come to think of it, I believe the change they made is that you can use = instead of := for variable assignment. The equal-to comparison operator is still ==.
 
Come to think of it, I believe the change they made is that you can use = instead of := for variable assignment. The equal-to comparison operator is still ==.

Agreed.

I made some weird things happen once by using "=" as a compare operator and had some trouble figuring out that I was causing assignments to occur. Now, I make the habit of always using ":=" for assignments. I always use the equal sign along with another character and put spaces before and after so that it is easier not to screw up and easier to find it when I do.
 
Maybe I'm making a stupid oversight here. I wanted to do a similar thing for a control as well. I have a 2 position switch that I want to control 3 separate outputs. There's a bit more logic involved but the basics is on one screen I have all three controls separate, and on the main screen I have a single switch to control all 3 at once.

I thought it would be as simple as using the above logic. Control>General> Tag1 && Tag2 && Tag3. I assumed that would write all 3 to the on position when engaged, and off when disengaged. But it's saying "This expression must be writable".

I don't see anything in the writing actions, or expressions, part of the user manual. So, is it possible to have a switch control multiple tags?
 
Maybe I'm making a stupid oversight here. I wanted to do a similar thing for a control as well. I have a 2 position switch that I want to control 3 separate outputs. There's a bit more logic involved but the basics is on one screen I have all three controls separate, and on the main screen I have a single switch to control all 3 at once.

I thought it would be as simple as using the above logic. Control>General> Tag1 && Tag2 && Tag3. I assumed that would write all 3 to the on position when engaged, and off when disengaged. But it's saying "This expression must be writable".

I don't see anything in the writing actions, or expressions, part of the user manual. So, is it possible to have a switch control multiple tags?

It depends where your Tag 1, 2 and 3 inputs are coming from. If they are read-only tags by default of being input values then you will not be able to write a value to them.

You haven't actually said what equipment your using but I assume you are using something like a CSDIO module or the graphite equivalent. The input flags for these are not writeable.

The switch can control multiple tags, but you would need to define new tags in order to write a value to them.
 
I thought it would be as simple as using the above logic. Control>General> Tag1 && Tag2 && Tag3. I assumed that would write all 3 to the on position when engaged, and off when disengaged. But it's saying "This expression must be writable".
The statement "Tag1 && Tag2 && Tag3" is an expression that returns true or false based on the states of the three tags. It doesn't write values to anything. From your explanation it sounds like you want to write on/true to the three tags. In that case, you'd need to use an action such as "Tag1:=true, Tag2:=true, Tag3:=true". Crimson will let you put multiple actions in a single field, separated by commas.
 
The statement "Tag1 && Tag2 && Tag3" is an expression that returns true or false based on the states of the three tags. It doesn't write values to anything. From your explanation it sounds like you want to write on/true to the three tags. In that case, you'd need to use an action such as "Tag1:=true, Tag2:=true, Tag3:=true". Crimson will let you put multiple actions in a single field, separated by commas.

I don't think that's the issue. If Crimson is returning the command saying the tag isn't writeable, the code he has is correctly formatted as it is trying to write, but the tag he is trying to write to is read-only.
 
The statement "Tag1 && Tag2 && Tag3" is an expression that returns true or false based on the states of the three tags. It doesn't write values to anything. From your explanation it sounds like you want to write on/true to the three tags. In that case, you'd need to use an action such as "Tag1:=true, Tag2:=true, Tag3:=true". Crimson will let you put multiple actions in a single field, separated by commas.

That could be it. I was under the impression my expression would return true/false if used as a status, and write to all three if it was a control. I was thinking that didn't make sense though but couldn't find anything else. Is the ':=' statement standard PLC logic, because it doesn't appear to be listed as an operator in the User manual I pulled off the website?

Anyway, I'll give this a try. How exactly does it work? Does it force all 3 to true regardless of state when switched on? And the opposite when switched off, if I'm using a latching switch?

I don't think that's the issue. If Crimson is returning the command saying the tag isn't writeable, the code he has is correctly formatted as it is trying to write, but the tag he is trying to write to is read-only.

See that's what confused me a bit too, but the tags I was using were all read/write tags. I had no problems using each three on the individual switches.


Also sorry for not clarifying earlier but I'm talking with an Omron CJ2W system, I wasn't sure if that made a difference here. Most of my stuff is very straight forward so I was able to figure it out on my own but I don't have any knowledge of these multi-state/controls I'm trying to do. Appreciate all the help.


edit: I tried the above suggestion and I get the prompt "This expression has side effects"
 
Last edited:
Can you post your CD3 file? That would probably make it easier for us to help you. I'm not sure exactly what primitives you're trying to use.
 

Similar Topics

Hello With my background in programming and web development a friend came to me for help building a SCADA system, but I'm a newcomer to HMIs...
Replies
3
Views
1,511
Ok, I am trying to learn PLC programming and have a PLC already with a copy of WinGPC that I'm playing around with. I have read through material...
Replies
27
Views
5,545
I'm being tasked with supporting / upgrading these panels but no software, cable, documentation. I have an old laptop running XP and would like...
Replies
4
Views
1,996
Hi everyone, I'm trying to perform a serial download with a Total Control Quickpanel jr (QPK-2xxxx) using an old computer running QuickDesigner...
Replies
3
Views
1,681
Back
Top Bottom