![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/174157/image.png)
Bit Extraction - Simulink
74 次查看(过去 30 天)
显示 更早的评论
I am attempting what should be a simple task. I would like to send a sine wave through a 9-bit analog-to-digital converter (ADC) and extract the output bits. Specifically I would like to extract the first 3 bits into one "channel", the middle 3 into a separate channel, and finally the last 3 into another. I will then use these bits to create a representative pulse (e.g. if the first 3 bits are 111, then I will create a pulse that takes on the value one for a specified period. If they are 000, then the pulse will have value 0.) I have attempted using the "Extract Bits" block as shown in the attached image, however I run into an overflow error. Can anyone suggest how to fix this issue or mitigate it using an alternative technique? Thank you.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/162106/image.png)
0 个评论
回答(1 个)
Nikhil Vyas
2016-4-25
You can use the Bit Slice block instead of Extract Bits to achieve the same. Something like this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/174157/image.png)
To replicate the above example, make sure to set the datatype for the constant block to something more than 8-bit since you need 9 bits. Just saying. :)
2 个评论
abdulrahim evli
2021-4-21
Can I convert to extracted bits to integer? With Bit to Integer to blok cant achieve this because extracted bits are vector
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sources 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!