-> Hier kostenlos registrieren
Hallo Leute,
ich möchte in WinCC per C-Script mehrere 32-Bit Variablen auswerten, ob hier das Bit 0 = 1 ist, also eine oder Verknüpfung von DWord Variablen.
Ist min. ein Bit0 =1 soll eine binäre Variable = 1 sein.
Bei mir funzt es nur teilweise, ich denke im Script fehlt noch das entscheidene
:
#include "apdefap.h"
int gscAction( void )
{
// WINCC:TAGNAME_SECTION_START
// syntax: #define TagNameInAction "DMTagName"
// next TagID : 1
// WINCC:TAGNAME_SECTION_END
#define TAG_1 "MAK3_B_BAUF" //32Bit
#define TAG_2 "MAK4_B_BAUF" //32Bit
#define TAG_3 "MAK4_B_AUTO" //binär
// WINCC
ICNAME_SECTION_START
// syntax: #define PicNameInAction "PictureName"
// next PicID : 1
// WINCC
ICNAME_SECTION_END
if ((GetTagDWord (TAG_1)) & 0x1)
SetTagBit(TAG_3,1);
else
SetTagBit(TAG_3,0);
if ((GetTagDWord (TAG_2)) & 0x1)
SetTagBit(TAG_3,1);
else
SetTagBit(TAG_3,0);
return 0;
}
ich möchte in WinCC per C-Script mehrere 32-Bit Variablen auswerten, ob hier das Bit 0 = 1 ist, also eine oder Verknüpfung von DWord Variablen.
Ist min. ein Bit0 =1 soll eine binäre Variable = 1 sein.
Bei mir funzt es nur teilweise, ich denke im Script fehlt noch das entscheidene

#include "apdefap.h"
int gscAction( void )
{
// WINCC:TAGNAME_SECTION_START
// syntax: #define TagNameInAction "DMTagName"
// next TagID : 1
// WINCC:TAGNAME_SECTION_END
#define TAG_1 "MAK3_B_BAUF" //32Bit
#define TAG_2 "MAK4_B_BAUF" //32Bit
#define TAG_3 "MAK4_B_AUTO" //binär
// WINCC

// syntax: #define PicNameInAction "PictureName"
// next PicID : 1
// WINCC

if ((GetTagDWord (TAG_1)) & 0x1)
SetTagBit(TAG_3,1);
else
SetTagBit(TAG_3,0);
if ((GetTagDWord (TAG_2)) & 0x1)
SetTagBit(TAG_3,1);
else
SetTagBit(TAG_3,0);
return 0;
}