修改波长计算方式,回寝室再测试
This commit is contained in:
parent
90dd791fce
commit
930265ba45
|
@ -303,10 +303,10 @@ ARM Macro Assembler Page 5
|
|||
E000ED08
|
||||
Command Line: --debug --xref --diag_suppress=9931 --cpu=Cortex-M3 --apcs=interw
|
||||
ork --depend=.\context_rvds.d -o.\context_rvds.o -I.\RTE\_oscilloscope -ID:\ins
|
||||
tall\Keil_v5\Arm\Packs\Keil\STM32F1xx_DFP\2.0.0\Device\Include -ID:\install\Kei
|
||||
l_v5\ARM\CMSIS\Include --predefine="__MICROLIB SETA 1" --predefine="__UVISION_V
|
||||
ERSION SETA 527" --predefine="STM32F10X_HD SETA 1" --list=.\listings\context_rv
|
||||
ds.lst ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
|
||||
tall\keil526\ARM\PACK\Keil\STM32F1xx_DFP\2.1.0\Device\Include -ID:\install\keil
|
||||
526\ARM\CMSIS\Include --predefine="__MICROLIB SETA 1" --predefine="__UVISION_VE
|
||||
RSION SETA 526" --predefine="STM32F10X_HD SETA 1" --list=.\listings\context_rvd
|
||||
s.lst ..\rtthread\libcpu\arm\cortex-m3\context_rvds.S
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -553,11 +553,10 @@ ARM Macro Assembler Page 9
|
|||
00000000
|
||||
Command Line: --debug --xref --diag_suppress=9931 --cpu=Cortex-M3 --apcs=interw
|
||||
ork --depend=.\startup_stm32f10x_hd.d -o.\startup_stm32f10x_hd.o -I.\RTE\_oscil
|
||||
loscope -ID:\install\Keil_v5\Arm\Packs\Keil\STM32F1xx_DFP\2.0.0\Device\Include
|
||||
-ID:\install\Keil_v5\ARM\CMSIS\Include --predefine="__MICROLIB SETA 1" --predef
|
||||
ine="__UVISION_VERSION SETA 527" --predefine="STM32F10X_HD SETA 1" --list=.\lis
|
||||
tings\startup_stm32f10x_hd.lst ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.
|
||||
s
|
||||
loscope -ID:\install\keil526\ARM\PACK\Keil\STM32F1xx_DFP\2.1.0\Device\Include -
|
||||
ID:\install\keil526\ARM\CMSIS\Include --predefine="__MICROLIB SETA 1" --predefi
|
||||
ne="__UVISION_VERSION SETA 526" --predefine="STM32F10X_HD SETA 1" --list=.\list
|
||||
ings\startup_stm32f10x_hd.lst ..\Libraries\CMSIS\startup\startup_stm32f10x_hd.s
|
||||
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -16,7 +16,7 @@
|
|||
<TargetCommonOption>
|
||||
<Device>STM32F103VE</Device>
|
||||
<Vendor>STMicroelectronics</Vendor>
|
||||
<PackID>Keil.STM32F1xx_DFP.2.0.0</PackID>
|
||||
<PackID>Keil.STM32F1xx_DFP.2.1.0</PackID>
|
||||
<PackURL>http://www.keil.com/pack/</PackURL>
|
||||
<Cpu>IRAM(0x20000000,0x10000) IROM(0x08000000,0x80000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE</Cpu>
|
||||
<FlashUtilSpec></FlashUtilSpec>
|
||||
|
|
|
@ -130,7 +130,7 @@ void Setting_Inf_Update(uint8_t CurSetItem)
|
|||
|
||||
if(CurWaveFrq < 1.0)
|
||||
{
|
||||
sprintf(dispBuff,"%.1fHz", CurWaveFrq*1000);
|
||||
sprintf(dispBuff,"%dfHz", (uint16_t)(CurWaveFrq*1000));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -263,24 +263,23 @@ void PlotBlackground(void)
|
|||
*/
|
||||
void CalculateFrequency(void)
|
||||
{
|
||||
uint16_t SampleNrb_Pre=0, SampleNrb_Aft=0;
|
||||
uint8_t SumNrb=4;//自动采样模式下对频率求平均值
|
||||
uint16_t SampleNrb_Pre=Wave_Centor_X, SampleNrb_Aft=Wave_Centor_X+1;
|
||||
uint8_t SumNrb=4;//对频率求平均值
|
||||
float d0, d1;
|
||||
|
||||
// if(SamplingModeNrb == 0)
|
||||
// SumNrb = 4;
|
||||
// else
|
||||
// SumNrb = 0;
|
||||
//¼ÆË㲨³¤
|
||||
d0 = ADC_ConvertedValue[SampleNrb_Pre]/200.0*3.3;
|
||||
d1 = ADC_ConvertedValue[SampleNrb_Pre+1]/200.0*3.3;
|
||||
while((Get_Trigger_Status(d0, d1) == SET) && (SampleNrb_Pre < (ADCx_1_SampleNbr-1)))
|
||||
//从中心位置向左搜索触发点
|
||||
d0 = ADC_ConvertedValue[SampleNrb_Pre-1]/200.0*3.3;
|
||||
d1 = ADC_ConvertedValue[SampleNrb_Pre]/200.0*3.3;
|
||||
while((Get_Trigger_Status(d0, d1) == RESET) && (SampleNrb_Pre > 1))
|
||||
{
|
||||
SampleNrb_Pre++;
|
||||
d0 = ADC_ConvertedValue[SampleNrb_Pre]/200.0*3.3;
|
||||
d1 = ADC_ConvertedValue[SampleNrb_Pre+1]/200.0*3.3;
|
||||
SampleNrb_Pre--;
|
||||
d0 = ADC_ConvertedValue[SampleNrb_Pre-1]/200.0*3.3;
|
||||
d1 = ADC_ConvertedValue[SampleNrb_Pre]/200.0*3.3;
|
||||
}
|
||||
SampleNrb_Aft = SampleNrb_Pre;
|
||||
//从中心位置向右搜索触发点
|
||||
d0 = ADC_ConvertedValue[SampleNrb_Aft]/200.0*3.3;
|
||||
d1 = ADC_ConvertedValue[SampleNrb_Aft+1]/200.0*3.3;
|
||||
while((Get_Trigger_Status(d0, d1) == RESET) && (SampleNrb_Aft < (ADCx_1_SampleNbr-1)))
|
||||
{
|
||||
SampleNrb_Aft++;
|
||||
|
@ -290,9 +289,9 @@ void CalculateFrequency(void)
|
|||
|
||||
rt_kprintf("WaveLenth: %d\n", SampleNrb_Aft - SampleNrb_Pre);
|
||||
|
||||
if(SampleNrb_Aft < ADCx_1_SampleNbr-1)
|
||||
if(SampleNrb_Aft - SampleNrb_Pre + 2 < ADCx_1_SampleNbr-1)
|
||||
{
|
||||
WaveLenth += SampleNrb_Aft - SampleNrb_Pre+2;
|
||||
WaveLenth += SampleNrb_Aft - SampleNrb_Pre + 1;
|
||||
if(++WaveLenthSumNrb >= SumNrb)
|
||||
{
|
||||
WaveLenthSumNrb = 0;
|
||||
|
@ -302,7 +301,7 @@ void CalculateFrequency(void)
|
|||
// }
|
||||
WaveLenth = WaveLenth>>2;
|
||||
//¼ÆËãƵÂÊ
|
||||
CurWaveFrq = 1/(((float)WaveLenth)*((float)CurTimePerDiv)/50/1000);//单位kHz
|
||||
CurWaveFrq = 1/(((float)WaveLenth)*((double)CurTimePerDiv)/50/1000);//单位kHz
|
||||
Setting_Inf_Update(0);
|
||||
WaveLenth = 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue