Peripheral Structure .h files (1 of 2)
Contain bits field structure definitions for each peripheral register
F2837xD_epwm.h
#include “F2837xD_device.h"
Void InitAdc(void)
{
/* Stop time-base counter */
EPwm1Regs.TBCTL.bit.CTRMODE = 1;
/* configure the ADC register */
AdcRegs.ADCCTL1.all = 0x00E4;
};
Your C-source file (e.g., EPwm.c)
// EPWM Individual Register Bit Definitions:
struct TBCTL_BITS { // bits description
Uint16 CTRMODE:2; // 1:0 Counter Mode
Uint16 PHSEN:1; // 2 Phase Load Enable
Uint16 PRDLD:1; // 3 Active Period Load
Uint16 SYNCOSEL:2; // 5:4 Sync Output Select
Uint16 SWFSYNC:1; // 6 Software Force Sync Pulse
Uint16 HSPCLKDIV:3; // 9:7 High Speed TBCLK Pre-scaler
Uint16 CLKDIV:3; // 12:10 Time Base Clock Pre-scaler
Uint16 PHSDIR:1; // 13 Phase Direction Bit
Uint16 FREE_SOFT:2; // 15:14 Emulation Mode Bits
};
// Allow access to the bit fields or entire register:
union TBCTL_REG {
Uint16 all;
struct TBCTL_BITS bit;
};
// EPWM External References & Function Declarations:
extern volatile struct EPWM_REGS EPwm1Regs;
Peripheral Structure .h files
(2 of 2)
The header file package contains a .h file for
each peripheral in the device
F2837xD_device.h
Main include file
Will include all other .h files
Include this file (directly or indirectly)
in each source file:
#include “F2837xD_device.h”