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.

MSP430F6779A: Working with 32-bit SFRs.

Part Number: MSP430F6779A

I am trying to confirm the memory addressing for a 32-bit value copied from the SFRs.  Using the emeter library, I see the following reference to the 32-bit data from the SD24_B converter.  However, that doesn't align with my understanding of the addressing sequence for this processor.  If I read SD24BMEM0_32 will it be correct or reversed?

    int32Val = SD24BMEM0_32;

I searched the support forums and data sheets and could not resolve this.

Thanks!

Dan

Defines:

#define SD24BMEM0_32 SD24BMEMH0
#define SD24BMEM1_32 SD24BMEMH1

SFRs:

SFR_16BIT(SD24BMEML0);                        /* SD24B Channel 0 Conversion Memory Low word */
SFR_8BIT(SD24BMEML0_L);                       /* SD24B Channel 0 Conversion Memory Low word */
SFR_8BIT(SD24BMEML0_H);                       /* SD24B Channel 0 Conversion Memory Low word */
SFR_16BIT(SD24BMEMH0);                        /* SD24B Channel 0 Conversion Memory High Word */
SFR_8BIT(SD24BMEMH0_L);                       /* SD24B Channel 0 Conversion Memory High Word */
SFR_8BIT(SD24BMEMH0_H);                       /* SD24B Channel 0 Conversion Memory High Word */
SFR_16BIT(SD24BMEML1);                        /* SD24B Channel 1 Conversion Memory Low word */
SFR_8BIT(SD24BMEML1_L);                       /* SD24B Channel 1 Conversion Memory Low word */
SFR_8BIT(SD24BMEML1_H);                       /* SD24B Channel 1 Conversion Memory Low word */
SFR_16BIT(SD24BMEMH1);                        /* SD24B Channel 1 Conversion Memory High Word */
SFR_8BIT(SD24BMEMH1_L);                       /* SD24B Channel 1 Conversion Memory High Word */
SFR_8BIT(SD24BMEMH1_H);                       /* SD24B Channel 1 Conversion Memory High Word */
 
Memory Map:
00000850  SD24BMEML0                                                 
00000851  SD24BMEML0_H                                               
00000850  SD24BMEML0_L                                               
00000852  SD24BMEMH0                                                 
00000853  SD24BMEMH0_H                                               
00000852  SD24BMEMH0_L                                               
00000854  SD24BMEML1                                                 
00000855  SD24BMEML1_H                                               
00000854  SD24BMEML1_L                                               
00000856  SD24BMEMH1                                                 
00000857  SD24BMEMH1_H                                               
00000856  SD24BMEMH1_L                
  • Hi Dan,

    The MSP430's data memory and SD24 ADC peripheral are each 16-bit wide.  What this means is an ADC measurement is stored across two 16-bit words.

    As you can see from the memory map, SD24BEMEL0 = SD24BMEML0_L @ 850 holds the lower 16-bit result of the ADC measurement, and SD24BEMEL0_H @ 851 holds the higher 16-bit result of the ADC measurement.

    When assigned to a int32 value (which BTW is really two 16-bit data memory locations), the SD24BMEML0_L -> int32 (low word) and SD24BMEML0_H -> int32 (high word).  The compiler manages this for you.

    Does this answer your question?

  • Thanks Dennis.  I couldn't find any reference confirming that whether the MSP430 is big-endian or little-endian.  Also, you mixed up 8-bit and 16-bit values (SD24BMEML0_L is an 8-bit value), which confused me.

    To confirm, this should work properly:

        int32Val = SD24BMEM0_32; // covers 850-853

    Thanks.

    Dan

  • Yes, sorry about the confusion ;)

**Attention** This is a public forum