蜂鸣器实验
#include "beep.h"void BEEP_Init(void)
{EALLOW;SysCtrlRegs.PCLKCR3.bit.GPIOINENCLK = 1;// 开启GPIO时钟//BEEP端口配置GpioCtrlRegs.GPAMUX1.bit.GPIO6=0;GpioCtrlRegs.GPADIR.bit.GPIO6=1;GpioCtrlRegs.GPAPUD.bit.GPIO6=0;EDIS;GpioDataRegs.GPACLEAR.bit.GPIO6=1;}
#ifndef BEEP_H_
#define BEEP_H_#include "DSP2833x_Device.h"
#include "DSP2833x_Examples.h"//宏定义
#define BEEP_ON (GpioDataRegs.GPASET.bit.GPIO6=1)
#define BEEP_OFF (GpioDataRegs.GPACLEAR.bit.GPIO6=1)
#define BEEP_TOGGLE (GpioDataRegs.GPATOGGLE.bit.GPIO6=1)void BEEP_Init(void);#endif /* APP_BEEP_BEEP_H_ */
#include "DSP2833x_Device.h"
#include "DSP2833x_Examples.h"
#include "leds.h"
#include "beep.h"void main()
{InitSysCtrl();//系统时钟初始化,默认已开启F28335所有外设时钟LED_Init();BEEP_Init();while(1){BEEP_TOGGLE;DELAY_US(100);//系统的延迟函数单位是us 此处为延迟100us}
}
是因为宏定义出现了问题