On 2008-09-24, Ralf Hildebrandt <[email protected]> wrote:
> Ali Shah wrote:
>
>> SetupP1:
>> bis.b #0x05, &P5DIR ; P5.4 output
>> bis.b #0x06, &P5DIR ; P5.5 output
>> bis.b #0x07, &P5DIR ; P5.6 output
>
> #0x05 == 0000_0101 in binary
> #0x06 == 0000_0110 in binary
> #0x07 == 0000_0111 in binary
>
> So it seems your intention is
> bis.b #(BIT4+BIT6+BIT7), &P5DIR ; P5.4-6 output
>
> BITx are predefined constants in <common.h>.
>
>
>> mov.b #llo(0xFFFF), &P5OUT ; Toggle off P5
>
> P5OUT is a byte register.
> mov.b #0xFF, &P5OUT ; Toggle off P5
>
>
>
> Let me give you one hint: C-Compilers are great. They generate very good
> code - especially for the MSP430 which is a C-friedly architecture.
Secifically, the C compiler knows about bis and bic
instructions and will use them when it can. To take the above
as an example, this code will generate a single bis
instruction:
#define Bit(n) (1<<(n))
P5DIR |= Bit(4)+Bit(5)+Bit(6);
--
Grant Edwards grante Yow! I don't know WHY I
at said that ... I think it
visi.com came from the FILLINGS in
my rear molars ...