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

Bit / Bool data types in function parameters

scarter
2024-01-17
2024-01-18
  • scarter - 2024-01-17

    Any reason BIT and BOOL data types are not interchangeable?

    Trying to make a function which takes a BOOL IN/OUT parameter (Not allowed to use BIT)

    In the main logic if I make a DINT variable, and want to use each bit on different functions CODESYS will not allow it.

     
  • SiegeLion - 2024-01-18

    Memory addressing is measured in bytes, with BOOL occupying one byte. BIT is quite unique as it occupies one bit. So, try not to use BIT in the program.

    You can use the Unpack function to solve your problem.

     

Log in to post a comment.