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,172 次查看
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,069 次查看
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 项奖励
回复