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
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
JuanMa
JuanMa 2022년 6월 16일
I thought there was a block that solved it. The second option is good.
Thank you!

댓글을 달려면 로그인하십시오.

 채택된 답변

Fangjun Jiang
Fangjun Jiang 2022년 6월 16일
편집: Fangjun Jiang 2022년 6월 16일

1 개 추천

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.

댓글 수: 1

JuanMa
JuanMa 2022년 6월 16일
Hi Fangjun, Bit to Integer Converter is the block I was looking for
Thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

제품

릴리스

R2019b

질문:

2022년 6월 16일

댓글:

2022년 6월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by