kekrahulik
Member
I’m locked in a hotel room trying to do a month’s worth of programming in a few days (called in as the last minute janitor for a mess) and I need a little time saving help with RSLogix5000 programming.
I have programmed each bit of a DINT to represent a state (DINT.0 = State 0, DINT.1 = State 1). One and only one bit is ever true at a time, so the DINT value can only be 1, 2, 4, 8, 16, 32, 64....
I would like to quickly determine the bit position within the DINT and store it as an integer. Ie if the DINT = 32, my integer result would be 5.
A quick way would be to take the Base2 Log of the DINT, but I only see Base10 Log in RSLogix5000. It seems that I should be able to use an FBC to do this, but I need to break the DINT bits out to an array first.
Any ***y solutions out there?
I have programmed each bit of a DINT to represent a state (DINT.0 = State 0, DINT.1 = State 1). One and only one bit is ever true at a time, so the DINT value can only be 1, 2, 4, 8, 16, 32, 64....
I would like to quickly determine the bit position within the DINT and store it as an integer. Ie if the DINT = 32, my integer result would be 5.
A quick way would be to take the Base2 Log of the DINT, but I only see Base10 Log in RSLogix5000. It seems that I should be able to use an FBC to do this, but I need to break the DINT bits out to an array first.
Any ***y solutions out there?