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.

MSP430FR2355: register addressing

Part Number: MSP430FR2355

I have a function (see below) that although a little ugly/unclean works well....What I don't understand after reading the datasheet (Table 6-48) is that all the registers are on even boundaries yet when I try and implement :

*(k + (2* shft + 2)) for the highlighted code below I do NOT get the correct register for updating....Can someone tell me what I am missing?

void pwmRemote(volatile char p, volatile boolean gate)
{
    volatile unsigned int *k;
    unsigned int shft;

    k = &TB3CTL;  //base address to TB3 set
    for (shft = 1; shft < 7; shft++) {
        if (gate) {
            if ((p >> shft) & BIT0)
                *(k + (2 + shft - 1)) |= OUTMOD_3;
            else {
                P6OUT &= ~(BIT0 << shft);
                *(k + (2 + shft - 1)) &= ~(BIT7 | BIT6 | BIT5);
            }
        }
        else {
            TB3CCR0 = 65535;
            if ((p >> shft) & BIT0) {
                *(k + (shft + 1)) |= OUTMOD_7;
                *(k + (shft + 9)) = 6554;
            }
            else {
                P6OUT &= ~(BIT0 << shft);
                *(k + (shft + 1)) &= ~(BIT7 | BIT6 | BIT5);
                *(k + (shft + 9)) = 327;
            }
        }
    }
}

**Attention** This is a public forum