Crimson 3 programming

JeffKiper

Lifetime Supporting Member + Moderator
Join Date
Jun 2006
Location
Indiana
Posts
2,460
I want to learn how to do some programming. Basically if Tag1 is on my system is not talking to the node. If Tag2 is on the system is being used by someone. If Tag1 is on and Tag2 is off the system is running OK. So I have a multistate indicator with 5 states.
0=Red Off
1=Red On
2=Yellow Off
3=Yellow On
4=Green On

I would like to write a statement that is something like this.

IF (Tag1 && !Tag2)
state 4
else if (Tag1=0)
alternate between state 0 &1
else if (Tag2=1)
alternate between state 2&3.



I could do this by layering lights over top of one another but man that gets ugly quick. Think about when you have to find out why the light is flashing red and you open the software only to see the light should be yellow. I have been bitten by this once or twice from myself and other guys. SO does anybody have a clue how to write this?
 
It's early and my binary skills are decaffeinated but how do you get 5 states from 2 bits? EDIT: Oh, never mind, there are only three states.

Why not just make a tag that references Tag1 and Tag2 in complex code to generate a value from 0-3 and then in the object make two of those states flashing colors?

When combining bits, I have also used something like Result = Tag2 * 2 + Tag1.
 
Thanks guys I will try them this afternoon. I on the way to a service call.
Don't you hate it when there is something like this that you want to do but instead you have to go make good money.

Paul I tried to make a tag that referenced those 2 but my logic was more than fuzzzy (not enough sleep).

Did you guys just learn by doing or was there some reference material that helped you learn C like programming?
 
Thanks guys. I got this done while sitting in a traffic jam. As always if there is ever anything I can do to screw things up for you I am more than happy to help. There isn't usually much I can do to help you guys.
 
My book of Choice

Jeff,

I assume you are wanting to play with the programming in the red lion.

When I started using it the book I found to help the most was C++ for Dummies.

In fact I still use it. I worked thru the lessons on the CD that came with the book and it shined a light on alot of what I wanted to do. The lessons build on each other so it keeps you from jumping around and really gives you a solid foundation to work from.

I have another book that is a pocket reference for C++. It is on my desk at work or I would list the title for it also. I like to use it to double check syntax in my programs (I fat finger things alot).

IMHO...Biggest problem for guys like myself who have done more ladder logic than anything else is remembering to turn things off.
Also when creating complex conditions (the if part of the program) watch how you use your parenthesis. Another thing I screw up alot.
 
Clay you are exactly right. I need to learn to use the different tools I have in front of me.
 

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,502
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,550
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