Why does this work? - Decimal to Binary Conversion in AF

Discussion created by shapptastic on Nov 15, 2019

All,  I used KB01940 to split a 16 bit register coming from a modbus device into individual alarms.  The formula of:


ABS('Integer' and 2^0)/2^0

ABS('Integer' and 2^1)/2^1

ABS('Integer' and 2^3)/2^3



works for some reason, but I cannot figure out why.  Logically, I would assume the ABS of an integer with an 'and' of another number would always be 1, but there's some sort of magic going on in the formula that I can't figure out.  Any idea why this is the case?