Register Programming Model
3 - 4 TMS320F2837xD Microcontroller Workshop - Peripherial Registers Header Files
Programming Model Comparison
The device support package includes documentation and examples showing how to
use the Bit Field Header Files or DriverLib
Device support packages located at: C:\ti\c2000\C2000Ware\device_support\
C2000Ware can be downloaded at www.ti.com/tool/c2000ware
EPwm1Regs.CMPA.half.CMPA = EPwm1Regs.TBPRD * duty;
EPWM_setCounterCompareValue(EPWM2_BASE, EPWM_COUNTER_COMPARE_A, duty);
*CMPR1 = 0x1234;
Direct Register Access
Register addresses # defined individually
User must compute bit-field masks
Not easy-to-read
Bit Field Header Files
Header files define all registers as structures
Bit-fields directly accessible
Easy-to-read
DriverLib
DriverLib performs low-level register manipulation
Easy-to-read
Highest abstraction level
The above slide provides a comparison of each programming model, from the lowest level to the
highest level of abstraction. With direct register access, the register addresses are #defined
individually and the user must compute the bit-field mask. The bit field header files define all
registers as structures and the bit fields are directly accessible. DriverLib performs low-level
register manipulation and provides the highest level of abstraction. This workshop makes use of
the bit field header files, which provides a balance between ease of use and flexibility. Device
support packages can be downloaded from www.ti.com.