WinCC SetTagBit problem

Tomislav

Member
Join Date
Feb 2008
Location
Posts
8
Hi!

I work in WinCC project of the filling bottle. I have problem.
I have to set high three bits depending on bottle position. I define 3 variables lLeft1, lLeft2 and lLeft3. When is:
lLeft1 == position 491 the bit M125.5 must be set high,
lLeft1 == position 622 the bit M125.6 must be set high,
lLeft1 == position 759 the bit M125.7 must be set high,
lLeft2 == position 622 the bit M125.5 must be set high,
lLeft2 == position 759 the bit M125.6 must be set high,
lLeft3 == position 491 the bit M125.5 must be set high.

With C-action i was write following code and that not work!
Can somebody tell me what is wrong in the code.


float lLeft1;
float lLeft2;
float lLeft3;
float lLeft4;
float lLeft5;
float lLeft6;

LPCTSTR tijelo1 = "Group39";
LPCTSTR tijelo2 = "Group36";
LPCTSTR tijelo3 = "Group4";

#define slika1 "Maketa.Pdl"

#define TAG1 "Postrojenje_ON"
#define TAG5 "Automatski_mod"
#define TAG6 "Auto_desno_1"
#define TAG7 "Senzor_1" -> M125.5
#define TAG8 "Senzor_2" -> M125.6
#define TAG9 "Senzor_3" -> M125.7

if ( GetTagBit (TAG1) == TRUE && GetTagBit (TAG5) == TRUE && GetTagBit (TAG6) == TRUE)
{
for ( lLeft1= 313e+0; lLeft1<= 1170e+0; lLeft1= lLeft1 + 5e-2 )
{
labela11:
SetLeft(slika1, tijelo1, lLeft1);

if ( lLeft1 == 491)
SetTagBit (TAG7, TRUE);
else
SetTagBit (TAG7, FALSE);

if (GetTagBit (TAG1) == FALSE || GetTagBit (TAG5) == FALSE || GetTagBit (TAG6) == FALSE)
goto labela11;
if (GetLeft(slika1, tijelo1) == 598)
{
for ( lLeft2 = 313e+0, lLeft1= 598e+0; lLeft2 <= 1170e+0, lLeft1 <= 1170e+0; lLeft2 = lLeft2 + 10e-2, lLeft1 = lLeft1 + 10e-2 )
{
labela12:
SetLeft(slika1, tijelo1, lLeft1);
SetLeft(slika1, tijelo2, lLeft2);

if (lLeft1 == 622)
SetTagBit (TAG8, TRUE);
else
SetTagBit (TAG8, FALSE);

if ( lLeft1 == 759)
SetTagBit (TAG9, TRUE);
else
SetTagBit (TAG9, FALSE);

if ( lLeft2 == 491)
SetTagBit (TAG7, TRUE);
else
SetTagBit (TAG7, FALSE);

if (GetTagBit (TAG1) == FALSE || GetTagBit (TAG5) == FALSE || GetTagBit (TAG6) == FALSE)
goto labela12;
if (GetLeft(slika1, tijelo1) == 883)
{
labela14:
for ( lLeft3 = 313e+0, lLeft1 = 883e+0, lLeft2 = 598e+0; lLeft2 <= 1170e+0, lLeft1 <= 1170e+0, lLeft3 <= 1170e+0; lLeft2 = lLeft2 + 20e-2, lLeft1 = lLeft1 + 20e-2, lLeft3 = lLeft3 + 20e-2 )
{
labela13:
SetLeft(slika1, tijelo1, lLeft1);
SetLeft(slika1, tijelo2, lLeft2);
SetLeft(slika1, tijelo3, lLeft3);

if ( lLeft2 == 622)
SetTagBit (TAG8, TRUE);
else
SetTagBit (TAG8, FALSE);

if ( lLeft2 == 759)
SetTagBit (TAG9, TRUE);
else
SetTagBit (TAG9, FALSE);

if ( lLeft3 == 491)
SetTagBit (TAG7, TRUE);
else
SetTagBit (TAG7, FALSE);

if (GetLeft( slika1, tijelo1) == 1170)
goto labela14;
if (GetTagBit (TAG1) == FALSE || GetTagBit (TAG5) == FALSE || GetTagBit (TAG6) == FALSE)
goto labela13;
}
}
}
}
}
}

Thanks!
 
Try SetTagBit("Tag_Name", 1) instead SetTagBit("Tag_Name", TRUE) etc. but keep "TRUE" or "FALSE" into "if" statements.

Good Luck
 

Similar Topics

Does anyone happen to know how to install the graphic picture in HMI when I go into blower selection there are no graphics shown not only blower...
Replies
1
Views
63
Hi folks, I'm not as accustom with Siemens & WinCC, however I've been asked to increase the amount of data an existing application is logging...
Replies
2
Views
65
I have created a project in TIA Portal v16 Upd6 with S7-1200 (6ES7214-1AG40-0XB0) and WinCC Unified (PC station). The communication between the...
Replies
4
Views
145
I am creating a project with WinCC Unified v16 Upd6 (PC runtime) with an S7-1200. The communication is good between the PC and the PLC as I can...
Replies
6
Views
190
hello s7-400h and wincc are connected to each other via Ethernet. I need help on how to do time synchronization
Replies
0
Views
53
Back
Top Bottom