defining a Struct

carcrosser
2013-08-15
2013-08-16
  • carcrosser - 2013-08-15

    I've tried several things, but always with errors during compiling.

    in Global variables I tried:

    VAR_GLOBAL
       TYPE framedata:
          STRUCT
             COB_ID:DWORD;
             extended:BOOL;
             interval:TIME;
             data:ARRAY[1..8] OF INT;
          END_STRUCT
       END_TYPE
            TX_CAN_frame: ARRAY [0..30] OF framedata;
    END_VAR
    

    Results in the following errors:
    Error 3781: Global_Variables (3): 'END_VAR' or identifier expected
    Error 3781: Global_Variables (9): 'END_VAR' or identifier expected
    and of course the variable type is of unknown type

    placing the struct before VAR_GLOBAL either after END_VAR

    results in following error
    Error 4024: Global_variables(2): Expecting VAR_GLOBAL before 'TYPE'

    me confused. It's not an option to declare anything locally

     
  • t.lundahl - 2013-08-16

    Hi!

    Construct the struct under 'Data types' tab (remove old from GVL).
    And declare the TX_CAN_frame in GVL in 'Resource' tab (like you did already) or
    locally.

    /Torbjörn

     
  • carcrosser - 2013-08-16

    thank you, that solved my mystery

     

Log in to post a comment.