Bit fields?
Started by ●October 18, 2013
Hi! I am new and start learning MSP430G2553. And i read a book named "MSP430
Microcontroller Basics" in chapter3.2. The book introduce the bit fields
structure for the header file. But i can't find the bit fields definition
in msp430g2553 header file. And it cause me a problem if i want to read or write
the single bit of the register. Is there any new way to read or write single bit
like bit fields structure in in g2553? Or should i write the header file by
myself?
Reply by ●October 18, 20132013-10-18
I've just looked at the msp430F2553.h file and it includes all the bit
fields as #defines.
Al
On 19/10/2013 12:48 AM, u...@gmail.com wrote:
> Hi! I am new and start learning MSP430G2553. And i read a book named
> "MSP430 Microcontroller Basics" in chapter3.2. The book introduce the
> bit fields structure for the header file. But i can't find the bit
> fields definition in msp430g2553 header file. And it cause me a
> problem if i want to read or write the single bit of the register. Is
> there any new way to read or write single bit like bit fields
> structure in in g2553? Or should i write the header file by myself?
fields as #defines.
Al
On 19/10/2013 12:48 AM, u...@gmail.com wrote:
> Hi! I am new and start learning MSP430G2553. And i read a book named
> "MSP430 Microcontroller Basics" in chapter3.2. The book introduce the
> bit fields structure for the header file. But i can't find the bit
> fields definition in msp430g2553 header file. And it cause me a
> problem if i want to read or write the single bit of the register. Is
> there any new way to read or write single bit like bit fields
> structure in in g2553? Or should i write the header file by myself?
Reply by ●October 19, 20132013-10-19
The deprecated header file io430g2553.h has those definitions. Using |= to set
bits and &= to clear bits instead are more efficient. You can also use ^= to
flip bits.
---In m..., wrote:
Hi! I am new and start learning MSP430G2553. And i read a book named "MSP430 Microcontroller Basics" in chapter3.2. The book introduce the bit fields structure for the header file. But i can't find the bit fields definition in msp430g2553 header file. And it cause me a problem if i want to read or write the single bit of the register. Is there any new way to read or write single bit like bit fields structure in in g2553? Or should i write the header file by myself?
---In m..., wrote:
Hi! I am new and start learning MSP430G2553. And i read a book named "MSP430 Microcontroller Basics" in chapter3.2. The book introduce the bit fields structure for the header file. But i can't find the bit fields definition in msp430g2553 header file. And it cause me a problem if i want to read or write the single bit of the register. Is there any new way to read or write single bit like bit fields structure in in g2553? Or should i write the header file by myself?
Reply by ●October 19, 20132013-10-19
With io430g2553.h, you can use statements such as:
P1DIR_bit.P3 = 1;
P1DIR_bit.P4 = 0;
P1DIR_bit.P5 = 1;
P1DIR_bit.P6 = 1;
P1DIR_bit.P7 = 0;
With msp430g2553.h, you can do the same by:
P1DIR |= BIT3+BIT5+BIT6;
P1DIR &= ~(BIT4+BIT7);
BTW, io430g2553 has 2796 lines while msp430g2553.h has 986 lines.
---In m..., wrote:
The deprecated header file io430g2553.h has those definitions. Using |= to set bits and &= to clear bits instead are more efficient. You can also use ^= to flip bits.
---In m..., wrote:
Hi! I am new and start learning MSP430G2553. And i read a book named "MSP430 Microcontroller Basics" in chapter3.2. The book introduce the bit fields structure for the header file. But i can't find the bit fields definition in msp430g2553 header file. And it cause me a problem if i want to read or write the single bit of the register. Is there any new way to read or write single bit like bit fields structure in in g2553? Or should i write the header file by myself?
P1DIR_bit.P3 = 1;
P1DIR_bit.P4 = 0;
P1DIR_bit.P5 = 1;
P1DIR_bit.P6 = 1;
P1DIR_bit.P7 = 0;
With msp430g2553.h, you can do the same by:
P1DIR |= BIT3+BIT5+BIT6;
P1DIR &= ~(BIT4+BIT7);
BTW, io430g2553 has 2796 lines while msp430g2553.h has 986 lines.
---In m..., wrote:
The deprecated header file io430g2553.h has those definitions. Using |= to set bits and &= to clear bits instead are more efficient. You can also use ^= to flip bits.
---In m..., wrote:
Hi! I am new and start learning MSP430G2553. And i read a book named "MSP430 Microcontroller Basics" in chapter3.2. The book introduce the bit fields structure for the header file. But i can't find the bit fields definition in msp430g2553 header file. And it cause me a problem if i want to read or write the single bit of the register. Is there any new way to read or write single bit like bit fields structure in in g2553? Or should i write the header file by myself?
Reply by ●October 19, 20132013-10-19
I consider it a bad habit (and unnecessary) to use '+' for OR'ing
things
together. C already has a useful '|' operator for that. Save '+' for when
you mean addition.
Regards,
Mark
On Sat, Oct 19, 2013 at 7:46 PM, wrote:
> With io430g2553.h, you can use statements such as:
> P1DIR_bit.P3 = 1;
> P1DIR_bit.P4 = 0;
> P1DIR_bit.P5 = 1;
> P1DIR_bit.P6 = 1;
> P1DIR_bit.P7 = 0;
>
> With msp430g2553.h, you can do the same by:
> P1DIR |= BIT3+BIT5+BIT6;
> P1DIR &= ~(BIT4+BIT7);
>
> BTW, io430g2553 has 2796 lines while msp430g2553.h has 986 lines.
> ---In m..., wrote:
>
> The deprecated header file io430g2553.h has those definitions. Using |> to set bits and &= to clear bits instead are more efficient. You can also
> use ^= to flip bits.
> ---In m..., wrote:
>
> Hi! I am new and start learning MSP430G2553. And i read a book named
> "MSP430 Microcontroller Basics" in chapter3.2. The book introduce the bit
> fields structure for the header file. But i can't find the bit fields
> definition in msp430g2553 header file. And it cause me a problem if i want
> to read or write the single bit of the register. Is there any new way to
> read or write single bit like bit fields structure in in g2553? Or should i
> write the header file by myself?
--
Regards,
Mark
markrages@gmail
together. C already has a useful '|' operator for that. Save '+' for when
you mean addition.
Regards,
Mark
On Sat, Oct 19, 2013 at 7:46 PM, wrote:
> With io430g2553.h, you can use statements such as:
> P1DIR_bit.P3 = 1;
> P1DIR_bit.P4 = 0;
> P1DIR_bit.P5 = 1;
> P1DIR_bit.P6 = 1;
> P1DIR_bit.P7 = 0;
>
> With msp430g2553.h, you can do the same by:
> P1DIR |= BIT3+BIT5+BIT6;
> P1DIR &= ~(BIT4+BIT7);
>
> BTW, io430g2553 has 2796 lines while msp430g2553.h has 986 lines.
> ---In m..., wrote:
>
> The deprecated header file io430g2553.h has those definitions. Using |> to set bits and &= to clear bits instead are more efficient. You can also
> use ^= to flip bits.
> ---In m..., wrote:
>
> Hi! I am new and start learning MSP430G2553. And i read a book named
> "MSP430 Microcontroller Basics" in chapter3.2. The book introduce the bit
> fields structure for the header file. But i can't find the bit fields
> definition in msp430g2553 header file. And it cause me a problem if i want
> to read or write the single bit of the register. Is there any new way to
> read or write single bit like bit fields structure in in g2553? Or should i
> write the header file by myself?
--
Regards,
Mark
markrages@gmail
Reply by ●October 20, 20132013-10-20
But is better to use:
P1DIR |= BIT3|BIT5|BIT6;
P1DIR &= ~(BIT4|BIT7);
To avoid errors like using the same bit twice and getting an erroneos value.
--Paulo Ricardo
o...@yahoo.com escreveu:
>With io430g2553.h, you can use statements such as:
>P1DIR_bit.P3 = 1;
>P1DIR_bit.P4 = 0;
>P1DIR_bit.P5 = 1;
>P1DIR_bit.P6 = 1;
>P1DIR_bit.P7 = 0;
>
>With msp430g2553.h, you can do the same by:
>P1DIR |= BIT3+BIT5+BIT6;
>P1DIR &= ~(BIT4+BIT7);
>
>BTW, io430g2553 has 2796 lines while msp430g2553.h has 986 lines.
>
>---In m..., wrote:
>
>The deprecated header file io430g2553.h has those definitions. Using
>|= to set bits and &= to clear bits instead are more efficient. You can
>also use ^= to flip bits.
>
>---In m..., wrote:
>
>Hi! I am new and start learning MSP430G2553. And i read a book named
>"MSP430 Microcontroller Basics" in chapter3.2. The book introduce the
>bit fields structure for the header file. But i can't find the bit
>fields definition in msp430g2553 header file. And it cause me a problem
>if i want to read or write the single bit of the register. Is there any
>new way to read or write single bit like bit fields structure in in
>g2553? Or should i write the header file by myself?
>
--
E-mail enviado do meu celular Android usando K-9 Mail. Por favor, desculpe minha brevidade.
P1DIR |= BIT3|BIT5|BIT6;
P1DIR &= ~(BIT4|BIT7);
To avoid errors like using the same bit twice and getting an erroneos value.
--Paulo Ricardo
o...@yahoo.com escreveu:
>With io430g2553.h, you can use statements such as:
>P1DIR_bit.P3 = 1;
>P1DIR_bit.P4 = 0;
>P1DIR_bit.P5 = 1;
>P1DIR_bit.P6 = 1;
>P1DIR_bit.P7 = 0;
>
>With msp430g2553.h, you can do the same by:
>P1DIR |= BIT3+BIT5+BIT6;
>P1DIR &= ~(BIT4+BIT7);
>
>BTW, io430g2553 has 2796 lines while msp430g2553.h has 986 lines.
>
>---In m..., wrote:
>
>The deprecated header file io430g2553.h has those definitions. Using
>|= to set bits and &= to clear bits instead are more efficient. You can
>also use ^= to flip bits.
>
>---In m..., wrote:
>
>Hi! I am new and start learning MSP430G2553. And i read a book named
>"MSP430 Microcontroller Basics" in chapter3.2. The book introduce the
>bit fields structure for the header file. But i can't find the bit
>fields definition in msp430g2553 header file. And it cause me a problem
>if i want to read or write the single bit of the register. Is there any
>new way to read or write single bit like bit fields structure in in
>g2553? Or should i write the header file by myself?
>
--
E-mail enviado do meu celular Android usando K-9 Mail. Por favor, desculpe minha brevidade.
Reply by ●October 20, 20132013-10-20
Also if it is needed by the hardware, you can simultaneously set, clear
and no-op bits in the same register by:
P1DIR = ((P1DIR & ~(BIT4 | BIT7)) | (BIT3 | BIT5 | BIT6));
Regards
-Bill Knight
R O SoftWare
On 10/19/2013 8:46 PM, o...@yahoo.com wrote:
> With io430g2553.h, you can use statements such as:
> P1DIR_bit.P3 = 1;
> P1DIR_bit.P4 = 0;
> P1DIR_bit.P5 = 1;
> P1DIR_bit.P6 = 1;
> P1DIR_bit.P7 = 0;
>
> With msp430g2553.h, you can do the same by:
> P1DIR |= BIT3+BIT5+BIT6;
> P1DIR &= ~(BIT4+BIT7);
>
> BTW, io430g2553 has 2796 lines while msp430g2553.h has 986 lines.
>
> ---In m..., wrote:
>
> The deprecated header file io430g2553.h has those definitions. Using
> |= to set bits and &= to clear bits instead are more efficient. You
> can also use ^= to flip bits.
>
> ---In m..., wrote:
>
> Hi! I am new and start learning MSP430G2553. And i read a book named
> "MSP430 Microcontroller B asics" in chapter3.2. The book introduce the
> bit fields structure for the header file. But i can't find the bit
> fields definition in msp430g2553 header file. And it cause me a
> problem if i want to read or write the single bit of the register. Is
> there any new way to read or write single bit like bit fields
> structure in in g2553? Or should i write the header file by myself?
>
and no-op bits in the same register by:
P1DIR = ((P1DIR & ~(BIT4 | BIT7)) | (BIT3 | BIT5 | BIT6));
Regards
-Bill Knight
R O SoftWare
On 10/19/2013 8:46 PM, o...@yahoo.com wrote:
> With io430g2553.h, you can use statements such as:
> P1DIR_bit.P3 = 1;
> P1DIR_bit.P4 = 0;
> P1DIR_bit.P5 = 1;
> P1DIR_bit.P6 = 1;
> P1DIR_bit.P7 = 0;
>
> With msp430g2553.h, you can do the same by:
> P1DIR |= BIT3+BIT5+BIT6;
> P1DIR &= ~(BIT4+BIT7);
>
> BTW, io430g2553 has 2796 lines while msp430g2553.h has 986 lines.
>
> ---In m..., wrote:
>
> The deprecated header file io430g2553.h has those definitions. Using
> |= to set bits and &= to clear bits instead are more efficient. You
> can also use ^= to flip bits.
>
> ---In m..., wrote:
>
> Hi! I am new and start learning MSP430G2553. And i read a book named
> "MSP430 Microcontroller B asics" in chapter3.2. The book introduce the
> bit fields structure for the header file. But i can't find the bit
> fields definition in msp430g2553 header file. And it cause me a
> problem if i want to read or write the single bit of the register. Is
> there any new way to read or write single bit like bit fields
> structure in in g2553? Or should i write the header file by myself?
>
Reply by ●October 20, 20132013-10-20
Bitfields are not recommended for most applications. As stated in MISRA,
its implementation is not well defined so you can get different results
among different compilers.
On Sun, Oct 20, 2013 at 10:55 AM, Bill Knight wrote:
> **
> Also if it is needed by the hardware, you can simultaneously set, clear
> and no-op bits in the same register by:
>
> P1DIR = ((P1DIR & ~(BIT4 | BIT7)) | (BIT3 | BIT5 | BIT6));
>
> Regards
> -Bill Knight
> R O SoftWare
>
> On 10/19/2013 8:46 PM, o...@yahoo.com wrote:
>
> With io430g2553.h, you can use statements such as:
> P1DIR_bit.P3 = 1;
> P1DIR_bit.P4 = 0;
> P1DIR_bit.P5 = 1;
> P1DIR_bit.P6 = 1;
> P1DIR_bit.P7 = 0;
>
> With msp430g2553.h, you can do the same by:
> P1DIR |= BIT3+BIT5+BIT6;
> P1DIR &= ~(BIT4+BIT7);
>
> BTW, io430g2553 has 2796 lines while msp430g2553.h has 986 lines.
> ---In m..., wrote:
>
> The deprecated header file io430g2553.h has those definitions. Using |> to set bits and &= to clear bits instead are more efficient. You can also
> use ^= to flip bits.
> ---In m..., wrote:
>
> Hi! I am new and start learning MSP430G2553. And i read a book named
> "MSP430 Microcontroller B asics" in chapter3.2. The book introduce the bit
> fields structure for the header file. But i can't find the bit fields
> definition in msp430g2553 header file. And it cause me a problem if i want
> to read or write the single bit of the register. Is there any new way to
> read or write single bit like bit fields structure in in g2553? Or should i
> write the header file by myself?
>
>
--
Lu Filipe Rossi
Electrical Engineer
Biomechatronics Lab. / Grupo de Sensores Integreis e Sistemas
Escola Politnica
Universidade de S Paulo
Cel. +55 (11) 97662-9234
its implementation is not well defined so you can get different results
among different compilers.
On Sun, Oct 20, 2013 at 10:55 AM, Bill Knight wrote:
> **
> Also if it is needed by the hardware, you can simultaneously set, clear
> and no-op bits in the same register by:
>
> P1DIR = ((P1DIR & ~(BIT4 | BIT7)) | (BIT3 | BIT5 | BIT6));
>
> Regards
> -Bill Knight
> R O SoftWare
>
> On 10/19/2013 8:46 PM, o...@yahoo.com wrote:
>
> With io430g2553.h, you can use statements such as:
> P1DIR_bit.P3 = 1;
> P1DIR_bit.P4 = 0;
> P1DIR_bit.P5 = 1;
> P1DIR_bit.P6 = 1;
> P1DIR_bit.P7 = 0;
>
> With msp430g2553.h, you can do the same by:
> P1DIR |= BIT3+BIT5+BIT6;
> P1DIR &= ~(BIT4+BIT7);
>
> BTW, io430g2553 has 2796 lines while msp430g2553.h has 986 lines.
> ---In m..., wrote:
>
> The deprecated header file io430g2553.h has those definitions. Using |> to set bits and &= to clear bits instead are more efficient. You can also
> use ^= to flip bits.
> ---In m..., wrote:
>
> Hi! I am new and start learning MSP430G2553. And i read a book named
> "MSP430 Microcontroller B asics" in chapter3.2. The book introduce the bit
> fields structure for the header file. But i can't find the bit fields
> definition in msp430g2553 header file. And it cause me a problem if i want
> to read or write the single bit of the register. Is there any new way to
> read or write single bit like bit fields structure in in g2553? Or should i
> write the header file by myself?
>
>
--
Lu Filipe Rossi
Electrical Engineer
Biomechatronics Lab. / Grupo de Sensores Integreis e Sistemas
Escola Politnica
Universidade de S Paulo
Cel. +55 (11) 97662-9234
Reply by ●October 20, 20132013-10-20
Bitfields are key to embedded systems. That is what a microcontroller
does. hence if C isn't suited for bitfields it follows that it isn't
suited for embedded microcontroller designs.
Al
On 21/10/2013 7:13 AM, Luis Filipe Rossi wrote:
> Bitfields are not recommended for most applications. As stated in
> MISRA, its implementation is not well defined so you can get different
> results among different compilers.
> On Sun, Oct 20, 2013 at 10:55 AM, Bill Knight > > wrote:
>
> Also if it is needed by the hardware, you can simultaneously set,
> clear and no-op bits in the same register by:
>
> P1DIR = ((P1DIR & ~(BIT4 | BIT7)) | (BIT3 | BIT5 | BIT6));
>
> Regards
> -Bill Knight
> R O SoftWare
>
> On 10/19/2013 8:46 PM, o...@yahoo.com
> wrote:
>> With io430g2553.h, you can use statements such as:
>> P1DIR_bit.P3 = 1;
>> P1DIR_bit.P4 = 0;
>> P1DIR_bit.P5 = 1;
>> P1DIR_bit.P6 = 1;
>> P1DIR_bit.P7 = 0;
>>
>> With msp430g2553.h, you can do the same by:
>> P1DIR |= BIT3+BIT5+BIT6;
>> P1DIR &= ~(BIT4+BIT7);
>>
>> BTW, io430g2553 has 2796 lines while msp430g2553.h has 986 lines.
>>
>> ---In m... ,
>> wrote:
>>
>> The deprecated header file io430g2553.h has those definitions.
>> Using |= to set bits and &= to clear bits instead are more
>> efficient. You can also use ^= to flip bits.
>>
>> ---In m... ,
>> wrote:
>>
>> Hi! I am new and start learning MSP430G2553. And i read a book
>> named "MSP430 Microcontroller B asics" in chapter3.2. The book
>> introduce the bit fields structure for the header file. But i
>> can't find the bit fields definition in msp430g2553 header file.
>> And it cause me a problem if i want to read or write the single
>> bit of the register. Is there any new way to read or write single
>> bit like bit fields structure in in g2553? Or should i write the
>> header file by myself?
> --
> Lu Filipe Rossi
> Electrical Engineer
> Biomechatronics Lab. / Grupo de Sensores Integreis e Sistemas
> Escola Politnica
> Universidade de S Paulo
> Cel. +55 (11) 97662-9234
>
does. hence if C isn't suited for bitfields it follows that it isn't
suited for embedded microcontroller designs.
Al
On 21/10/2013 7:13 AM, Luis Filipe Rossi wrote:
> Bitfields are not recommended for most applications. As stated in
> MISRA, its implementation is not well defined so you can get different
> results among different compilers.
> On Sun, Oct 20, 2013 at 10:55 AM, Bill Knight > > wrote:
>
> Also if it is needed by the hardware, you can simultaneously set,
> clear and no-op bits in the same register by:
>
> P1DIR = ((P1DIR & ~(BIT4 | BIT7)) | (BIT3 | BIT5 | BIT6));
>
> Regards
> -Bill Knight
> R O SoftWare
>
> On 10/19/2013 8:46 PM, o...@yahoo.com
> wrote:
>> With io430g2553.h, you can use statements such as:
>> P1DIR_bit.P3 = 1;
>> P1DIR_bit.P4 = 0;
>> P1DIR_bit.P5 = 1;
>> P1DIR_bit.P6 = 1;
>> P1DIR_bit.P7 = 0;
>>
>> With msp430g2553.h, you can do the same by:
>> P1DIR |= BIT3+BIT5+BIT6;
>> P1DIR &= ~(BIT4+BIT7);
>>
>> BTW, io430g2553 has 2796 lines while msp430g2553.h has 986 lines.
>>
>> ---In m... ,
>> wrote:
>>
>> The deprecated header file io430g2553.h has those definitions.
>> Using |= to set bits and &= to clear bits instead are more
>> efficient. You can also use ^= to flip bits.
>>
>> ---In m... ,
>> wrote:
>>
>> Hi! I am new and start learning MSP430G2553. And i read a book
>> named "MSP430 Microcontroller B asics" in chapter3.2. The book
>> introduce the bit fields structure for the header file. But i
>> can't find the bit fields definition in msp430g2553 header file.
>> And it cause me a problem if i want to read or write the single
>> bit of the register. Is there any new way to read or write single
>> bit like bit fields structure in in g2553? Or should i write the
>> header file by myself?
> --
> Lu Filipe Rossi
> Electrical Engineer
> Biomechatronics Lab. / Grupo de Sensores Integreis e Sistemas
> Escola Politnica
> Universidade de S Paulo
> Cel. +55 (11) 97662-9234
>
Reply by ●October 20, 20132013-10-20
I found a bug once in MSP430 Grace where it meant to logical OR bits, but
used addition '+' - and happened to have the same bit set in both operands.
Not good.
If you want logical OR, use '|', the logical OR operator :-)
Also, bit-fields for hardware access are a bad idea - they depend on
compiler
behavior which is not defined in the standard and thus non-portable. Using
bit-masks is portable.
Dana K6JQ
On Sat, Oct 19, 2013 at 7:45 PM, Mark Rages wrote:
> **
> I consider it a bad habit (and unnecessary) to use '+' for OR'ing things
> together. C already has a useful '|' operator for that. Save '+' for when
> you mean addition.
>
> Regards,
> Mark
>
> On Sat, Oct 19, 2013 at 7:46 PM, wrote:
>
>> With io430g2553.h, you can use statements such as:
>> P1DIR_bit.P3 = 1;
>> P1DIR_bit.P4 = 0;
>> P1DIR_bit.P5 = 1;
>> P1DIR_bit.P6 = 1;
>> P1DIR_bit.P7 = 0;
>>
>> With msp430g2553.h, you can do the same by:
>> P1DIR |= BIT3+BIT5+BIT6;
>> P1DIR &= ~(BIT4+BIT7);
>>
>> BTW, io430g2553 has 2796 lines while msp430g2553.h has 986 lines.
>> ---In m..., wrote:
>>
>> The deprecated header file io430g2553.h has those definitions. Using |>> to set bits and &= to clear bits instead are more efficient. You can also
>> use ^= to flip bits.
>> ---In m..., wrote:
>>
>> Hi! I am new and start learning MSP430G2553. And i read a book named
>> "MSP430 Microcontroller Basics" in chapter3.2. The book introduce the bit
>> fields structure for the header file. But i can't find the bit fields
>> definition in msp430g2553 header file. And it cause me a problem if i want
>> to read or write the single bit of the register. Is there any new way to
>> read or write single bit like bit fields structure in in g2553? Or should i
>> write the header file by myself?
>>
> --
> Regards,
> Mark
> markrages@gmail
>
>
>
used addition '+' - and happened to have the same bit set in both operands.
Not good.
If you want logical OR, use '|', the logical OR operator :-)
Also, bit-fields for hardware access are a bad idea - they depend on
compiler
behavior which is not defined in the standard and thus non-portable. Using
bit-masks is portable.
Dana K6JQ
On Sat, Oct 19, 2013 at 7:45 PM, Mark Rages wrote:
> **
> I consider it a bad habit (and unnecessary) to use '+' for OR'ing things
> together. C already has a useful '|' operator for that. Save '+' for when
> you mean addition.
>
> Regards,
> Mark
>
> On Sat, Oct 19, 2013 at 7:46 PM, wrote:
>
>> With io430g2553.h, you can use statements such as:
>> P1DIR_bit.P3 = 1;
>> P1DIR_bit.P4 = 0;
>> P1DIR_bit.P5 = 1;
>> P1DIR_bit.P6 = 1;
>> P1DIR_bit.P7 = 0;
>>
>> With msp430g2553.h, you can do the same by:
>> P1DIR |= BIT3+BIT5+BIT6;
>> P1DIR &= ~(BIT4+BIT7);
>>
>> BTW, io430g2553 has 2796 lines while msp430g2553.h has 986 lines.
>> ---In m..., wrote:
>>
>> The deprecated header file io430g2553.h has those definitions. Using |>> to set bits and &= to clear bits instead are more efficient. You can also
>> use ^= to flip bits.
>> ---In m..., wrote:
>>
>> Hi! I am new and start learning MSP430G2553. And i read a book named
>> "MSP430 Microcontroller Basics" in chapter3.2. The book introduce the bit
>> fields structure for the header file. But i can't find the bit fields
>> definition in msp430g2553 header file. And it cause me a problem if i want
>> to read or write the single bit of the register. Is there any new way to
>> read or write single bit like bit fields structure in in g2553? Or should i
>> write the header file by myself?
>>
> --
> Regards,
> Mark
> markrages@gmail
>
>
>