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.