资 源 简 介
void FunctionGenerator(FunctionGeneratorType ft,uint32_t feq,float amp,uint8_t duty){DAC_InitTypeDef DAC_InitStructure;char i,iH;DACTriggerByTIM2(2250000/feq,0); //设定触发频率if(ft == Triangle_Wave) //修改标准波形的幅值存入数组{for(i=0; i<32; i++)AnyWaveTab[i] = (u16)((amp / 3.3) * TriangleWaveTab[i]);FG_StartOutput(AnyWaveTab); //开始输出}if(ft == Square_Wave){iH = (32.0 * (duty / 100.0)); //计算占空比在波形表的下标数for(i=iH; i<32; i++) //填充高电平AnyWaveTab[i] = (u16)((amp / 3.3) * 4095);for(i=0; i