How to generate code for a Switch Block using if-else statements

2 Ansichten (letzte 30 Tage)
dayoung
dayoung am 14 Mär. 2025
Kommentiert: Walter Roberson am 18 Mär. 2025
Now I'm using Autosar - Generate Code
I want to generate Switch block to if-else statements
but always generate like below
how could i fix this
/* Switch: '<S14>/Switch' */
rtb_Switch = (sint16)asr_s32(rtu_Isig_ObjectInfo * 6711, 26U);

Antworten (1)

Kilsu Kim
Kilsu Kim am 18 Mär. 2025
해당 문의 사항은 기술 지원팀 케이스에서 답변드렸습니다.
위 코드가 생성된 이유는 Switch 블록에 입력되는 "Isig_ObjectInfo" 신호가 고정 소수점 데이터 형이기 때문입니다. 데이터 형을 일반 정수형으로 (예: int16) 변경하시면 원하시는 코드를 생성하실 수 있습니다.
감사합니다.
  1 Kommentar
Walter Roberson
Walter Roberson am 18 Mär. 2025
Approximate translation of @Kilsu Kim
The question was answered in the technical support case.
The reason the above code was generated is because the "Isig_ObjectInfo" signal input to the Switch block is a fixed-point data type. If you change the data type to a general integer type (e.g. int16), you can generate the code you want.
Thank you.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu AUTOSAR Blockset finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by