Code to extract motor status bits