Hello Gennady,
This would be a lot easier to do if SigmaStudio had a bit-test function as suggested by jon71 at
Without that function, what would be trivial in a microcontroller becomes a mess in SigmaDSP. However, you can do it with a compare-remainder-shift approach. Shown below is the input byte, the first stage of the conversion, and the lower four of the six output bits:
For this to work, the input word must be all zeros except for the lowest 6 bits, which represent the desired multiplexer states. This input is compared to 32 -- if at least this large, the highest MUX is activated while 32 is subtracted from the input. The remainder is multiplied by 2 (shifted left), then the next bit is extracted the same way. After all the stages, the final remainder operates the lowest MUX.
For testing I have the MUXes switching between inputs of 0 and 32 while reading back their outputs. The -1701's readback function drops the lowest nibble, so "32" (hex 20) reads back as "2". With 7 ( binary 000111) input, the readbacks from Bit 0, 1, 2 read high, the others low -- as expected. As shown, this thing uses 141 instructions, including the MUXes but not including the readbacks.
Best regards,
Bob