MSP430 DriverLib for MSP430i2xx Devices  2.91.13.01
sd24

Functions

void SD24_init (uint16_t baseAddress, uint8_t referenceSelect)
 Initializes the SD24 Module. More...
 
void SD24_initConverter (uint16_t baseAddress, uint16_t converter, uint16_t conversionMode)
 Configure SD24 converter. More...
 
void SD24_initConverterAdvanced (uint16_t baseAddress, SD24_initConverterAdvancedParam *param)
 Configure SD24 converter - Advanced Configure. More...
 
void SD24_setConverterDataFormat (uint16_t baseAddress, uint16_t converter, uint16_t dataFormat)
 Set SD24 converter data format. More...
 
void SD24_startConverterConversion (uint16_t baseAddress, uint8_t converter)
 Start Conversion for Converter. More...
 
void SD24_stopConverterConversion (uint16_t baseAddress, uint8_t converter)
 Stop Conversion for Converter. More...
 
void SD24_setInputChannel (uint16_t baseAddress, uint8_t converter, uint8_t inputChannel)
 Configures the input channel. More...
 
void SD24_setInterruptDelay (uint16_t baseAddress, uint8_t converter, uint8_t interruptDelay)
 Configures the delay for an interrupt to trigger. More...
 
void SD24_setOversampling (uint16_t baseAddress, uint8_t converter, uint16_t oversampleRatio)
 Configures the oversampling ratio for a converter. More...
 
void SD24_setGain (uint16_t baseAddress, uint8_t converter, uint8_t gain)
 Configures the gain for the converter. More...
 
uint32_t SD24_getResults (uint16_t baseAddress, uint8_t converter)
 Returns the results for a converter. More...
 
uint16_t SD24_getHighWordResults (uint16_t baseAddress, uint8_t converter)
 Returns the high word results for a converter. More...
 
void SD24_enableInterrupt (uint16_t baseAddress, uint8_t converter, uint16_t mask)
 Enables interrupts for the SD24 Module. More...
 
void SD24_disableInterrupt (uint16_t baseAddress, uint8_t converter, uint16_t mask)
 Disables interrupts for the SD24 Module. More...
 
void SD24_clearInterrupt (uint16_t baseAddress, uint8_t converter, uint16_t mask)
 Clears interrupts for the SD24 Module. More...
 
uint16_t SD24_getInterruptStatus (uint16_t baseAddress, uint8_t converter, uint16_t mask)
 Returns the interrupt status for the SD24 Module. More...
 

Detailed Description

Function Documentation

§ SD24_clearInterrupt()

void SD24_clearInterrupt ( uint16_t  baseAddress,
uint8_t  converter,
uint16_t  mask 
)

Clears interrupts for the SD24 Module.

This function clears interrupt flags for the SD24 module.

Parameters
baseAddressis the base address of the SD24 module.
converteris the selected converter. Valid values are:
  • SD24_CONVERTER_0
  • SD24_CONVERTER_1
  • SD24_CONVERTER_2
  • SD24_CONVERTER_3
maskis the bit mask of the converter interrupt sources to clear. Mask value is the logical OR of any of the following:
  • SD24_CONVERTER_INTERRUPT
  • SD24_CONVERTER_OVERFLOW_INTERRUPT
    Modified bits are SD24OVIFGx of SD24BIFG register.
Returns
None

§ SD24_disableInterrupt()

void SD24_disableInterrupt ( uint16_t  baseAddress,
uint8_t  converter,
uint16_t  mask 
)

Disables interrupts for the SD24 Module.

This function disables interrupts for the SD24 module.

Parameters
baseAddressis the base address of the SD24 module.
converteris the selected converter. Valid values are:
  • SD24_CONVERTER_0
  • SD24_CONVERTER_1
  • SD24_CONVERTER_2
  • SD24_CONVERTER_3
maskis the bit mask of the converter interrupt sources to be disabled. Mask value is the logical OR of any of the following:
  • SD24_CONVERTER_INTERRUPT
  • SD24_CONVERTER_OVERFLOW_INTERRUPT
    Modified bits are SD24OVIEx of SD24BIE register.

Modified bits of SD24BIE register.

Returns
None

§ SD24_enableInterrupt()

void SD24_enableInterrupt ( uint16_t  baseAddress,
uint8_t  converter,
uint16_t  mask 
)

Enables interrupts for the SD24 Module.

This function enables interrupts for the SD24 module. Does not clear interrupt flags.

Parameters
baseAddressis the base address of the SD24 module.
converteris the selected converter. Valid values are:
  • SD24_CONVERTER_0
  • SD24_CONVERTER_1
  • SD24_CONVERTER_2
  • SD24_CONVERTER_3
maskis the bit mask of the converter interrupt sources to be enabled. Mask value is the logical OR of any of the following:
  • SD24_CONVERTER_INTERRUPT
  • SD24_CONVERTER_OVERFLOW_INTERRUPT
    Modified bits are SD24OVIEx of SD24BIE register.
