#define OP0_INP() { M0P_GPIO->PCADS_f.PC06 = 1; M0P_GPIO->PCDIR_f.PC06 = 1;}
#define OP0_INN() { M0P_GPIO->PBADS_f.PB15 = 1; M0P_GPIO->PBDIR_f.PB15 = 1;}
#define OP0_OUT() { M0P_GPIO->PCADS_f.PC07 = 1; M0P_GPIO->PCDIR_f.PC07 = 1;}
#define OP1_INP() { M0P_GPIO->PBADS_f.PB13 = 1; M0P_GPIO->PBDIR_f.PB13 = 1;}
#define OP1_INN() { M0P_GPIO->PBADS_f.PB12 = 1; M0P_GPIO->PBDIR_f.PB12 = 1;}
#define OP1_OUT() { M0P_GPIO->PBADS_f.PB14 = 1; M0P_GPIO->PBDIR_f.PB14 = 1;}
#define OP2_INP() { M0P_GPIO->PBADS_f.PB10 = 1; M0P_GPIO->PBDIR_f.PB10 = 1;}
#define OP2_INN() { M0P_GPIO->PBADS_f.PB02 = 1; M0P_GPIO->PBDIR_f.PB02 = 1;}
#define OP2_OUT() { M0P_GPIO->PBADS_f.PB11 = 1; M0P_GPIO->PBDIR_f.PB11 = 1;}
void OPA_Config(void)
{
stc_opa_gain_config_t strGain;
Sysctrl_SetPeripheralGate(SysctrlPeripheralAdcBgr, TRUE);
Sysctrl_SetPeripheralGate(SysctrlPeripheralGpio, TRUE);
Sysctrl_SetPeripheralGate(SysctrlPeripheralOpa, TRUE);
OPA_Init();
OP2_INP();
OP2_INN();
OP2_OUT();
OPA_Operate(OPA2 ,OpaGpMode,&strGain);
}
用该程序配置了opa,工作在通用放大器,外部电路的连接让放大器作为电压跟随器;输入一路正弦波发现输出引脚上并没有信号出来。试了一下官方的程序,也是一样的问题。 |