Daniel's Application Note
Daniel's Application Note
Introduction to
Programming C2000
Piccolo Launchpad
ECE480 Team 8
Daniel S. Chen
11/11/2014
Introduction
The C2000 Piccolo Launchpad is an evaluation platform that allows the user to
practice real-time control programming on the C2000 Piccolo microcontrollers. The
Launchpad is based on the Piccolo TMS320F28027 with features such as 12bit ADC,
8PWM channels, I2C, SPI, UART, and 64KB of on board flash memory, etc. It utilizes an
integrated isolated XDS100 JTAG emulator for easy programming and debugging. In
addition, it also has 40 PCB pins that are available for easy access to the pints of the
F28027 microcontroller and programmable/reset button.
Objective
To help an individual how to program, debug, and communicate with real-world
using the C2000 Piccolo Launchpad. The main focuses are on using IDE (Integrated
Development Environment), programming methods, and access to helpful information.
Overview
To successfully understand and integrate a microcontroller, one would need to
become proficient with IDE, which is an interface that allows user to program and
debugging the Launchpad. Secondly, there are various ways to communicate with the
Launchpad such as programming language and programming structure that is also
important to utilize the microcontroller to its full potential. Lastly, it is also important for
the user to understand how to gain access to useful resources such as peripheral
guidelines, register maps, or potential application tutorials.
Recommendation
Integrated Development Environment (IDE)
Code Composer Studio (CCS) is a common IDE that supports Texas Instruments
Microcontroller and embedded processors. It comprises a suite of tools that can be used
to develop and debug embedded applications. It includes an optimizing C++/C compiler,
debugger, profiler, project build environment, and source code editor.
In addition to the IDE, it is also critical to have controlSUITE available during the
development process. controlSUITE is a cohesive set of software infrastructure and
software tools that is designed to minimize the development time. It provides device-
specific driver as well as support software and system examples for some of the
sophisticated system application. The controlSUITE comprise of 4-level Hardware
Abstraction Layer.
Level 4 Framework
C C++
Typing Discipline Weak, Static Strong, Unsafe, Nominative
Paradigms Imperative systems Object-oriented
implementation language programming
Garbage Collection Allows better management No
of memory manually
Speed Faster to compile and Slightly slower if not
execute than C++ proficient with the
language
Table 1: Comparison between C and C++
Programming Model
Advantages Disadvantages
Direct Register Access Smaller code footprint Codes are obscure
Model Faster code execution Detailed knowledge of each
register is required
Software Driver Model Larger code footprint Codes are viewable and
Slower code execution understandable
Table 2: Comparison between programming models
Direct Register Access Model
As the name suggest, the Direct Register Access Model (DRAM)writes value
directly to the individual peripheral registers. All of the peripheral registers are defined
in the corresponding header file for specific device. It is therefore important for the user
to include such header file along with the developed program. An example of DRAM is
demonstrated as follow:
AdcRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;
AdcRegs.ADCINTFLGCLR.bit.ADCINT2 = 1;
This particular code clears the ADC interrupt flag for ADC interrupt 1 and 2.
How the programming models are implemented are affect by its application. A
software driver model is recommended if code size and execution time is not a
consideration for the particular application. A combination of both software driver and
direct register access model is recommended if code size is not an issue but timing is
critical and speed of execution is significant. If both the code size and timing constraints
are critical, then the direct register access model is recommended.
Another DRAM Example
/*Configure input/output*/
GPIO_PORTA_DIR_R = 0x2C;
/*Enable SSI*/
SSI0_CR1_R = 0x00000002;
GPIO_setHigh(myGpio, GPIO_Number_0);
GPIO_setHigh(myGpio, GPIO_Number_1);
GPIO_setLow(myGpio, GPIO_Number_2);
GPIO_setHigh(myGpio, GPIO_Number_3);
DELAY_US(50000);
GPIO_setHigh(myGpio, GPIO_Number_0);
GPIO_setLow(myGpio, GPIO_Number_1);
GPIO_setHigh(myGpio, GPIO_Number_2);
GPIO_setHigh(myGpio, GPIO_Number_3);
DELAY_US(50000);
GPIO_setLow(myGpio, GPIO_Number_0);
GPIO_setHigh(myGpio, GPIO_Number_1);
GPIO_setHigh(myGpio, GPIO_Number_2);
GPIO_setHigh(myGpio, GPIO_Number_3);
DELAY_US(500000);
}
http://www.ti.com/ww/en/launchpad/launchpads -c2000-launchxl-f28027.html#tabs
http://www.ti.com/lit/ml/sprb199a/sprb199a.pdf
http://www.ti.com/tool/launchxl -f28027
http://www.ti.com/lit/ds/sprs523j/sprs523j.pdf
http://www.ti.com/lit/ug/spru566k/spru566k.pdf
http://www.diffen.com/difference/C_vs_C%2B%2B