Digital-to-Analog Converter on TI MSP430
Summary: Explains how the digital-to-analog converter works on the MSP430.
The MSP430F169 is equipped with two digital to analog converters (DACs) on general I/O port 6. A DAC converts an unsigned integer into an analog voltage within the capacity of the MSP. As in all cases with the MSP, the complete details are found in the MSP430 Family User’s Guide from the Texas Instruments website www.ti.com.Voltage Range and Precision
Unlike the ADC on the MSP, the DACs have variable bit precision of either 8 or 12 bits. The range is also controllable as either one or three times the voltage reference. The voltage reference is also selectable. All bits for controlling voltage reference, scaling, and precision can be found in the DAC12 Control Register (DAC12_xCTL). In most cases, 12 bit precision is desirable.In the MSP430 architecture there are two general sources for a voltage reference: VeRef and Vref. VeRef is an externally supplied voltage, but Vref is generated by the MSP itself. Because the 226 board does not provide the MSP with a VeRef voltage, the only voltage reference available for the DAC and ADC is the Vref. This restricts the choices for the SREF bits of the DAC control register to the Vref choice. Additionally, the Vref voltage reference for the DAC comes from the ADC module. This means that it is necessary to turn on the voltage reference in the ADC control register (ADC12CTL0) with the REFON bit.Operating Modes
The DAC competes with two of the ADC channels for access to the pins of I/O Port 6. Unlike most peripheral controls on the MSP430, the DAC’s access to the pins is not controlled by the PxSEL register. Instead, the DAC is multiplexed with the ordinary port control and will drive the output if the DAC12AMPx bits are set to any value greater than zero. The DAC12AMPx bits in the control registers also determine the mode of the DAC’s operation.- Mode 000 The input buffer is off. The DAC is off, and the output buffer is high impedence.
- Mode 001 The input buffer is off. The DAC is off, and the output buffer is 0V.
- Modes 010 - 111 Each step in mode increases the power consumption of the DAC while improving the settling time of the module.
The two most useful modes for these labs are modes 000 and 111. Because our devices are not battery powered, we can afford the power consumption to improve speed. Mode 000 is needed to turn off the module when necessary.Using the DAC
The basic method of DAC operation is to load the DAC12_xDAT. Using the DAC12LSELx bits of the control register, the actual trigger for the output is set. The device can be figured to output whenever the data register is written to, whenever the data register is written and the DAC enable is set, or according to timers A or B. It is necessary to change the mode out of SEL mode 0 in order to use the interrupts with the DAC.The DAC can be interrupt enabled via the DAC control register and the interrupt enable registers. The flag is set whenever a conversion is complete. Also, the DAC outputs can be grouped together to ensure that the output of both DACs appears simultaneously. When the units are grouped, both DAC12_xDAT registers must be written before the outputs will appear. The device does not check whether you have changed the value; updating with the same information will still work.
Analog-to-Digital Converter on the MSP430
Summary: Explains how to use the MSP430 analog-to-digital converter (ADC).
The analog to digital converter (ADC) on the ez430 is a type called a Sigma-Delta (SD) Converter. The way it operates is slightly different from what was described in the previous section (although the end result is the same) but those specifics are out of the scope of this course. The SD converter on the ez430 has 8 channels and a 16 bit resolution. The module is highly configurable and can run largely free of program involvement. In this portion of the lab, we will broadly explain the features of the module, but the particular effects of each register are listed, as usual, in Chapter 12 of the User’s Guide.Range of Measurement
The result of each conversion will be 16 bits long in the form of an unsigned integer whose value is:SD16_MEMx=(65,536)
Vin−Vrneg
Vrpos−Vrneg
(1)Where Vin is the input voltage to be measured, Vrneg is the lower reference voltage, and Vrpos is the higher reference voltage. The reference voltages are set to power and ground by default, but they can be changed to an internal reference generator or an externally supplied reference using the SD16CTL
register.Input Channels for the ADC
The following is a table of the 8 input channels on the ez430. "Analog signal input" channels will take any analog source (we will get to the pin mapping's shortly). Other channels perform specific tool integrated tasks. For example, channel A6 is an integrated temperature sensor. For detailed descriptions of the others, see the User's Guide.SD16 Input Channels
- A0: Analog signal input
- A1: Analog signal input
- A2: Analog signal input
- A3: Analog signal input
- A4: Analog signal input
- A5:
Vcc−Vss
11
- A6: Integrated temperature sensor
- A7: Short for PGA offset measurement
Here is a pin diagram corresponding to the 14 accessible pins showing which pins correspond to which input channels. Notice that each channel has a "+" and a "-" input. Although with other ADC's, we would simply have one input pin and connect the other to the ground, the SD converter requires us to connect the positive and negative inputs to the corresponding input channels. Note that the numbers from 1-14 on the chip correspond to pins 1-14 on the target board.Figure 1: Shows which pins correspond to specific SD converter inputs. Also shows which pins correspond to specific ports (i.e pin 4 is connected to P1.2).
Pin Map
Operation Reminders for the ADC
Remember the following when attempting to use the ADC:- Be sure to enable SD16 interrupts (on
SD16CCTL0
) and to select the specific channel which you are using (onSD16INCTL
)
- After configuring the ADC, you must enable the
SD16SC
bit to start conversion.
- All ADC values will be stored in the
SD16MEMx
variable where "x" is the number of the channel
The User's Guide will be very useful for this lab because of the complexity of this part of the MSP430. Be sure to go over the chapter atleast briefly before jumping into programming.
Voltage Range and Precision
Unlike the ADC on the MSP, the DACs have variable bit precision of either 8 or 12 bits. The range is also controllable as either one or three times the voltage reference. The voltage reference is also selectable. All bits for controlling voltage reference, scaling, and precision can be found in the DAC12 Control Register (DAC12_xCTL). In most cases, 12 bit precision is desirable.
In the MSP430 architecture there are two general sources for a voltage reference: VeRef and Vref. VeRef is an externally supplied voltage, but Vref is generated by the MSP itself. Because the 226 board does not provide the MSP with a VeRef voltage, the only voltage reference available for the DAC and ADC is the Vref. This restricts the choices for the SREF bits of the DAC control register to the Vref choice. Additionally, the Vref voltage reference for the DAC comes from the ADC module. This means that it is necessary to turn on the voltage reference in the ADC control register (ADC12CTL0) with the REFON bit.
Operating Modes
The DAC competes with two of the ADC channels for access to the pins of I/O Port 6. Unlike most peripheral controls on the MSP430, the DAC’s access to the pins is not controlled by the PxSEL register. Instead, the DAC is multiplexed with the ordinary port control and will drive the output if the DAC12AMPx bits are set to any value greater than zero. The DAC12AMPx bits in the control registers also determine the mode of the DAC’s operation.
- Mode 000 The input buffer is off. The DAC is off, and the output buffer is high impedence.
- Mode 001 The input buffer is off. The DAC is off, and the output buffer is 0V.
- Modes 010 - 111 Each step in mode increases the power consumption of the DAC while improving the settling time of the module.
Using the DAC
The basic method of DAC operation is to load the DAC12_xDAT. Using the DAC12LSELx bits of the control register, the actual trigger for the output is set. The device can be figured to output whenever the data register is written to, whenever the data register is written and the DAC enable is set, or according to timers A or B. It is necessary to change the mode out of SEL mode 0 in order to use the interrupts with the DAC.
The DAC can be interrupt enabled via the DAC control register and the interrupt enable registers. The flag is set whenever a conversion is complete. Also, the DAC outputs can be grouped together to ensure that the output of both DACs appears simultaneously. When the units are grouped, both DAC12_xDAT registers must be written before the outputs will appear. The device does not check whether you have changed the value; updating with the same information will still work.
Analog-to-Digital Converter on the MSP430
Summary: Explains how to use the MSP430 analog-to-digital converter (ADC).
The analog to digital converter (ADC) on the ez430 is a type called a Sigma-Delta (SD) Converter. The way it operates is slightly different from what was described in the previous section (although the end result is the same) but those specifics are out of the scope of this course. The SD converter on the ez430 has 8 channels and a 16 bit resolution. The module is highly configurable and can run largely free of program involvement. In this portion of the lab, we will broadly explain the features of the module, but the particular effects of each register are listed, as usual, in Chapter 12 of the User’s Guide.Range of Measurement
The result of each conversion will be 16 bits long in the form of an unsigned integer whose value is:SD16_MEMx=(65,536)
Vin−Vrneg
Vrpos−Vrneg
(1)Where Vin is the input voltage to be measured, Vrneg is the lower reference voltage, and Vrpos is the higher reference voltage. The reference voltages are set to power and ground by default, but they can be changed to an internal reference generator or an externally supplied reference using the SD16CTL
register.Input Channels for the ADC
The following is a table of the 8 input channels on the ez430. "Analog signal input" channels will take any analog source (we will get to the pin mapping's shortly). Other channels perform specific tool integrated tasks. For example, channel A6 is an integrated temperature sensor. For detailed descriptions of the others, see the User's Guide.SD16 Input Channels
- A0: Analog signal input
- A1: Analog signal input
- A2: Analog signal input
- A3: Analog signal input
- A4: Analog signal input
- A5:
Vcc−Vss
11
- A6: Integrated temperature sensor
- A7: Short for PGA offset measurement
Here is a pin diagram corresponding to the 14 accessible pins showing which pins correspond to which input channels. Notice that each channel has a "+" and a "-" input. Although with other ADC's, we would simply have one input pin and connect the other to the ground, the SD converter requires us to connect the positive and negative inputs to the corresponding input channels. Note that the numbers from 1-14 on the chip correspond to pins 1-14 on the target board.Figure 1: Shows which pins correspond to specific SD converter inputs. Also shows which pins correspond to specific ports (i.e pin 4 is connected to P1.2).
Pin Map
Operation Reminders for the ADC
Remember the following when attempting to use the ADC:- Be sure to enable SD16 interrupts (on
SD16CCTL0
) and to select the specific channel which you are using (onSD16INCTL
)
- After configuring the ADC, you must enable the
SD16SC
bit to start conversion.
- All ADC values will be stored in the
SD16MEMx
variable where "x" is the number of the channel
The User's Guide will be very useful for this lab because of the complexity of this part of the MSP430. Be sure to go over the chapter atleast briefly before jumping into programming.
Range of Measurement
The result of each conversion will be 16 bits long in the form of an unsigned integer whose value is:
SD16_MEMx=(65,536)
(1)
Where Vin is the input voltage to be measured, Vrneg is the lower reference voltage, and Vrpos is the higher reference voltage. The reference voltages are set to power and ground by default, but they can be changed to an internal reference generator or an externally supplied reference using the Vin−Vrneg |
Vrpos−Vrneg |
SD16CTL
register.Input Channels for the ADC
The following is a table of the 8 input channels on the ez430. "Analog signal input" channels will take any analog source (we will get to the pin mapping's shortly). Other channels perform specific tool integrated tasks. For example, channel A6 is an integrated temperature sensor. For detailed descriptions of the others, see the User's Guide.
SD16 Input Channels
- A0: Analog signal input
- A1: Analog signal input
- A2: Analog signal input
- A3: Analog signal input
- A4: Analog signal input
- A5:
Vcc−Vss 11 - A6: Integrated temperature sensor
- A7: Short for PGA offset measurement
Pin Map |
---|
Operation Reminders for the ADC
Remember the following when attempting to use the ADC:
- Be sure to enable SD16 interrupts (on
SD16CCTL0
) and to select the specific channel which you are using (onSD16INCTL
) - After configuring the ADC, you must enable the
SD16SC
bit to start conversion. - All ADC values will be stored in the
SD16MEMx
variable where "x" is the number of the channel
0 comments:
Post a Comment