In any Logix5000 processor and any version from 15 through 17, I am looking for a way to convert a decimal number of 1 through 8 to a binary that will represent a mask. This lets me tell a loop in the plc which analog inputs to ignore the faults from if I tell the subroutine how many I am using. So if I am using one then the mask should be 2#00000001, if two then 2#00000011, three will be 2#00000111 up to eight of 2#11111111. I dont want to just do a crude lookup table, I would like it to be buried in the code so that no tags can be changed.
Im trying to figure if there is a simple equation I can write or not.
Thanks
edit: It needs to work in ladder logic, not text or anything else
Im trying to figure if there is a simple equation I can write or not.
Thanks
edit: It needs to work in ladder logic, not text or anything else
Last edited: