📄 set7710dlg1.cpp
字号:
// Set7710Dlg1.cpp : implementation file
//
#include "stdafx.h"
#include "VCStyle.h"
#include "Set7710Dlg1.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#include "sja\\sjamacro.h"
#include "sja\\sjaexport.h"
/////////////////////////////////////////////////////////////////////////////
// Set7710Dlg dialog
//static UINT scale = 0;
static UINT scale;
static BOOL unipolar = TRUE;
static UINT sample_rate = 10;
extern UINT g_scale;
Set7710Dlg::Set7710Dlg(CWnd* pParent /*=NULL*/)
: CDialog(Set7710Dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(Set7710Dlg)
m_unipolar = unipolar;
m_addr = 7;
m_sample_rate = sample_rate;
m_scale = scale;
//}}AFX_DATA_INIT
}
void Set7710Dlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(Set7710Dlg)
DDX_Check(pDX, IDC_CHECK_UNIPOLAR, m_unipolar);
DDX_Text(pDX, IDC_EDIT_ADDR, m_addr);
DDX_Text(pDX, IDC_EDIT_SAMPLERATE, m_sample_rate);
DDX_CBIndex(pDX, IDC_COMBO_SCALE, m_scale);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(Set7710Dlg, CDialog)
//{{AFX_MSG_MAP(Set7710Dlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// Set7710Dlg message handlers
void Set7710Dlg::OnOK()
{
// TODO: Add extra validation here
UpdateData();
scale = m_scale;
unipolar = m_unipolar;
sample_rate = m_sample_rate;
// 发送设置命令
BYTE buf[11];
buf[0] = 8;//fixed
buf[1] = m_addr;
buf[2] = 0;//fixed
buf[3] = 0;//channel.fixed
buf[4] = 0x10;//command type.fixed
buf[5] = scale;//放大倍数
buf[6] = unipolar?1:0;
//code = 10M / (512 * f)
UINT code = 10*1000*1000/(512 * sample_rate);
buf[7] = (BYTE)(code>>8);
buf[8] = (BYTE)code;
Transmit(buf);
g_scale = 1<<scale;
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -