MSP430FG4618 ADC12 Memory Register Query

Discussion in 'Embedded Systems and Microcontrollers' started by rshrivas, Jan 15, 2011.

  1. rshrivas

    Thread Starter New Member

    Jan 15, 2011
    2
    0
    Hi,



    I am new to MSP430 controller and I presently using SimpliciTI protocol for transmitting ADC samples wirelessly from the End Device to the Access Point. Now the ADC12 has a memory register which is 16 bit (4 MSB bits 0) and this data is read into a 16 bit integer array as shown below.

    uint16_t ch1[100];

    uint16_t ch2[100];

    for ( int t=0; t<100 ; t++)
    {
    ADC12CTL0 |= ENC; // Enable conversions
    ADC12CTL0 |= ADC12SC; // Start conversions
    while((!(ADC12IFG &0x02)==1));
    ch1[t] = ADC12MEM0;
    ch2[t] = ADC12MEM1;
    }



    But in order to transmit the data using the "smplStatus_t SMPL_Send(linkID_t lid, uint8 *msg, uint8 len)" command I can only transfer 8 bit array (string) and not 16 bit array. But the ADC memory register is 16 bit so need to put the 1st 8 bits of the MSB in one array and the 8 bits of the LSB in another array so that I can easily transmit the two 8 bit arrays easily. But being new to MSP430 programming I have no idea how can I do that.

    Please let me know your suggestions.

    Regards

    Ravi
     
  2. rshrivas

    Thread Starter New Member

    Jan 15, 2011
    2
    0
    I though of doing it this way as shown below.. It is correct???

    uint8_t temp1 = (0xFF00 & ADC12MEM0)/256; // For the 8 MSB bits
    uint8_t temp2 = (0x00FF & ADC12MEM0); // For the 8 LSB bits
     
Loading...