Quantcast
Channel: EngineerZone: Message List
Viewing all articles
Browse latest Browse all 22625

Re: binary control

$
0
0

     Hello Gennady,

 

     This would be a lot easier to do if SigmaStudio had a bit-test function as suggested by jon71 at

http://ez.analog.com/message/132542#132542

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:

Byte2Bits-sch_pic.jpg

     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


Viewing all articles
Browse latest Browse all 22625

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>