<< Chapter < Page Chapter >> Page >
Using the MSP-EXP430FG4618 Development Tool and the MSP430FG4618 device implement a voltage ramp generator Basic Timer1.

Laboratory dac: lab1 - voltage ramp generator

Introduction

This laboratory gives an example of the use of the DAC available in the MSP-EXP430FG4618 Development Tool. The DAC module reference is obtained from the ADC module. The DAC is configured with 12 bits resolution in straight binary format. The DAC’s output value is updated every 1 msec by a Timer_A ISR. The buttons SW1 and SW2 are used to manually modify the DAC’s output.

Overview

This laboratory ( Lab1_DAC.c )implements a voltage ramp generator. The DAC module reference is obtained from the ADC module. The DAC is configured with 12-bit resolution, in straight binary format. The output of the DAC value is updated once every 1 msec by an interrupt service routine (ISR) generated by Timer_A. The push buttons SW1 and SW2 are used to manually modify the output of the DAC value. When the microcontroller is not performing any task, it enters low power mode.

Resources

The DAC12_0 module uses V REF+ as reference voltage. It is therefore necessary to activate this reference voltage in the ADC12 module.

The DAC12_0 is connected to Port P6.6 on the Header 8 pin 7. Connect the oscilloscope probe to this port pin.

The output of the DAC is updated whenever Timer_A generates an interrupt. This peripheral is configured to generate an interrupt with a 1 msec time period.

After refreshing the output of the DAC, the system returns to low power mode LPM3.

The push buttons SW1 and SW2 allow the output of the DAC value to be changed manually.

The resources used by the application are:

- Timer_A;

- DAC12;

- I/O ports;

- FLL+;

- Interrupts.

Software application organization

The application starts by stopping the Watchdog Timer.

Then, the ADC12’s reference voltage is activated and set to 2.5 V. A delay is used to allow the reference voltage to settle. During this time period, the device enters low power mode LPM0. The delay period, which is controlled by Timer_A, enables an interrupt when it completes. The interrupt wakes the device and proceeds with the execution of the application.

Timer_A is reconfigured to generate an interrupt once every 1 msec. This interrupt service routine (ISR) updates the output of the DAC.

Ports P1.0 and P1.1 are connected to buttons SW1 and SW2. The ports are configured as inputs with interrupt capability, such that the ISR can decode which button is pushed. If the interrupt source is due to button SW1, then the output of the DAC is increased. If the interrupt source is due to button SW2, then the output of the DAC is decreased.

System configuration

Fll+ configuration

FLL_CTL0 |= DCOPLUS | XCAP18PF; // DCO+ set, // freq = xtal x D x N+1SCFI0 |= FN_4; // x2 DCO freq, // 8MHz nominal DCO SCFQCTL = 121; // (121+1) x 32768 x 2 = 7.99 MHz

Reference voltage selection

The DAC12_0 uses the signal V REF+ as reference voltage. What is the value to write to the configuration register in order to obtain the internally available reference?

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Teaching and classroom laboratories based on the “ez430” and "experimenter's board" msp430 microcontroller platforms and code composer essentials. OpenStax CNX. May 19, 2009 Download for free at http://cnx.org/content/col10706/1.3
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Teaching and classroom laboratories based on the “ez430” and "experimenter's board" msp430 microcontroller platforms and code composer essentials' conversation and receive update notifications?

Ask