Crimson 3 Programming

dlweber

Lifetime Supporting Member
Join Date
Oct 2014
Location
PA/OH
Posts
405
I am trying to program a G3 through Crimson 3

if (Part_1_Online)
GotoPage(MAIN_369);
else if (Part_2_Online)
GotoPage(MAIN_369CR);
else if (Part_3_Online)
GotoPage(MAIN_911);
else if (Part_4_Online)
GotoPage(MAIN_3610);
else if (Part_5_Online)
GotoPage(MAIN_909);
else
GotoPage(MAIN);

I have tried running this code as a program and complex neither seems to do anything. It translates and loads. I push the button that is supposed to run the code and I get nothing. I have tried a few attempts to restructure but have failed.

I imagine it is something simple I am over looking, any help would be appreciated. Thanks
 
Your Syntax looks correct. Are you sure that the tag is changing states? You may want to put a Data Box on the screen and see if the tag changes state.
 
Does the GotoPage function work if that's the only thing attached to your button code? Make sure you can get that working first.

Also, you may want to try your IF test by comparing the variable against a value:
IF ( Part_1_Online == 1 ) then ...

- disclaimer: I do not work with Crimson or G3
 
The tag is in the correct state it can be viewed from another page, that I checked before I got page locked (because of the non working code) I have the Gotopage (page)function used in other code around the project and it works just fine

It should work the same either way whether I put it equal or not, all of the examples I could find show the flag (bool) tags being set up the way I have it with out the "== #"
 
When I had it as a program I had the properties to run when called, the program attached to the button via General. I have also tried it as complex code attached the button

EDIT: "Read when Referenced"
 
Last edited:
I have tried adding the == 1 and various "{}" structures with no changes

I have the bits set so that the very first IF statement should be true, it should not even get to the ELSE statements. If the none of the variables were "1" it should go to page MAIN because it is an "if all else fails" ELSE statement. But nothing happens I just get page locked. I want to use that code on 7-8 pages (buttons) but it doesn't work on any of them.
 
I have tried adding the == 1 and various "{}" structures with no changes

I have the bits set so that the very first IF statement should be true, it should not even get to the ELSE statements. If the none of the variables were "1" it should go to page MAIN because it is an "if all else fails" ELSE statement. But nothing happens I just get page locked. I want to use that code on 7-8 pages (buttons) but it doesn't work on any of them.

Post your configuration and let us look at it.
 
This may seem silly but are you sure your program is being called properly? I have dealt with Crimson 2.0 and 3.0 and usually when I had a problem with a program it had to do with how it was called. I usually used a trigger to call the program. Admittedly I really only used the program part to send emails. I used the GotoPage off of push buttons and the like. Perhaps if you start with a GotoPage only, get that working first. Once you have that proved out add an IF statement after that? Then once that is working add the ELSEIF?
 
Well I found the issue. All of the tags in program are sourced to PLC tags. The PLC was not fully updated so the one tag did not have a valid source (even though the L5K file was loaded showing that the tag existed, it just did not exist in the PLC yet), so somehow that caused the G3 to completely ignore the code without throwing warnings or errors
 
Well I found the issue. All of the tags in program are sourced to PLC tags. The PLC was not fully updated so the one tag did not have a valid source (even though the L5K file was loaded showing that the tag existed, it just did not exist in the PLC yet), so somehow that caused the G3 to completely ignore the code without throwing warnings or errors

That's what the Run Anyway check box is for on the Program Properties Tab next to External Data.
 
Nice to know.

I still find it odd that it wouldn't cause an error or warning of some kind. Invalid tag source or something like that, especially since it did not run any the code (as a program or as complex code.) If it ran part of the code then did nothing when it got the missing tag I could understand that.
 

Similar Topics

Hey everyone! Need a little help with some scripting in Crimson 3.0. With this first script I am just trying set a local variable string based...
Replies
8
Views
2,348
I am stuck, pretty new at c "like" programming. Trying to have a program run some comparisons to setpoints and variable data that comes in from a...
Replies
27
Views
5,503
Hi, I have a Red Lion E3 io counting output from weld cells, connected to a PTV station for the visuals. Our number of weld cells is set to...
Replies
2
Views
1,551
Good day I'm looking for a way to let crimson 3 monitor 3 temperatures from modbus then i want crimson to "GotoPage" when these 3 temps have...
Replies
3
Views
1,625
Hello all, First time here, So I want to take an analog input and total it over time. For example, the input would be in ml/s and I would like...
Replies
1
Views
1,482
Back
Top Bottom