Returns
None

§ SD24_getHighWordResults()

uint16_t SD24_getHighWordResults ( uint16_t  baseAddress,
uint8_t  converter 
)

Returns the high word results for a converter.

This function gets the upper 16-bit result from the SD24MEMx register and returns it.

Parameters
baseAddressis the base address of the SD24 module.
converterselects the converter who's results will be returned Valid values are:
  • SD24_CONVERTER_0
  • SD24_CONVERTER_1
  • SD24_CONVERTER_2
  • SD24_CONVERTER_3
Returns
Result of conversion

§ SD24_getInterruptStatus()

uint16_t SD24_getInterruptStatus ( uint16_t  baseAddress,
uint8_t  converter,
uint16_t  mask 
)

Returns the interrupt status for the SD24 Module.

This function returns interrupt flag statuses for the SD24 module.

Parameters
baseAddressis the base address of the SD24 module.
converteris the selected converter. Valid values are:
  • SD24_CONVERTER_0
  • SD24_CONVERTER_1
  • SD24_CONVERTER_2
  • SD24_CONVERTER_3
maskis the bit mask of the converter interrupt sources to return. Mask value is the logical OR of any of the following:
  • SD24_CONVERTER_INTERRUPT
  • SD24_CONVERTER_OVERFLOW_INTERRUPT
Returns
Logical OR of any of the following:
  • SD24_CONVERTER_INTERRUPT
  • SD24_CONVERTER_OVERFLOW_INTERRUPT
    indicating the status of the masked interrupts

§ SD24_getResults()

uint32_t SD24_getResults ( uint16_t  baseAddress,
uint8_t  converter 
)

Returns the results for a converter.

This function gets the results from the SD24MEMx register for upper 16-bit and lower 16-bit results, and concatenates them to form a long. The actual result is a maximum 24 bits.

Parameters
baseAddressis the base address of the SD24 module.
converterselects the converter who's results will be returned Valid values are:
  • SD24_CONVERTER_0
  • SD24_CONVERTER_1
  • SD24_CONVERTER_2
  • SD24_CONVERTER_3
Returns
Result of conversion

§ SD24_init()

void SD24_init ( uint16_t  baseAddress,
uint8_t  referenceSelect 
)

Initializes the SD24 Module.

This function initializes the SD24 module sigma-delta analog-to-digital conversions. Specifically the function sets up the clock source for the SD24 core to use for conversions. Upon completion of the initialization the SD24 interrupt registers will be reset and the given parameters will be set. The converter configuration settings are independent of this function.

Parameters
baseAddressis the base address of the SD24 module.
referenceSelectselects the reference source for the SD24 core Valid values are:
  • SD24_REF_EXTERNAL [Default]
  • SD24_REF_INTERNAL
    Modified bits are SD24REFS of SD24BCTL0 register.
Returns
None

§ SD24_initConverter()

void SD24_initConverter ( uint16_t  baseAddress,
uint16_t  converter,
uint16_t  conversionMode 
)

Configure SD24 converter.

This function initializes a converter of the SD24 module. Upon completion the converter will be ready for a conversion and can be started with the SD24_startConverterConversion(). Additional configuration such as data format can be configured in SD24_setConverterDataFormat().

Parameters
baseAddressis the base address of the SD24 module.
converterselects the converter that will be configured. Check check datasheet for available converters on device. Valid values are:
  • SD24_CONVERTER_0
  • SD24_CONVERTER_1
  • SD24_CONVERTER_2
  • SD24_CONVERTER_3
conversionModedetermines whether the converter will do continuous samples or a single sample Valid values are:
  • SD24_CONTINUOUS_MODE [Default]
  • SD24_SINGLE_MODE
    Modified bits are SD24SNGL of SD24CCTLx register.
Returns
None

§ SD24_initConverterAdvanced()

void SD24_initConverterAdvanced ( uint16_t  baseAddress,
SD24_initConverterAdvancedParam param 
)

Configure SD24 converter - Advanced Configure.

This function initializes a converter of the SD24 module. Upon completion the converter will be ready for a conversion and can be started with the SD24_startConverterConversion().

Parameters
baseAddressis the base address of the SD24 module.
paramis the pointer to struct for converter advanced configuration.
Returns
None

References SD24_initConverterAdvancedParam::conversionMode, SD24_initConverterAdvancedParam::converter, SD24_initConverterAdvancedParam::dataFormat, SD24_initConverterAdvancedParam::gain, SD24_initConverterAdvancedParam::groupEnable, SD24_initConverterAdvancedParam::inputChannel, SD24_initConverterAdvancedParam::interruptDelay, and SD24_initConverterAdvancedParam::oversampleRatio.

§ SD24_setConverterDataFormat()

void SD24_setConverterDataFormat ( uint16_t  baseAddress,
uint16_t  converter,
uint16_t  dataFormat 
)

Set SD24 converter data format.

This function sets the converter format so that the resulting data can be viewed in either binary or 2's complement.

