How i can write to a bit field in IDE CWide eTPU?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How i can write to a bit field in IDE CWide eTPU?

1,171件の閲覧回数
demian91
Contributor III

Hi, i'm using CWide or codewarrior for eTPU and when i create for example a struct:

typedef union

{

   struct

   {

      uint32_t B0:1;

      uint32_t B1:1;

      uint32_t B2:2;

      uint32_t B3:4;

      uint32_t B4:8;

      uint32_t B5:16;

   }B;

   uint32_t R;

}EST;

EST Est;

if i write Est.R = 1<<30; works but when Est.B1 = 1; that's not works.

If posible write a bit like that?

ラベル(1)
0 件の賞賛
返信
1 返信

1,068件の閲覧回数
stanish
NXP Employee
NXP Employee

Hello Demian,

CodeWarrior for ETPU supports bitfields.

I noticed there is missing .B in your usecase:

Est.B.B1 = 1;

Note:

if you expect reversed bitfield allocation please check pragma below:

<CW eTPU v10.x>\ETPU\Help\PDF\eTPU_Build_Tools_Reference.pdf

#pragma reverse_bitfields on | off | reset

Hope it helps.

Stan

0 件の賞賛
返信