Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Word bit access

lucaver89
2020-04-15
2020-04-16
  • lucaver89 - 2020-04-15

    Hi to all,

    I'm searching a way to do something like that:

    PROGRAM PLC_PRG
    VAR
    
        wOutputs :WORD
        iMyBit :UINT;
    
    END_VAR
    
    iMyBit := 2; 
    
    wOutputs.iMyBit := TRUE;
    

    If I try to build this code, the compiler give me errors. Any suggestion to do it?

    Thanks to all
    Luca

     
  • kislov - 2020-04-16

    Hi. Use function PUTBIT / EXTRACT from Util library.

     
    πŸ‘
    1
  • lucaver89 - 2020-04-16

    Hi,

    I'm thinking that putbit function is what I need.

    Another question: If I want to use physical address with AT instruction, how can I avoid overlap address? Many PLC have a tool able to show which physical addresses are free o busy. Does codesys too?

    Thanks
    Luca

     

Log in to post a comment.