Hello!
How can I do, for example, send 3.3v to PB13 and from PB12 receive the Sound_Play (1000, 100) signal ;?
thanks
Sound_Play
Re: Sound_Play
Hello!
Why can't I call the procedure VoltMeter? LED works! STM32F103
case X of
3:LED := 0; // 0 On
4:LED := 1; // 1 Off
5: VoltMeter;
end;
Thanks.
Why can't I call the procedure VoltMeter? LED works! STM32F103
case X of
3:LED := 0; // 0 On
4:LED := 1; // 1 Off
5: VoltMeter;
end;
Thanks.
Re: Sound_Play
Hi,
Can you please attach minimal project that demonstrates this issue ?
Regards,
Filip.
Can you please attach minimal project that demonstrates this issue ?
Regards,
Filip.
Re: Sound_Play
procedure VoltMeter;
begin
if (UART1_Data_Ready() <> 0) then // If data is received
begin
ADC_V := ADC1_Get_Sample (0); // read analog value from ADC1 module channel 0
//-------------------------- Volt --------------------------------------------------------------
Delay_ms(50);
Ref := 3.307 / 4095;
Delay_Cyc(102000); // 1 cycles pause
UART1_Read_Text(TestDelitel, '', 1);
XDelitel:= StrToInt(TestDelitel);
case XDelitel of
1:V := (ADC_V * Ref) * 10.05;
2:V := (ADC_V * Ref) * 9.9;// 1:10
end;
FloatToStr(V, Vtxt);
Vtxt[5]:= 0;
UART1_Write_Text(Vtxt);
end;
end;
////------------------------------------------------------------------------------------------------
begin
PortCofig();
/// 8.000000
UART1_Init_Advanced (115200, _UART_8_BIT_DATA, _UART_NOPARITY, _UART_ONE_STOPBIT, @_GPIO_MODULE_USART1_PA9_10);
Delay_ms(100); // Wait for UART module to stabilize
while (TRUE) do
begin
if (UART1_Data_Ready() <> 0) then // If data is received
begin
UART1_Read_Text(Test, '', 1);
X:= StrToInt(Test);
case X of
3:LED := 0; // 0 On
4:LED := 1; // 1 Off
5: VoltMeter;
end;
end;
end;
end.
Re: Sound_Play
Hi,
Although your code cannot be compiled, the VoltMeter procedure will be executed if the case state is 5, I have checked this in simulator.
Regards,
Filip.
Although your code cannot be compiled, the VoltMeter procedure will be executed if the case state is 5, I have checked this in simulator.
Regards,
Filip.
Re: Sound_Play
Hello!
Why won't it compile?
Procedure Voltmeter compiles and works. But I cannot call her.
Why won't it compile?
Procedure Voltmeter compiles and works. But I cannot call her.
Re: Sound_Play
Hi,
It won't compile as it lacks some declarations, like ADC_V, Ref, XDelitel, Vtxt variables and PortCofig procedure is missing definition.
Regards,
Filip.
It won't compile as it lacks some declarations, like ADC_V, Ref, XDelitel, Vtxt variables and PortCofig procedure is missing definition.
Regards,
Filip.
Re: Sound_Play
Hi, sorry
var uart_rd : byte;
X,XDelitel:Integer;
V,Ref:real;
ADC_V:word;
Vtxt : array[23] of char;
TestDelitel, Test: array[6] of char;
LED: sbit at GPIOC_ODR.B13;
///----------------------------------------------------------------------------------------
procedure PortCofig();
begin
GPIO_Digital_Output(@GPIOC_BASE, _GPIO_PINMASK_13);
LED := 1;
GPIO_Digital_Input(@GPIOA_ODR, _GPIO_PINMASK_0); // A0 Âîëüò
ADC_Set_Input_Channel(_ADC_CHANNEL_0);
ADC1_Init();
end;
var uart_rd : byte;
X,XDelitel:Integer;
V,Ref:real;
ADC_V:word;
Vtxt : array[23] of char;
TestDelitel, Test: array[6] of char;
LED: sbit at GPIOC_ODR.B13;
///----------------------------------------------------------------------------------------
procedure PortCofig();
begin
GPIO_Digital_Output(@GPIOC_BASE, _GPIO_PINMASK_13);
LED := 1;
GPIO_Digital_Input(@GPIOA_ODR, _GPIO_PINMASK_0); // A0 Âîëüò
ADC_Set_Input_Channel(_ADC_CHANNEL_0);
ADC1_Init();
end;