Bit declirations and changing values

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Bit declirations and changing values

2,061 次查看
NZ_Design
Contributor I
I have a bit array set up of about 66 bits. Mem map says 9 bytes.

decleared as below.

typedef struct _B
{
  unsigned bSizerStatus:1;                  // sizer status - running,stopped
  unsigned bSizerStatusChg:1;              // sizer status - running,stopped
  unsigned bSizerDataUpdate:1;
  unsigned bDiagDataUpdate:1;              // sizer status - running,stopped
  unsigned bSizerSpeed:1;                  // speed update flag
  ........
  ........
  unsigned bWghReq:1;
  unsigned bBkLightTimerReset:1;
  unsigned bAllCupReq:1;
  unsigned bTestAll:1;
  unsigned bTestSingleLane:1;
} FLAGS;

I have a routine that calls an other and in that routine it sets one ofr these bits upon returning it tests that bit to see if it is set and carries on.

The problem is it sets the bit but by the time it comes to test it it is cleared.

Why???

If define it as "uchar x; ie a unsigned byte which is a waste of memory it works fine.

标签 (1)
0 项奖励
回复
1 回复

703 次查看
CrasyCat
Specialist III
Hello
 
I think you need to get a support engineer to look at this one.
The code generated actually depends on the source code and it is not possible to
investigate something like that from the forum..
 
I would recommend you to submit a service request for that.

Click here to submit a service request.

Make sure to attach a reproducible project and installed product information to the service request.
To generate the required information:
- Start CodeWarrior
- Open the project
- Select "Help" -> "Pack and Go" and follow instructions on the screen.

Attach the generated .zip file to the SR.
 
CrasyCat
0 项奖励
回复