cancel
Showing results for 
Search instead for 
Did you mean: 

Bit operation with ST9

giovanni239955
Associate II
Posted on July 22, 2003 at 12:58

Bit operation with ST9

2 REPLIES 2
giovanni239955
Associate II
Posted on May 17, 2011 at 11:34

Hello!

I'm working with ST92F150 and I need to operate with bits.

Here is my structure (coming from an application for ST7 with Cosmic compiler):

union bit_byte

{

unsigned char byte;

struct

{

unsigned char bit0:1;

unsigned char bit1:1;

unsigned char bit2:1;

unsigned char bit3:1;

unsigned char bit4:1;

unsigned char bit5:1;

unsigned char bit6:1;

unsigned char bit7:1;

}

bitdef;

};

And I use it in this way:

#define Bit0 bitdef.bit0

...

#define FLAG_abc AKEY1.Bit0

But when I call the instruction

FLAG_abc = TRUE;

in .lis file I don't see the bset assembly code, but only a byte operation (or dpr:pof(@FLAGSx),#1).

How can I be more efficient?

Thanks a lot!

Aragorn

romain2399
Associate II
Posted on May 17, 2011 at 11:34

In the ST9 instruction set the bit set is limited to the working registers (used for function parameters and frame pointer): have a look to the ST9 Programming Manual.

Your variable is either in RAM or in the Regiser File as General Purpose Register and there is no way to make a bit set.