John is using a Wsum on the tool turret encoder
as its the same encoder as in the little HNC, my hardinge superslants etc
here is the truth table for any one else intrested.
################
# Decode for turrets
################
# Tool 1 2 3 4 5 6 7 8
# BitD 0 0 0 0 0 0 0 1
# BitC 0 0 0 1 1 1 1 0
# BitB 0 1 1 0 0 1 1 0
# BitA 1 0 1 0 1 0 1 0
################
here is the HAL snippet which i have ten fed into classicladder to handle all the spin and lock down etc.
#turret bit ins
#t1
net t1-bit0 wsum.0.bit.0.in <= hm2_[HOSTMOT2](BOARD).0.gpio.063.in_not
net t1-bit1 wsum.0.bit.1.in <= hm2_[HOSTMOT2](BOARD).0.gpio.061.in_not
net t1-bit2 wsum.0.bit.2.in <= hm2_[HOSTMOT2](BOARD).0.gpio.059.in_not
net t1-bit3 wsum.0.bit.3.in <= hm2_[HOSTMOT2](BOARD).0.gpio.057.in_not
net turret1-num wsum.0.sum => classicladder.0.s32in-02
if any one is intrested i will add the ladder logic if john does not mind me spamming his post, or add it on wiki i guess, maybe john will add his when he gets there
rob