Merge bits on a byte simulink
77 次查看(过去 30 天)
显示 更早的评论
Dears,
I would like to create a byte with 8 independent bits in Simulink. The opposite function is achieved with the "Extract Bits" block. From a byte I can extract the value of the bit at position x. I would like to do the opposite operation, from many bits to generate a byte.
Thanks and regards
Juan
2 个评论
Walter Roberson
2022-6-16
You can use a series of BitSet blocks, or you can use a Math block... 128*u(1) + 64*u(2) etc
采纳的回答
Fangjun Jiang
2022-6-16
编辑:Fangjun Jiang
2022-6-16
Drop 8 Constant blocks, each is specified as "true" or "false". Use a "Vector Concatenate" block to make it 8x1 vector, then feed it to a "Bit to Integer Converter" block.
"Mux" block can also be used to replace the "Vector Concatenate" block.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 General Applications 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!