终于看到正弦波了 哈哈哈哈
This commit is contained in:
parent
edd4771aed
commit
16f3f304f2
|
@ -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\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
|
||||
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
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -553,10 +553,11 @@ 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\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
|
||||
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
|
||||
|
||||
|
||||
|
||||
|
|
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.1.0</PackID>
|
||||
<PackID>Keil.STM32F1xx_DFP.2.0.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>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
|
||||
|
||||
#define MeasurementRange 200
|
||||
#define MeasurementRange 3.2
|
||||
|
||||
/*
|
||||
******************************************************************
|
||||
|
@ -31,7 +31,7 @@ rt_thread_t KeyScan_thread = RT_NULL;
|
|||
|
||||
//可设置项
|
||||
char* RangeMode[] = {"Auto", "Manu"};
|
||||
char* TriggerMode[] = {"↑", "↓"};
|
||||
char* TriggerMode[] = {"Up", "Down"};
|
||||
char* SamplingMode[] = {"A", "N", "S"};
|
||||
uint16_t TimePerDiv_Group[] = {2, 5, 10, 20, 50, 100, 200, 500};
|
||||
|
||||
|
@ -42,11 +42,11 @@ uint8_t TimePerDivOderNbr = sizeof(TimePerDiv_Group)/sizeof(TimePerDiv_Group[0]
|
|||
int8_t TimePerDivOder = 0;//当前每格间隔时间的序号
|
||||
|
||||
|
||||
int16_t CurTriggerValue = 0; //代号0,触发阀值
|
||||
char* CurRangeMode = {"auto"}; //代号1,量程模式,0:自动,1:手动
|
||||
char* CurTriggerMode = {"↑"}; //代号2,触发模式,0:下降沿触发,1:上升沿触发
|
||||
float CurTriggerValue = 0.0; //代号0,触发阀值
|
||||
char* CurRangeMode = {"Auto"}; //代号1,量程模式,0:自动,1:手动
|
||||
char* CurTriggerMode = {"Up"}; //代号2,触发模式,0:下降沿触发,1:上升沿触发
|
||||
char* CurSamplingMode = {"A"}; //代号3,采样模式,0:自动,1:普通,2:单次
|
||||
uint16_t CurTimePerDiv = 1; //代号4,每格代表的时间间隔
|
||||
uint16_t CurTimePerDiv = 500; //代号4,每格代表的时间间隔
|
||||
|
||||
//要显示的信息
|
||||
__IO uint16_t ADC_ConvertedValue[ADCx_1_SampleNbr] = {0};//ADC采集数据
|
||||
|
@ -73,11 +73,10 @@ static void Setting_do(uint8_t CurSetItem, int8_t Operation)
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
CurTriggerValue += Operation;
|
||||
if(CurTriggerValue < 0)
|
||||
CurTriggerValue = 0;
|
||||
if(CurTriggerValue > MeasurementRange)
|
||||
CurTriggerValue = MeasurementRange;
|
||||
if((Operation > 0) && (CurTriggerValue < MeasurementRange))
|
||||
CurTriggerValue += 0.1;
|
||||
if((Operation < 0) && (CurTriggerValue > 0.1))
|
||||
CurTriggerValue -= 0.1;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
|
@ -87,6 +86,7 @@ static void Setting_do(uint8_t CurSetItem, int8_t Operation)
|
|||
RangeModeNrb = 0;
|
||||
if(RangeModeNrb > 1)
|
||||
RangeModeNrb = 1;
|
||||
CurRangeMode = RangeMode[RangeModeNrb];
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
|
@ -96,6 +96,7 @@ static void Setting_do(uint8_t CurSetItem, int8_t Operation)
|
|||
TriggerModeNrb = 0;
|
||||
if(TriggerModeNrb > 1)
|
||||
TriggerModeNrb = 1;
|
||||
CurTriggerMode = TriggerMode[TriggerModeNrb];
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
|
@ -105,6 +106,7 @@ static void Setting_do(uint8_t CurSetItem, int8_t Operation)
|
|||
SamplingModeNrb = 0;
|
||||
if(SamplingModeNrb > 2)
|
||||
SamplingModeNrb = 2;
|
||||
CurSamplingMode = SamplingMode[SamplingModeNrb];
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
|
@ -120,7 +122,7 @@ static void Setting_do(uint8_t CurSetItem, int8_t Operation)
|
|||
default :
|
||||
break;
|
||||
}
|
||||
rt_kprintf("TriggerValue: %d\n",CurTriggerValue);
|
||||
rt_kprintf("TriggerValue: %.1f\n",CurTriggerValue);
|
||||
rt_kprintf("RangeMode: %s\n",CurRangeMode);
|
||||
rt_kprintf("TriggerMode: %s\n",CurTriggerMode);
|
||||
rt_kprintf("Sampling_mode: %s\n",CurSamplingMode);
|
||||
|
@ -136,37 +138,40 @@ static void Setting_do(uint8_t CurSetItem, int8_t Operation)
|
|||
*/
|
||||
void Setting_Inf_Update(uint8_t CurSetItem)
|
||||
{
|
||||
char dispBuff[100];
|
||||
float ConvertedTriggerValue;//用于将触发阀值单位转换为伏特
|
||||
char dispBuff[100];
|
||||
ILI9341_Clear(240, 0, 20, 240);
|
||||
ILI9341_DispString_EN(240, (((sFONT *)LCD_GetFont())->Height)*CurSetItem, "->");
|
||||
switch(CurSetItem)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
ConvertedTriggerValue = CurTriggerValue/200*3.3;
|
||||
ILI9341_Clear(260, (((sFONT *)LCD_GetFont())->Height)*0, 60, (((sFONT *)LCD_GetFont())->Height));
|
||||
/*使用c标准库把变量转化成字符串*/
|
||||
sprintf(dispBuff,"%f V", ConvertedTriggerValue);
|
||||
sprintf(dispBuff,"%.1f V", CurTriggerValue);
|
||||
ILI9341_DispString_EN(260, (((sFONT *)LCD_GetFont())->Height)*0, dispBuff);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
ILI9341_Clear(260, (((sFONT *)LCD_GetFont())->Height)*1, 60, (((sFONT *)LCD_GetFont())->Height));
|
||||
ILI9341_DispString_EN(260, (((sFONT *)LCD_GetFont())->Height)*1, CurRangeMode);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
ILI9341_DispString_EN(260, (((sFONT *)LCD_GetFont())->Height)*0, CurTriggerMode);
|
||||
ILI9341_Clear(260, (((sFONT *)LCD_GetFont())->Height)*2, 60, (((sFONT *)LCD_GetFont())->Height));
|
||||
ILI9341_DispString_EN(260, (((sFONT *)LCD_GetFont())->Height)*2, CurTriggerMode);
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
ILI9341_DispString_EN(260, (((sFONT *)LCD_GetFont())->Height)*1, CurSamplingMode);
|
||||
ILI9341_Clear(260, (((sFONT *)LCD_GetFont())->Height)*3, 60, (((sFONT *)LCD_GetFont())->Height));
|
||||
ILI9341_DispString_EN(260, (((sFONT *)LCD_GetFont())->Height)*3, CurSamplingMode);
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
ILI9341_Clear(260, (((sFONT *)LCD_GetFont())->Height)*4, 60, (((sFONT *)LCD_GetFont())->Height));
|
||||
/*使用c标准库把变量转化成字符串*/
|
||||
sprintf(dispBuff,"%d ms", CurTimePerDiv);
|
||||
ILI9341_DispString_EN(260, (((sFONT *)LCD_GetFont())->Height)*4, dispBuff);
|
||||
|
@ -249,7 +254,7 @@ void PlotWave(void* parameter)
|
|||
for(i=0; i <= ADCx_1_SampleNbr-2; i++)
|
||||
{
|
||||
LCD_SetTextColor(WHITE);
|
||||
ILI9341_DrawLine ( Wave_Centor_X-(Wave_Width/2)+i, ADC_ConvertedValue[i] /21, Wave_Centor_X-(Wave_Width/2)+i+1, ADC_ConvertedValue[i+1] /21 );
|
||||
ILI9341_DrawLine ( Wave_Centor_X-(Wave_Width/2)+i, ADC_ConvertedValue[i], Wave_Centor_X-(Wave_Width/2)+i+1, ADC_ConvertedValue[i+1] );
|
||||
}
|
||||
}
|
||||
flag = 0;
|
||||
|
|
|
@ -16,7 +16,7 @@ extern int8_t RangeModeNrb;
|
|||
extern int8_t TriggerModeNrb;
|
||||
extern int8_t SamplingModeNrb;
|
||||
|
||||
extern int16_t CurTriggerValue; //代号0,触发阀值
|
||||
extern float CurTriggerValue; //代号0,触发阀值
|
||||
extern char* CurRangeMode; //代号1,量程模式,0:自动,1:手动
|
||||
extern char* CurTriggerMode; //代号2,触发模式,0:下降沿触发,1:上升沿触发,2:上升沿下降沿触发
|
||||
extern char* CurSamplingMode; //代号3,采样模式,0:自动,1:普通,2:单次
|
||||
|
|
|
@ -128,6 +128,7 @@ void ADCx_Init(void)
|
|||
FlagStatus Get_Trigger_Status(void)
|
||||
{
|
||||
uint16_t d0, d1;
|
||||
uint8_t ConvertedTriggerValue = CurTriggerValue/3.3*200-0.5;//用于转换触发阀值
|
||||
|
||||
if(SamplingModeNrb == 0)
|
||||
return SET;
|
||||
|
@ -143,12 +144,12 @@ FlagStatus Get_Trigger_Status(void)
|
|||
|
||||
if(TriggerModeNrb == 0)
|
||||
{
|
||||
if((d0 >= CurTriggerValue) && (d1 <= CurTriggerValue))
|
||||
if((d0 >= ConvertedTriggerValue) && (d1 <= ConvertedTriggerValue))
|
||||
return SET;
|
||||
}
|
||||
else if(TriggerModeNrb == 1)
|
||||
{
|
||||
if((d1 >= CurTriggerValue) && (d0 <= CurTriggerValue))
|
||||
if((d1 >= ConvertedTriggerValue) && (d0 <= ConvertedTriggerValue))
|
||||
return SET;
|
||||
}
|
||||
}
|
||||
|
@ -159,7 +160,7 @@ FlagStatus Get_Trigger_Status(void)
|
|||
|
||||
void Get_Wave(void* parameter)
|
||||
{
|
||||
uint8_t flag = 1;//波形数据采集完成标志位
|
||||
uint8_t flag = 1, i=1;//波形数据采集完成标志位
|
||||
uint16_t ADC_SampleCount = 0;
|
||||
|
||||
while(1)
|
||||
|
@ -170,11 +171,23 @@ void Get_Wave(void* parameter)
|
|||
while(ADC_SampleCount < ADCx_1_SampleNbr)
|
||||
{
|
||||
while(ADC_GetITStatus(ADCx_1, ADC_IT_EOC) != SET);
|
||||
ADC_ConvertedValue[ADC_SampleCount] = ADC_GetConversionValue(ADCx_1)*200/255-0.5;//将采样值映射到显示区间
|
||||
ADC_ConvertedValue[ADC_SampleCount] = ADC_GetConversionValue(ADCx_1)*200/4096-0.5;//将采样值映射到显示区间
|
||||
Delay_us( CurTimePerDiv*1000/50 -7 );//²ÉÑù¼ä¸ôʱ¼ä
|
||||
ADC_ClearITPendingBit(ADCx_1, ADC_IT_EOC);
|
||||
ADC_SampleCount++;
|
||||
}
|
||||
if(i==1)
|
||||
{
|
||||
i=0;
|
||||
while(i < ADCx_1_SampleNbr)
|
||||
{
|
||||
rt_kprintf("%d ",ADC_ConvertedValue[i]);
|
||||
if(i%10 == 0)
|
||||
rt_kprintf("\n");
|
||||
i++;
|
||||
}
|
||||
i=0;
|
||||
}
|
||||
if(SamplingModeNrb == 2)
|
||||
{
|
||||
StopSample = SET;
|
||||
|
|
13
User/board.c
13
User/board.c
|
@ -74,18 +74,15 @@ void rt_hw_board_init()
|
|||
|
||||
ILI9341_DispString_EN(240, (((sFONT *)LCD_GetFont())->Height)*0, "->");
|
||||
char dispBuff[100];
|
||||
/*使用c标准库把变量转化成字符串*/
|
||||
sprintf(dispBuff,"TV: %d", CurTriggerValue);
|
||||
ILI9341_DispString_EN(260, (((sFONT *)LCD_GetFont())->Height)*0, dispBuff);
|
||||
|
||||
ILI9341_DispString_EN(260, (((sFONT *)LCD_GetFont())->Height)*0, "0.0 V");
|
||||
ILI9341_DispString_EN(260, (((sFONT *)LCD_GetFont())->Height)*1, CurRangeMode);
|
||||
|
||||
ILI9341_DispString_EN(260, (((sFONT *)LCD_GetFont())->Height)*2, CurTriggerMode);
|
||||
|
||||
ILI9341_DispString_EN(260, (((sFONT *)LCD_GetFont())->Height)*3, CurTriggerMode);
|
||||
|
||||
sprintf(dispBuff,"TPD: %d", CurTimePerDiv);
|
||||
ILI9341_DispString_EN(260, (((sFONT *)LCD_GetFont())->Height)*3, CurSamplingMode);
|
||||
/*使用c标准库把变量转化成字符串*/
|
||||
sprintf(dispBuff,"%d ms", CurTimePerDiv);
|
||||
ILI9341_DispString_EN(260, (((sFONT *)LCD_GetFont())->Height)*4, dispBuff);
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue