Graph Visualization for MSP430

From Texas Instruments Embedded Processors Wiki

Jump to: navigation, search
Translate this page to   

This page is intented to show an application that demonstrates the graph capabilities of CCSv4 for MSP430 users.

Contents

Introduction

The capability of displaying data on a graphical display inside Code Composer Studio is a well known feature for TI DSP developers. Since the new CCSv4 extends support to the MSP430 family of devices, this capability becomes an interesting and useful feature for displaying data on-the-fly directly from memory buffers and registers. This page details the procedure to perform this task and makes some considerations about the displayed data. It uses (and slightly modifies) the well known ADC12 MSP430F149 example code available on the web.

References

This page refers to the following documents:

MSP430F149 Datasheet: http://www-s.ti.com/sc/techlit/msp430f149

MSP430F1xx User's Guide: http://www-s.ti.com/sc/techlit/slau049

MSP430x13x, MSP430F14x, MSP430F15x, MSP430F16x code examples: http://focus.ti.com/mcu/docs/mcuprodcodeexamples.tsp?sectionId=96&tabId=1468

How to create Custom Target Configurations: Creating_Custom_Target_Configurations

Q format for fixed point arithmetic article on wikipedia: http://en.wikipedia.org/wiki/Q_(number_format)

Not covered in this document

Several topics are outside the scope of this document: CCSv4 installation, emulator and hardware configuration, details about the MSP430F149 ADC12 converter, and anything else you can't find here!

How to proceed:

Download and installation of the required components

Creating the example project

Fig. 1: New project
...
  ADC12CTL0 = SHT0_2 + ADC12ON;             // Set sampling time, turn on ADC12
  ADC12CTL1 = SHP + ADC12DIV0 + ADC12DIV1 + ADC12DIV2; // Use sampling timer
  ADC12IE = 0x01;                           // Enable interrupt
  ADC12CTL0 |= ENC;                         // Conversion enabled
  ...
Fig. 2: Build successful

Configuring the graph display and debugging

Fig. 3: Project loaded
Fig. 4: Breakpoint properties
Property Value
Acquisition Buffer Size 1
Dsp Data Type 16 bit unsigned integer
Q_value 12
Sampling Rate HZ 5
Start Address ADC12MEM0
Time Display Unit s

What is happening with the values displayed in the graph? Why do they look wrong?

The main reason for this is due to the fact that the display graph does not know the maximum voltage of the ADC; it is actually a normalized value referred to the Q value setting of the graph display (check the Q format reference above).

Because the ADC only reaches 12 bits and the graph display shows 16 bit unsigned integers, the Q value must be set. If the Q value is left to its default value of 0, the Y axis would only show the decimal values corresponding to the ADC output codes (from 0 to 4095).

Therefore, in order to have a better correlation with the ADC voltage input on the graph tool the Q value was set to 12, forcing the graph tool to reach 1 when the ADC data equals to 0xFFF.

This turns the graph values into the normalized values relative to the maximum input voltage of the ADC. For example, if the ADC maximum voltage (AVcc) is 2.8V the display below shows values of 0,2; 0,4; 0,6 and 0,8 that correspond to <math>2.8 \times 0,2 = 0,56V</math>; <math>2.8 \times 0,4 = 1.12V</math>; <math>2.8 \times 0,6 = 1.68V</math>; <math>2.8 \times 0,8 = 2.24V</math>

Fig. 5: Final display graph

Considerations and possible issues


Fig. 6: Auto scale effect on values


--Rsjsouza 15:54, 28 April 2009 (CDT)

E2e.jpg For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article Graph Visualization for MSP430 here.
Hyperlink blue.png Links
ARM Microcontroller MCU ARM Processor Digital Media Processor Digital Signal Processing Microcontroller MCU Multi Core Processor
Ultra Low Power DSP 8 bit Microcontroller MCU 16 bit Microcontroller MCU 32 bit Microcontroller MCU

Leave a Comment
Personal tools
Namespaces
Variants
Actions
Navigation
Print/export
Toolbox