I'll have five levels of current project to the ACS, the incoming chip, the maximum current of 0.27 A grade, the minimum current is 0.09 A grade, I measured with the oscilloscope, ACS722 voltage is based on the 1.66 V, 50 hz sinusoidal ac voltage, fengfeng value maximum voltage within 200 mv, I sampled by ACS722 to voltage, then wrote A square root algorithm calculate voltage RMS, A cycle is not enabled in the program DMA, but measuring found five level corresponding RMS is almost the same, not clear is what reason, procedure and oscilloscope screenshot below
This is my ADC configuration, single channel sampling, precision 2 12th, not using the DMA, AC sampling frequency is 16 MHZ, conversion cycle 4 cycles
Void ADC_Config (u8 ADC_Channel)
{
ADC_InitTypeDef ADC_InitStructure;//
RCC_HSICmd (ENABLE);//
While (RCC_GetFlagStatus (RCC_FLAG_HSIRDY)==RESET);
RCC_APB2PeriphClockCmd (RCC_APB2Periph_ADC1, ENABLE);//
ADC_InitStructure. ADC_Resolution=ADC_Resolution_12b;//
ADC_InitStructure. ADC_ScanConvMode=DISABLE;//
ADC_InitStructure. ADC_ContinuousConvMode=ENABLE;//
ADC_InitStructure. ADC_ExternalTrigConvEdge=ADC_ExternalTrigConvEdge_None;//
ADC_InitStructure. ADC_DataAlign=ADC_DataAlign_Right;//
ADC_InitStructure. ADC_NbrOfConversion=1;//
ADC_Init (ADC1, & amp; ADC_InitStructure);//
ADC_RegularChannelConfig (ADC1, ADC_Channel_0, 1, ADC_SampleTime_4Cycles);//
ADC_DelaySelectionConfig (ADC1, ADC_DelayLength_Freeze);
/* the Enable ADC1 Power Down during Delay */
ADC_PowerDownCmd (ADC1, ADC_PowerDown_Idle_Delay, ENABLE);//
ADC_Cmd (ADC1, ENABLE);//
While (ADC_GetFlagStatus (ADC1, ADC_FLAG_ADONS)==RESET)
{
}
}
CodePudding user response:
This is my voltage sampling program, the whole sampling period==1.03125 mu (12.5 + 4)/16 s, voltage cycle 20 ms=20000 mu s, sampling points N=20000/1.03125=19393, calculate voltage RMS algorithm USES the party root, using delay also avoided the voltage instability of the time, but in the end still can't distinguish between different sizes of voltage, almost back to the voltage value is 1660 mv, but under the oscilloscope measurement, maximum voltage value fengfeng nearly 200 mv, the smallest fengfeng value is almost 0 mv, supposedly should be able to distinguish, why can't separate?
Double ADC_DataAcquire (void)
{
Double c=0;//
Double adc_value=https://bbs.csdn.net/topics/0;
Under-16 sample_counter;
ADC_Config (ADC_Channel_0);//
Delay_TIM6_1ms (100);
For (sample_counter=0; Sample_counter & lt; 19393; Sample_counter + +)
{
ADC_SoftwareStartConv (ADC1);//open the continuous transformation
While (ADC_GetFlagStatus (ADC1, ADC_FLAG_EOC)==RESET)//waiting for the end of conversion
{
}
adc_value=https://bbs.csdn.net/topics/ADC_GetConversionValue (ADC1);//
adc_value=https://bbs.csdn.net/topics/adc_value * adc_value;//
C=adc_value + c;//
}
C=c/19393;
C=SQRT (c);//
adc_value=https://bbs.csdn.net/topics/(3300 * c)/4095;//
Return adc_value;
ADC_Cmd (ADC1, DISABLE);//
RCC_HSICmd (DISABLE);//
RCC_APB2PeriphClockCmd (RCC_APB2Periph_ADC1, DISABLE);//
}
CodePudding user response:
O great god answer ahCodePudding user response:
0.27 A it points A 5-speed, itself is very small difference (don't know how is the scope of your range chip?) If it is - 5 a ~ 5 a chip, that is in the range of 1/20 to 5 gears, additional noise has 21 ma,Secondly you 1,66 V seems to be static voltage, look like calculate the average, and is not a valid value
CodePudding user response:
Already done, forgot to "post, is the algorithm used, is unable to correctly calculate RMS, but also for value is too smallCodePudding user response: