This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Regarding Initialization in Embedded C for MSP430F6779

Hi,

i have one Example code at where they define variable as below:

#define P4DIR_INIT  (BIT0 | BIT2)                               Q: Please comment on it, to understand code

Then use it for Direction configuration of Port 4

P4DIR |= P4DIR_INIT;                                                   Q: Please comment on it, to understand code

Thanks

  • #define P4DIR_INIT  (BIT0 | BIT2)

    This means, when I say P4DIR_INIT, I really mean (BIT0 | BIT2).

    Hence subsequently, when I say:

    P4DIR |= P4DIR_INIT;

    I really mean:

    P4DIR |= (BIT0 | BIT2);

    By the way, P4DIRBIT0, and BIT2 are not C keywords either. They are all defined somewhere else. As a matter of fact. one could have done the following instead:

    #define Direction_configuration_of_Port4 P4DIR |= 0x03;

    Then use it for Direction configuration of Port 4 with:

    Direction_configuration_of_Port4;

**Attention** This is a public forum