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

is there any free trial version available for step7 professional and wincc comfort v17. i searched and downloaded TRIAL Download STEP 7...
Replies
1
Views
55
Hello. I have a db which is 1000 INT, and this db is represented in WinCC as a raw data type set of 5x 400 Bytes. This set is read with a script...
Replies
1
Views
79
Hello Experts I am working on a project with WinCC Unified v16 PC system and want to create an option on the screen to export logs to the...
Replies
0
Views
70
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
98
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
82
Back
Top Bottom