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 #53 background imageLoading...
Page #53 background image
Traditional and Structure Approach to C Coding
TMS320F2837xD Microcontroller Workshop - Peripherial Registers Header Files 3 - 5
Traditional and Structure Approach to C Coding
Traditional Approach to C Coding
#define TBCTL (volatile unsigned int *)0x00004000
...
void main(void)
{
*TBCTL = 0x1234; //write entire register
*TBCTL |= 0x0003; //stop time-base counter
}
Disadvantages - Requires individual masks to be generated to
manipulate individual bits
- Cannot easily display bit fields in debugger window
- Will generate less efficient code in many cases
Advantages - Simple, fast and easy to type
- Variable names can match register names (easy
to remember)
In the traditional approach to C coding, we used a #define to assign the address of the register
and referenced it with a pointer. The first line of code on this slide we are writing to the entire
register with a 16-bit value. The second line, we are ORing a bit field.
Advantages? Simple, fast, and easy to type. The variable names can exactly match the register
names, so it's easy to remember. Disadvantages? Requires individual masks to be generated to
manipulate individual bits, it cannot easily display bit fields in the debugger window, and it will
generate less efficient code in many cases.

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