Example of Peripheral Structure .h file
Example of Peripheral Structure .h file
Example of Peripheral Structure .h file
Example of Peripheral Structure .h file
/* ADC Individual Register Bit Definitions */
/* ADC Individual Register Bit Definitions */
struct
struct
ADCTRL1_BITS { // bits description
ADCTRL1_BITS { // bits description
Uint16 rsvd1:4; // 3:0 reserved
Uint16 rsvd1:4; // 3:0 reserved
Uint16 SEQ_CASC:1; // 4 Cascaded sequencer mode
Uint16 SEQ_CASC:1; // 4 Cascaded sequencer mode
Uint16 rsvd2:1; // 5 reserved
Uint16 rsvd2:1; // 5 reserved
Uint16 CONT_RUN:1; // 6 Continuous run
Uint16 CONT_RUN:1; // 6 Continuous run
Uint16 CPS:1; // 7 ADC core clock
Uint16 CPS:1; // 7 ADC core clock
prescaler
prescaler
Uint16 ACQ_PS:4;
Uint16 ACQ_PS:4;
// 11:8 Acquisition window size
// 11:8 Acquisition window size
Uint16 SUSMOD:2; // 13:12 Emulation suspend mode
Uint16 SUSMOD:2; // 13:12 Emulation suspend mode
Uint16 RESET:1;
Uint16 RESET:1;
// 14 ADC reset
// 14 ADC reset
Uint16 rsvd3:1;
Uint16 rsvd3:1;
// 15 reserved
// 15 reserved
};
};
/* Allow access to the bit fields or entire register */
/* Allow access to the bit fields or entire register */
union ADCTRL1_REG {
union ADCTRL1_REG {
Uint16 all;
Uint16 all;
struct
struct
ADCTRL1_BITS bit;
ADCTRL1_BITS bit;
};
};
// ADC External References & Function Declarations:
// ADC External References & Function Declarations:
extern volatile
extern volatile
struct
struct
ADC_REGS
ADC_REGS
AdcRegs
AdcRegs
;
;
Example
Example
Adc
Adc
.h
.h
#include “DSP281x_Device.h”
#include “DSP281x_Device.h”
Void
Void
InitAdc
InitAdc
(void)
(void)
{
{
/* Reset the ADC module */
/* Reset the ADC module */
AdcRegs
AdcRegs
.ADCTRL1.bit.RESET = 1;
.ADCTRL1.bit.RESET = 1;
/* configure the ADC register */
/* configure the ADC register */
AdcRegs
AdcRegs
.ADCTRL1.all = 0x0710;
.ADCTRL1.all = 0x0710;
};
};
Example
Example
Adc
Adc
.c or main.c
.c or main.c
C28x - Peripheral Registers Header Files 3 - 7