EasyManuals Logo

Texas Instruments TMS320F2837 D Series Workshop Guide And Lab Manual

Texas Instruments TMS320F2837 D Series
324 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #54 background imageLoading...
Page #54 background image
Traditional and Structure Approach to C Coding
3 - 6 TMS320F2837xD Microcontroller Workshop - Peripherial Registers Header Files
Structure Approach to C Coding
void main(void)
{
EPwm1Regs.TBCTL.all = 0x1234; //write entire register
EPwm1Regs.TBCTL.bit.CTRMODE = 3; //stop time-base counter
}
Disadvantages - Can be difficult to remember the structure names
(Editor Auto Complete feature to the rescue!)
- More to type (again, Editor Auto Complete feature
to the rescue)
Advantages - Easy to manipulate individual bits
- Watch window is amazing! (next slide)
- Generates most efficient code (on C28x)
The structure approach to C coding uses the peripheral register header files. First, a peripheral is
specified, followed by a control register. Then you can modify the complete register or selected
bits. This is almost self-commented code.
The first line of code on this slide we are writing to the entire register. The second line of code we
are modifying a bit field. Advantages? Easy to manipulate individual bits, it works great with our
tools, and will generate the most efficient code. Disadvantages? Can be difficult to remember
the structure names and more to type; however, the edit auto complete feature of Code
Composer Studio will eliminate these disadvantages.

Table of Contents

Other manuals for Texas Instruments TMS320F2837 D Series

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments TMS320F2837 D Series and is the answer not in the manual?

Texas Instruments TMS320F2837 D Series Specifications

General IconGeneral
BrandTexas Instruments
ModelTMS320F2837 D Series
CategoryMicrocontrollers
LanguageEnglish

Related product manuals