Filter löschen
Filter löschen

how to define a register depending on inputs ?

2 Ansichten (letzte 30 Tage)
Henry Buck
Henry Buck am 29 Feb. 2016
Hi,
I want to define a register(10 bits for example) or variable that depends on some inputs. One of the inputs is changing between +10 t0 -10 and resolution of 1 in each step (10,9,8...-8,-9,,10) - it behave like a sine wave steps. The purpose of that register is like an index between those steps - in each step proper bit wil turn on. for example: If input=0 then register will change to reg=0000000000. if input=1 then register will change to reg=0000000001. if input=2 then register will change to reg=0000000011. ... ... if input=9 then register will change to reg=0111111111. if input=10 then register will change to reg=1111111111.
and when it reached the max value(10), and progress, again to 9, 8 ,7, it clear those spicific bits... if input=9 then register will change to reg=0111111111. if input=8 then register will change to reg=0011111111. if input=7 then register will change to reg=0001111111.
and so on...
In each step I need to read that register and according the bits inside, create outputs. for each bit: if bit = 0 the output will be 01 if bit = 1 the output will be 10
Can anyone guide/show me how to do/write it correctly? Can Ido it in MATLAB function ?
Thanks, Henry

Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by