Sign in to follow this  
Followers 0
Levent1970

Some Conversion Problems from Codesys to GX Works in Structured Text

1 post in this topic

Hi,

I Have some Problems with this Function Block written in Codesys ST:

Variables:

FUNCTION_BLOCK FB_Powder_Test

VAR_INPUT

    bEnable: BOOL;
    bPowder_On_Button: BOOL;
    bPowder_Test_OnOff: BOOL;
    iTime_Powdertest: INT;

END_VAR

VAR_OUTPUT

    bReset: BOOL;
    iActual_time_powdertest: INT;

END_VAR

VAR

    PowderTest_Ton: TON;

END_VAR

Function Block:

IF NOT bEnable THEN

    bReset := TRUE;
    PowderTest_Ton.IN := FALSE;
    iActual_time_powdertest := 0;

ELSE

    IF bPowder_On_Button THEN

        PowderTest_Ton(IN := bPowder_Test_OnOff, PT := (INT_TO_TIME(iTime_Powdertest) * 1000));

        iActual_time_powdertest := REAL_TO_INT((TIME_TO_REAL(PowderTest_Ton.PT) - TIME_TO_REAL( PowderTest_Ton.ET)) / 1000);

        bReset :=  PowderTest_Ton.Q;

    END_IF

END_IF

and GX Works3 

Variables:

bEnable                                  Bit                        VAR_INPUT
bPowder_On_Button            Bit                        VAR_INPUT
bPowder_Test_OnOff          Bit                         VAR_INPUT
iTime_Powdertest                Word [Signed]    VAR_INPUT
bReset                                    Bit                        VAR_OUTPUT
iActual_time_powdertest    Word [Signed]    VAR_OUTPUT
PowderTest_Ton                  TON                     VAR
 

Function Block:

IF NOT bEnable THEN

    bReset := TRUE;
    PowderTest_Ton.IN := FALSE;
    iActual_time_powdertest := 0;

ELSE

    IF bPowder_On_Button THEN

        PowderTest_Ton(IN := bPowder_Test_OnOff, PT := (INT_TO_REAL(iTime_Powdertest) * 1000));

        iActual_time_powdertest := ((TIME_TO_INT(PowderTest_Ton.PT) - TIME_TO_INT( PowderTest_Ton.ET)) / 1000);

        bReset :=  PowderTest_Ton.Q;

    END_IF;

END_IF;

I have this Error:

No.    Result    Data Name    Category    Content    Error Code
1    Warning    FB_Powder_Test    Syntax Check    Convert data type from INT type to REAL type automatically.    0x11042FD4
2    Error    FB_Powder_Test    Syntax Check    Data type of argument does not match.    0x11041F61
 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0