2026-06-08 17:33:46 +08:00
|
|
|
|
<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="端口:"/>
|
2026-06-12 16:30:29 +08:00
|
|
|
|
<ComboBox x:Name="cmbPort" Width="80" IsEditable="True" Text="COM2"/>
|
2026-06-08 17:33:46 +08:00
|
|
|
|
<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"/>
|
2026-06-08 17:50:08 +08:00
|
|
|
|
<Label Content="设定电流 (A):" Margin="20,0,0,0"/>
|
2026-06-17 14:31:52 +08:00
|
|
|
|
<TextBox x:Name="txtSetCurrent" Text="1" Width="80" TextAlignment="Center"/>
|
2026-06-08 17:33:46 +08:00
|
|
|
|
<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>
|
|
|
|
|
|
|
2026-06-08 17:50:08 +08:00
|
|
|
|
|
2026-06-08 17:33:46 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- 日志 -->
|
|
|
|
|
|
<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>
|