Parameters
baseAddressis the base address of the SD24 module.
converterselects the converter that will be configured. Check check datasheet for available converters on device. Valid values are:
  • SD24_CONVERTER_0
  • SD24_CONVERTER_1
  • SD24_CONVERTER_2
  • SD24_CONVERTER_3
dataFormatselects how the data format of the results Valid values are:
  • SD24_DATA_FORMAT_BINARY [Default]
  • SD24_DATA_FORMAT_2COMPLEMENT
    Modified bits are SD24DFx of SD24CCTLx register.
Returns
None

§ SD24_setGain()

void SD24_setGain ( uint16_t  baseAddress,
uint8_t  converter,
uint8_t  gain 
)

Configures the gain for the converter.

This function configures the gain for a single converter.

Parameters
baseAddressis the base address of the SD24 module.
converterselects the converter that will be configured Valid values are:
  • SD24_CONVERTER_0
  • SD24_CONVERTER_1
  • SD24_CONVERTER_2
  • SD24_CONVERTER_3
gainselects the gain for the converter Valid values are:
  • SD24_GAIN_1 [Default]
  • SD24_GAIN_2
  • SD24_GAIN_4
  • SD24_GAIN_8
  • SD24_GAIN_16
    Modified bits are SD24GAINx of SD24INCTLx register.
Returns
None

§ SD24_setInputChannel()

void SD24_setInputChannel ( uint16_t  baseAddress,
uint8_t  converter,
uint8_t  inputChannel 
)

Configures the input channel.

This function configures the input channel. For MSP430i2xx devices, users can choose either analog input or internal temperature input.

Parameters
baseAddressis the base address of the SD24 module.
converterselects the converter that will be configured Valid values are:
  • SD24_CONVERTER_0
  • SD24_CONVERTER_1
  • SD24_CONVERTER_2
  • SD24_CONVERTER_3
inputChannelselects oversampling ratio for the converter Valid values are:
  • SD24_INPUT_CH_ANALOG
  • SD24_INPUT_CH_TEMPERATURE
    Modified bits are SD24INCHx of SD24INCTLx register.
Returns
None

§ SD24_setInterruptDelay()

void SD24_setInterruptDelay ( uint16_t  baseAddress,
uint8_t  converter,
uint8_t  interruptDelay 
)

Configures the delay for an interrupt to trigger.

This function configures the delay for the first interrupt service request for the corresponding converter. This feature delays the interrupt request for a completed conversion by up to four conversion cycles allowing the digital filter to settle prior to generating an interrupt request.

Parameters
baseAddressis the base address of the SD24 module.
converterselects the converter that will be stopped Valid values are:
  • SD24_CONVERTER_0
  • SD24_CONVERTER_1
  • SD24_CONVERTER_2
  • SD24_CONVERTER_3
interruptDelayselects the delay for the interrupt Valid values are:
  • SD24_FIRST_SAMPLE_INTERRUPT
  • SD24_FOURTH_SAMPLE_INTERRUPT [Default]
    Modified bits are SD24INTDLYx of SD24INCTLx register.
Returns
None

§ SD24_setOversampling()

void SD24_setOversampling ( uint16_t  baseAddress,
uint8_t  converter,
uint16_t  oversampleRatio 
)

Configures the oversampling ratio for a converter.

This function configures the oversampling ratio for a given converter.

Parameters
baseAddressis the base address of the SD24 module.
converterselects the converter that will be configured Valid values are:
  • SD24_CONVERTER_0
  • SD24_CONVERTER_1
  • SD24_CONVERTER_2
  • SD24_CONVERTER_3
oversampleRatioselects oversampling ratio for the converter Valid values are:
  • SD24_OVERSAMPLE_32
  • SD24_OVERSAMPLE_64
  • SD24_OVERSAMPLE_128
  • SD24_OVERSAMPLE_256
    Modified bits are SD24OSRx of SD24OSRx register.
Returns
None

§ SD24_startConverterConversion()

void SD24_startConverterConversion ( uint16_t  baseAddress,
uint8_t  converter 
)

Start Conversion for Converter.

This function starts a single converter.

Parameters
baseAddressis the base address of the SD24 module.
converterselects the converter that will be started Valid values are:
  • SD24_CONVERTER_0
  • SD24_CONVERTER_1
  • SD24_CONVERTER_2
  • SD24_CONVERTER_3
    Modified bits are SD24SC of SD24CCTLx register.
Returns
None

§ SD24_stopConverterConversion()

void SD24_stopConverterConversion ( uint16_t  baseAddress,
uint8_t  converter 
)

Stop Conversion for Converter.

This function stops a single converter.

Parameters
baseAddressis the base address of the SD24 module.
converterselects the converter that will be stopped Valid values are:
  • SD24_CONVERTER_0
  • SD24_CONVERTER_1
  • SD24_CONVERTER_2
  • SD24_CONVERTER_3
    Modified bits are SD24SC of SD24CCTLx register.
Returns
None

Copyright 2020, Texas Instruments Incorporated