Files
ASTM-D7896-19TransientHot-W…/Window1.xaml
2026-06-08 17:33:46 +08:00

74 lines
3.9 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<Window x:Class="ConstantCurrentControl.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="SN-5A 恒流源控制" Height="500" Width="650"
WindowStartupLocation="CenterScreen">
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- 串口设置 -->
<GroupBox Header="串口设置" Grid.Row="0" Margin="5">
<StackPanel Orientation="Horizontal" Margin="5">
<Label Content="端口:"/>
<ComboBox x:Name="cmbPort" Width="80" IsEditable="True"/>
<Label Content="波特率:" Margin="10,0,0,0"/>
<ComboBox x:Name="cmbBaudrate" Width="80" SelectedIndex="1">
<ComboBoxItem>9600</ComboBoxItem>
<ComboBoxItem>19200</ComboBoxItem>
<ComboBoxItem>38400</ComboBoxItem>
<ComboBoxItem>115200</ComboBoxItem>
</ComboBox>
<Button x:Name="btnConnect" Content="连接" Click="BtnConnect_Click" Width="60" Margin="10,0,0,0"/>
<Button x:Name="btnDisconnect" Content="断开" Click="BtnDisconnect_Click" Width="60" Margin="5,0,0,0" IsEnabled="False"/>
</StackPanel>
</GroupBox>
<!-- 参数设置 -->
<GroupBox Header="输出参数(最优稳定性)" Grid.Row="1" Margin="5">
<StackPanel Margin="5">
<StackPanel Orientation="Horizontal" Margin="0,5,0,0">
<Label Content="频率:"/>
<RadioButton x:Name="rb50Hz" Content="50 Hz" GroupName="Freq" IsChecked="True" Margin="5,0,15,0"/>
<RadioButton x:Name="rb60Hz" Content="60 Hz" GroupName="Freq"/>
<Label Content=" 设定电流 (A):" Margin="20,0,0,0"/>
<TextBox x:Name="txtSetCurrent" Text="0.65" Width="80" TextAlignment="Right"/>
<Label Content="A"/>
<Button x:Name="btnSet" Content="直接设定" Click="BtnSet_Click" Width="80" Margin="10,0,0,0"/>
<Button x:Name="btnStop" Content="禁止输出" Click="BtnStop_Click" Width="80" Margin="5,0,0,0"/>
</StackPanel>
<CheckBox x:Name="chkSmooth" Content="启用平滑过渡 (步进0.05A, 间隔200ms)" IsChecked="True" Margin="0,5,0,0"/>
</StackPanel>
</GroupBox>
<!-- 反馈显示 -->
<GroupBox Header="实际回采 (软件滑动平均滤波)" Grid.Row="2" Margin="5">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Label Content="当前实际电流:" Grid.Column="0" FontWeight="Bold"/>
<TextBox x:Name="txtActualCurrent" Grid.Column="1" Text="0.000" IsReadOnly="True" FontSize="20" FontWeight="Bold" TextAlignment="Center" Background="LightYellow"/>
</Grid>
</GroupBox>
<!-- 日志 -->
<GroupBox Header="通讯日志" Grid.Row="3" Margin="5">
<ListBox x:Name="lstLog" Height="120" FontFamily="Consolas"/>
</GroupBox>
<!-- 说明 -->
<TextBlock Grid.Row="4" TextWrapping="Wrap" FontSize="11" Foreground="Gray" Margin="5">
※ 协议12字节命令 (FE FE + 识别码 + 电流高/低 + 模式+频率+跟踪 + FF FF)
※ 开启跟踪 (byte8=1) 和 PC调节 (byte6=1) 可获最低噪声与最小温漂
※ 平滑过渡可避免电流突变产生的冲击噪声
</TextBlock>
</Grid>
</Window>