error message about global variables

fairy
2012-02-08
2023-08-17
  • fairy - 2012-02-08

    hello,when I bulid a program given by 'codesys 2.3 basic manul',there were seven errors all about global variables.

    but I was following manul's example ,and the first time I bulit ,it was successful. then I changed something and restore this program , nothing different form the example in book. below are global variables and error messages ,please help me finding reasons.
    VAR_GLOBAL

    IN  AT%IX0.0:BOOL;
    L1_GREEN AT%QX0.0:BOOL;
    L1_YELLOW AT %QX0.1:BOOL;
    
    L1_RED AT %QX0.2:BOOL;
    L2_GREEN AT %QX0.4:BOOL;
    L2_YELLOW AT %QX0.5:BOOL;
             L2_RED AT %QX0.6:BOOL;
    

    END_VAR

    Error 3728:Global_Variables(3):invalid address'%IX0.0'
    Error 3728:Global_Variables(4):invalid address'%QX0.0'
    Error 3728:Global_Variables(5):invalid address'%QX0.1'
    Error 3728:Global_Variables(6):invalid address'%QX0.2'
    Error 3728:Global_Variables(7):invalid address'%QX0.3'
    Error 3728:Global_Variables(8):invalid address'%QX0.4'
    Error 3728:Global_Variables(9):invalid address'%QX0.5'

     
  • shooter - 2012-02-09

    there must be a space in between the AT and the rest.
    You must have a PLC type declared as it is calculating the address.
    I do not get this error so please send the complete program.
    Did you put these vars in the correct place resources-globalvars-globalvars?
    Not in any other place ie in your PLC_PRG this will not work.
    the example on the traffic lights is no good example.
    try for yourself and have a look at w www.oscat.de w for a nice library.
    if you look into the TXT version you can see exact how it is programmed.

     

Log in to post a comment.