Crimson 3.0 HOA W. 3-State Toggle

ggrice_71

Member
Join Date
Jun 2010
Location
South Georgia
Posts
7
Hi Guys,
New Crimson user here. I would like to create a Hand/Off/Auto from a 3-State Toggle button as I would in Wonderware with "Hand" and "Auto" turning on discrete bits on my Modicon PLC. I have 6 pumps that I need to control. Tech support said the toggle is designed to send an integer to the PLC. I can make it do that without issue. However, everything I try to convert my integer value ( 1= hand, 2= auto), fails to turn on my bits in C3.0. I created a program with a switch command and set it to background to monitor the integer status. Is there a better way, a tutorial, or am I missing something simple? Thanks for your help.

P1_Mode is the integer associated with toggle
P1_Hand and P1_Auto are linked to PLC bits

switch (P1_Mode) {
case 1:
P1_Hand = 1;
Break;
case 2:
P1_Auto = 1
Break;
}
 
A few things:
1. You need to use the assignment operator :)=) to change the value of a variable.
2. When your different states are activated, make sure you turn OFF any bits that might have been on previously.



switch (P1_Mode) {

case 0:
P1_Hand := 0;
P1_Auto := 0;
Break;

case 1:
P1_Auto := 0;
P1_Hand := 1;
Break;

case 2:
P1_Hand := 0;
P1_Auto := 1;
Break;
}
 
Thanks. The manual for programming is very limited. I've learned more from reading these forums. I set up Data Boxes for the variables on the screen. P1_Mode changes value. P1_Hand and P1_ Auto do not, even after I made the suggested changes.
I'm open to better ways to do this if anyone has them. Thanks in advance.
I like the Red Lions, but something as simple as a 3-state toggle shouldn't be this involved.
 
There are a number of ways to do what you want, some simpler than others. My experience is mainly with Crimson v2 but most applies to v3 also.

I'm not familiar with Modicon but if your PLC is able to look at individual bits in an integer, then it's easy. Set up your PLC to read the P1_Mode integer tag. In the 3-state toggle properties, set Values A=0, B=2, and C=4. (This corresponds to 000, 010, and 100 in binary.) The second and third bits in P1_Mode will correspond to Hand and Auto modes, respectively. No complex code necessary!

I suspect the problem with your current setup might be that the program is not being executed. Programs have to be triggered in order to run. To make it run continuously, add it to the "On Tick" or "On Update" actions in the main Pages area.
 
Well I could never get the program to behave as I would like. I finally acquiesced and went with the integer to PLC route. A plus for this method is that my pump state will remain constant in the PLC even if I lose the HMI.
Thanks for your help!!!!
 
I am trying to set this switch statement up for my set up. I currently have another thread about finding the definition for the HOA. How did you get p1_mode to be accepted, did you go to create new tag?
 
I used kolyur's advice to make my HOA work. I set up a 3-State Toggle Switch where the "Value" is equal to data tag. My PLC writes a value of A=0, B=2, or C=4, which I assign A,B, and C in the toggle's "Advanced" tab. Works fine with no coding needed.
 
I used kolyur's advice to make my HOA work. I set up a 3-State Toggle Switch where the "Value" is equal to data tag. My PLC writes a value of A=0, B=2, or C=4, which I assign A,B, and C in the toggle's "Advanced" tab. Works fine with no coding needed.

I'm on a crusade to encourage people to *not* jump to programming to accomplish such simple tasks in Crimson 3.0. There are many situations were programming is the right solution, but there are even more where a better familiarity with the tag and primitive structures would reveal a fairly simple solution without programming.

If everyone would "play around" with the basic system before jumping into programming, they would quite often save themselves a lot of time and they would make their programming more productive, too.

Again, programming has a place and I use a lot of it, but you can really put together a nice system without it.
 
Ok cool, however I tried this and it didnt work the hmi knob would not turn as I pressed it to the selected position nor would it change the status. I believe I did get it to turn once but cant remember what I did. However it would update the status thats why I figured I needed code. Should I set p1_mode to int?
 
P1_Mode is an int read by my plc.On the "Advanced" tab you assign the values for the three states. I didn't use a knob graphic, though. I used a "3-state selector" that actually looks like a real HOA selector switch.
 
Last edited:
Ok so if I wanted to do this it would look like

Int p1_mode;
Code given by koylur

And then assign values in the advanced tab? Do I place the code in complex?
 
Dodge, I'm pretty sure you can do this without custom code. Are you using a 3-state selector as suggested by ggrice? Or some other primitive? It might help if you uploaded your cd3 file.
 

Similar Topics

Before I drive myself nuts with the lack of programming documentation provided with Crimson, I'll ask you guys. What is my best method for...
Replies
10
Views
3,342
Hey guys, hoping someone here could give me a little advice. I'm working with a CR1000-04000 in Crimson 3.1 and I was interested in adding the...
Replies
4
Views
124
Hi, I'm having an issue in crimson 3.0 when I create a programme using a case statement referencing a fault word that each bit needs to change the...
Replies
5
Views
229
How do you install update on Red Lion Crimson ver 3.1. Do I just need to run the exe file on the host server?
Replies
1
Views
107
Has anyone found a way to convert/replace/update the firmware on old Parker TS80xx series HMIs (i.e. TS8010, TS8006, etc) to accept Crimson...
Replies
0
Views
92
Back
Top Bottom