EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Re: BIC instruction in Code Composer Studio (CCS4)

Started by Paul Curtis December 22, 2011
There's no difference between BIC.B and AND.B in this case (certainly as seen by the C compiler).

Try using something that could use the constant generator, e.g.

x &= ~4;

I suspect you may not get AND.B out of the C compiler then, it might use BIC.B because 4 can be encoded in a single instruction word using the constant generator, whereas 0xfb can't be and will require one extension word.

Either way, BIC and AND are read-modify-write and there's no "glitching".

-- Paul.

On 22 Dec 2011, at 23:45, cyclanprime wrote:

> I am porting to a newer MSP430 and as a consequence evaluating Code Composer Studio 4.1. I have been using the IAR toolchain for MSP430X169 development.
>
> The IAR tool chain is smart enough to use BIS.B and BIC.B instructions when setting and clearing a single bit. For example, this is the assembly it produces for the following C syntax:
>
> P4OUT |= BIT6;
> asm( BIS.B #0x40,&P4OUT )
> P4OUT &= ~BIT6;
> asm( BIC.B #0x40,&P4OUT )
>
> The same syntax using the CCS tool chain for MSP430X6638 produces the following assembly:
>
> P4OUT |= BIT6;
> asm( BIS.B #0x0040,&Port_3_4_P4OUT )
> P4OUT &= ~BIT6;
> asm( AND.B #0x00bf,&Port_3_4_P4OUT )
>
> Now, aside from the differences because the 6638 can address I/O registers as 16-bit, is there another syntax or switch I should use to get CCS to use a BIC.B instruction? Maybe it doesn't matter that much, but I am a little worried about full register writes glitching the I/O, even if it has the same value after the write.
>
> Thanks,
> Jeff Geisler
>
>

Beginning Microcontrollers with the MSP430


Memfault Beyond the Launch