Redlion Crimson 3 page change

EES-Harvey

Member
Join Date
Mar 2017
Location
Hull
Posts
8
Hi everyone,

I am hoping to be able to program the Redlion Productivity Station to change the pages with some conditions.

I hope to be able to get the pages to scroll through every 20secs or so providing a tag on that page has been enabled.

Tag1 >1 then Page1 would be enabled
Tag2 >1 then Page2 would be enabled
Tag3 >1 then Page3 would be enabled

If the tag is not greater than 1 I do not want the page to be displayed

I.e if Tag1 > 1, Tag2 < 1 and Tag3 > 1 it would change between Page1 and Page3 every twenty seconds however as Tag2 is not greater than 1 it would not show Page2

If Tag1 > 1, Tag2 > 1 and Tag3 >1 I would want all three pages to change again displaying a page for 20 secs or so.

Has anyone done anything similar?

Could anyone point me in the right direction please?
 
In Crimson you can create a Data Tag where the Data Source is a Tag in your PLC. You can then program a "Trigger" of that Data Tag whose "Action" is to "GoToPag(XXX)".

If you create three (3) Data Tags, one for each of your PLC Tags, you can then do all the logic you describe in the PLC.

Hope this helps.
 
On this application I don’t have a plc and it’s connected via a red lion E3 I/O so all my programming needs to be in the PTV program. If I had a plc connected I’m fairly confident that I could make it function but unfortunately I have a small amount of red lion coding knowledge.
 
Here's one way it could be done. If you have three tags to monitor and three corresponding pages, make a program with this code:

Code:
switch (currentPage){
case 1:
   if (Tag2>1) currentPage := 2;
   else if (Tag3>1) currentPage := 3;
   break;
case 2:
   if (Tag3>1) currentPage := 3;
   else if (Tag1>1) currentPage := 1;
   break;
case 3:
   if (Tag1>1) currentPage := 1;
   else if (Tag2>1) currentPage := 2;
   break;
}

switch(currentPage){
   case 1: GotoPage(Page1); break;
   case 2: GotoPage(Page2); break;
   case 3: GotoPage(Page3); break;
}
You need a numerical tag to keep track of what page you're on. Unfortunately Crimson does not allow you to address pages numerically, so the second switch statement associates page names with numbers.

You want to execute this program every 20 seconds or so. Create a integer tag called "ScreenChangeTrigger" or something like that. Change the Source to General and set it to "GetSec(GetNow()) % 20". The GetSec(GetNow()) command returns a value that increments once every second. Adding the "% 20" does the modulo operation to this value--the result will be zero whenever the time value is divisible by 20. Now, in the Triggers tab for this tag, change the Mode to Data Match and put 0 for the Value. Put the name of your program in the Action field. This should execute your program every 20 seconds to change screens.

EDIT: currentPage will be zero when the system starts so it might be better to make your code zero-based instead of one-based, i.e. Tag0 Tag1 Tag2.
 
Last edited:
Thanks John,

That surprisingly seems quite straight forward. I am back at the computer on Monday so i’ll look forward to giving this a go later on.

Thank you for taking the time to respond and for also writing a good explanation! It sure does help when given a bit more background information rather than just the code for attempting projects in the future.
 
Alas I spoke to soon :(

I've tried that segment from kolyur/John but unfortunately had no success

I put the ScreenChangeTrigger tag on a page so I can see it is counting to 20 and then resetting but I cannot get it to change pages. It is like the program isn't executing.

I discovered that after writing the program I have to press ctrl+t to translate the program but it still doesn't seem to do anything.

Would anyone have any further ideas please?
 
I would suggest putting a data display box on your screen with the currentPage tag, so you can see what it's doing. Remember, all variables are initialized to zero when the system starts. So in this case, unless you forced it to be in the range 1-3, the program will not do anything since that's all the switch statements are programmed to handle. You could add an additional case statement to the first switch like this:
Code:
case 0: currentPage:=1; break;
which should force it to the first screen at startup.
 
Thanks for the help,

I've found my error. Foolishly whilst putting the code in regarding the tags I didn't notice that I had saved them into sub folders and therefore needed to put the folder.tag1 name.
 
Thanks for the help,

I've found my error. Foolishly whilst putting the code in regarding the tags I didn't notice that I had saved them into sub folders and therefore needed to put the folder.tag1 name.

One way to reduce that sort of human error is to drag them from the resource pane on the right into the code window.
 

Similar Topics

Hi, I have a complex database in Crimson 3.0 and in one of the display pages I am trying to get a tag to show the sum of several other tags. The...
Replies
3
Views
134
It states WinPcap must be installed for the Emulator to function. WinPcap.org states that the technology is mature with no updates planned. Am I...
Replies
3
Views
822
Following on from another thread, I just downloaded Crimson 3.2 and it now supports CR and Graphite HMIs. Time for a 'play' :-) It seems to have...
Replies
14
Views
1,962
Action On Release command Set(ConveyorPopup,ConveyorPop_1) rejected w/ string tags. SetStringTag(index, data) wants an index. How does one pass...
Replies
8
Views
907
Looking for the object that will provide entry of an integer value for commanding a setpoint in the DA70A ladder logic. Any ideas?
Replies
2
Views
543
Back
Top Bottom