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.

CCS/MSP430F5529: Universal Serial Communication Interface - I2C mode - Transmitting Data Format

Part Number: MSP430F5529


Tool/software: Code Composer Studio

Hello,

In my project I need to use the I2C mode to transmit the data, which is a variable in decimal. Do I have to convert it to hex before transmitting?

Thank you.

  • The I²C module transmits bytes. What is encoded in these bytes does not matter.

    But the format of these bytes matter for the receiver. What software receives this data? What format does it expect?
  • Hello Clemens,

    Thank you for the reply. I have one more question.

    I want to develop only one short pulse once a push button is pressed and do not want the pulse to continue like PWM.
    Using MSP430F5529, I need to turn on P1.2 for 250 microseconds and then turn it off.

    Please see my code:

    #include <msp430F5529.h>

    int main() {
    WDTCTL = WDTPW + WDTHOLD;
    P1DIR |= BIT2;               //set P1.2 as output
    P1SEL |= BIT2;              //select timer function
    P1REN |= BIT1;             //enable P1.1 internal resistance
    P1OUT |= BIT1;               //pull-up resistance
    P1IE |= BIT1;                      //enable P1.1 interrupt
    P1IFG &= ~BIT1;          

      
    __bis_SR_register(LPM0_bits + GIE);    
    for(;;)
    {}
    }

    #pragma vector = PORT1_VECTOR
    __interrupt void PORT1_ISR(void)
    {
    /*Here I want a pulse with duty-cycle of 250us at the frequency of 150 Hz. So I found the period to be 660 us.
    To develop only one pulse and stop pwm, do I need to use OUTMOD_5 to reset it? How can I do that?
    */
    TA0CCR0 = 660;
    TA0CCTL1 = OUTMOD_7;
    TA0CCR1 = 2;
    TA0CTL = TASSEL_1 + MC_1 + TACLR;
    P1IFG &= ~BIT1;
    }

    Thank you so much for the help.

  • How precise must the 250 µs interval be?

    You can simply set the output, configure CCR0 for 250 µs, start TA0, and in the timer overflow interrupt, clear the output and stop the timer. (The timer output is not be needed.)

**Attention** This is a public forum