打印
[N32G03x]

关于031的OPAMP独立运算放大器模式的配置

[复制链接]
402|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
hollow1|  楼主 | 2022-7-21 16:20 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
// PB0 : OPAMP_VINP
// PB1 : OPAMP_VINM
// PA6 : OPAMP_VOUT
static void OPAMP_GPIO_Config(void)
{
        GPIO_InitType GPIO_InitStructure;

    RCC_EnableAPB2PeriphClk(RCC_APB2_PERIPH_GPIOA, ENABLE);
    RCC_EnableAPB2PeriphClk(RCC_APB2_PERIPH_GPIOB, ENABLE);
    RCC_EnableAPB2PeriphClk(RCC_APB2_PERIPH_AFIO, ENABLE);
       
    OPAMP_SetVpSel(OPAMP_CS_VPSEL_PB0);
    OPAMP_SetVmSel(OPAMP_CS_VMSEL_PB1);

    GPIO_InitStruct(&GPIO_InitStructure);
    GPIO_InitStructure.GPIO_Alternate = GPIO_NO_AF;
    GPIO_InitStructure.GPIO_Speed     = GPIO_SPEED_HIGH;
    GPIO_InitStructure.GPIO_Current   = GPIO_DC_LOW;
        GPIO_InitStructure.GPIO_Pull      = GPIO_NO_PULL;
        GPIO_InitStructure.GPIO_Mode      = GPIO_MODE_ANALOG;
    GPIO_InitStructure.Pin            = GPIO_PIN_0;
    GPIO_InitPeripheral(GPIOB, &GPIO_InitStructure);       
        GPIO_InitStructure.Pin            = GPIO_PIN_1;
    GPIO_InitPeripheral(GPIOB, &GPIO_InitStructure);
    GPIO_InitStructure.Pin            = GPIO_PIN_6;
    GPIO_InitPeripheral(GPIOA, &GPIO_InitStructure);
}

static void OPAMP_Channel_Config(void)
{
        OPAMP_InitType OPAMP_Initial;

    RCC_EnableAPB1PeriphClk(RCC_APB1_PERIPH_OPAMP, ENABLE);
       
    OPAMP_DeInit();
        OPAMP_StructInit(&OPAMP_Initial);
    OPAMP_Initial.Mod            = OPAMP_CS_EXT_OPAMP;
    OPAMP_Initial.Gain           = OPAMP_CS_PGA_GAIN_8;
    OPAMP_Initial.TimeAutoMuxEn  = DISABLE;
    OPAMP_Init(&OPAMP_Initial);
    OPAMP_Enable(ENABLE);
}

void OPAMP_Config(void)
{
        OPAMP_GPIO_Config();
        OPAMP_Channel_Config();
}

//请问有人能帮忙看看这OPAMP程序是缺失哪部分配置不

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

8

主题

18

帖子

0

粉丝