You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
634 lines
13 KiB
634 lines
13 KiB
|
4 weeks ago
|
|
||
|
|
// 9118SPtgDlg.cpp : implementation file
|
||
|
|
//
|
||
|
|
|
||
|
|
#include "stdafx.h"
|
||
|
|
#include "9118SPtg.h"
|
||
|
|
#include "9118SPtgDlg.h"
|
||
|
|
|
||
|
|
#ifdef _DEBUG
|
||
|
|
#define new DEBUG_NEW
|
||
|
|
#endif
|
||
|
|
|
||
|
|
CRect plotRect;
|
||
|
|
|
||
|
|
// CAboutDlg dialog used for App About
|
||
|
|
|
||
|
|
class CAboutDlg : public CDialog
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
CAboutDlg();
|
||
|
|
|
||
|
|
// Dialog Data
|
||
|
|
enum { IDD = IDD_ABOUTBOX };
|
||
|
|
|
||
|
|
protected:
|
||
|
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||
|
|
|
||
|
|
// Implementation
|
||
|
|
protected:
|
||
|
|
DECLARE_MESSAGE_MAP()
|
||
|
|
};
|
||
|
|
|
||
|
|
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
|
||
|
|
{
|
||
|
|
CDialog::DoDataExchange(pDX);
|
||
|
|
}
|
||
|
|
|
||
|
|
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
|
||
|
|
END_MESSAGE_MAP()
|
||
|
|
|
||
|
|
|
||
|
|
// C9118SPtgDlg dialog
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
C9118SPtgDlg::C9118SPtgDlg(I16 hCard, CWnd* pParent /*=NULL*/)
|
||
|
|
: CDialog(C9118SPtgDlg::IDD, pParent)
|
||
|
|
{
|
||
|
|
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
|
||
|
|
|
||
|
|
n_PlotWidth = n_PlotHeight = -1;
|
||
|
|
OnBrush = OffBrush = NULL;
|
||
|
|
|
||
|
|
min_val = 0x00;
|
||
|
|
max_val = 0x0FFF;
|
||
|
|
|
||
|
|
m_fSampleRate = 10000.0; // 10KHz
|
||
|
|
|
||
|
|
m_hCard = hCard;
|
||
|
|
|
||
|
|
m_wScanChans = 0;
|
||
|
|
m_nTimer = -1;
|
||
|
|
m_hMem=NULL;
|
||
|
|
|
||
|
|
m_wRange = AD_B_5_V;
|
||
|
|
m_dwReadCount = 1000;
|
||
|
|
m_wChannel = 0;
|
||
|
|
|
||
|
|
m_wCardType = PCI_9118DG;
|
||
|
|
}
|
||
|
|
|
||
|
|
void C9118SPtgDlg::DoDataExchange(CDataExchange* pDX)
|
||
|
|
{
|
||
|
|
CDialog::DoDataExchange(pDX);
|
||
|
|
}
|
||
|
|
|
||
|
|
BEGIN_MESSAGE_MAP(C9118SPtgDlg, CDialog)
|
||
|
|
ON_WM_SYSCOMMAND()
|
||
|
|
ON_WM_PAINT()
|
||
|
|
ON_WM_QUERYDRAGICON()
|
||
|
|
//}}AFX_MSG_MAP
|
||
|
|
ON_WM_DESTROY()
|
||
|
|
ON_WM_VSCROLL()
|
||
|
|
ON_BN_CLICKED(IDC_BT_START, &C9118SPtgDlg::OnStart)
|
||
|
|
ON_BN_CLICKED(IDC_RADIO_CH0, &C9118SPtgDlg::OnCh0)
|
||
|
|
ON_BN_CLICKED(IDC_RADIO_CH1, &C9118SPtgDlg::OnCh1)
|
||
|
|
ON_BN_CLICKED(IDC_RADIO_CH2, &C9118SPtgDlg::OnCh2)
|
||
|
|
ON_BN_CLICKED(IDC_RADIO_CH3, &C9118SPtgDlg::OnCh3)
|
||
|
|
ON_BN_CLICKED(IDC_RADIO_CH4, &C9118SPtgDlg::OnCh4)
|
||
|
|
ON_BN_CLICKED(IDC_RADIO_CH5, &C9118SPtgDlg::OnCh5)
|
||
|
|
ON_BN_CLICKED(IDC_RADIO_CH6, &C9118SPtgDlg::OnCh6)
|
||
|
|
ON_BN_CLICKED(IDC_RADIO_CH7, &C9118SPtgDlg::OnCh7)
|
||
|
|
ON_WM_TIMER()
|
||
|
|
ON_BN_CLICKED(IDC_BT_STOP, &C9118SPtgDlg::OnStop)
|
||
|
|
END_MESSAGE_MAP()
|
||
|
|
|
||
|
|
|
||
|
|
// C9118SPtgDlg message handlers
|
||
|
|
|
||
|
|
BOOL C9118SPtgDlg::OnInitDialog()
|
||
|
|
{
|
||
|
|
CDialog::OnInitDialog();
|
||
|
|
|
||
|
|
// Add "About..." menu item to system menu.
|
||
|
|
|
||
|
|
// IDM_ABOUTBOX must be in the system command range.
|
||
|
|
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
|
||
|
|
ASSERT(IDM_ABOUTBOX < 0xF000);
|
||
|
|
|
||
|
|
CMenu* pSysMenu = GetSystemMenu(FALSE);
|
||
|
|
if (pSysMenu != NULL)
|
||
|
|
{
|
||
|
|
BOOL bNameValid;
|
||
|
|
CString strAboutMenu;
|
||
|
|
bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
|
||
|
|
ASSERT(bNameValid);
|
||
|
|
if (!strAboutMenu.IsEmpty())
|
||
|
|
{
|
||
|
|
pSysMenu->AppendMenu(MF_SEPARATOR);
|
||
|
|
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// Set the icon for this dialog. The framework does this automatically
|
||
|
|
// when the application's main window is not a dialog
|
||
|
|
SetIcon(m_hIcon, TRUE); // Set big icon
|
||
|
|
SetIcon(m_hIcon, FALSE); // Set small icon
|
||
|
|
|
||
|
|
// TODO: Add extra initialization here
|
||
|
|
x_divider = 5; y_divider = 4;
|
||
|
|
|
||
|
|
OnBrush = CreateSolidBrush( RGB(255,0,0) );
|
||
|
|
OffBrush = CreateSolidBrush( RGB(125,0,0) );
|
||
|
|
|
||
|
|
RedPen.CreatePen( PS_SOLID, 1, RGB(255,0,0));
|
||
|
|
|
||
|
|
|
||
|
|
if( n_PlotWidth == -1 && n_PlotHeight == -1 )
|
||
|
|
{
|
||
|
|
((CWnd*)GetDlgItem(IDC_STATIC_DRAW))->GetWindowRect(&plotRect);
|
||
|
|
ScreenToClient(&plotRect);
|
||
|
|
|
||
|
|
n_PlotWidth = min( plotRect.Width(), 512);
|
||
|
|
n_PlotHeight = plotRect.Height() - 10;
|
||
|
|
}
|
||
|
|
|
||
|
|
GetDlgItem( IDC_STATIC_TRACE_CNT )->ShowWindow(TRUE);
|
||
|
|
GetDlgItem( IDC_EDIT_TRACE_CNT )->ShowWindow(TRUE);
|
||
|
|
|
||
|
|
m_wTraceCount = 512;
|
||
|
|
SetDlgItemInt( IDC_EDIT_TRACE_CNT, (UINT)m_wTraceCount );
|
||
|
|
|
||
|
|
|
||
|
|
// set the default SampleRate
|
||
|
|
SetDlgItemInt( IDC_EDIT_SAMPLE_RATE, (UINT)(m_fSampleRate/1000) );
|
||
|
|
SetDlgItemInt( IDC_EDIT_BUF_SIZE, (UINT)(m_dwReadCount) );
|
||
|
|
((CButton*)GetDlgItem( IDC_RADIO_CH0 ))->SetCheck( TRUE );
|
||
|
|
|
||
|
|
m_dwReadCount = 1024;
|
||
|
|
m_wChannel = 0;
|
||
|
|
|
||
|
|
max_range = 5.0;
|
||
|
|
min_range = -5.0;
|
||
|
|
|
||
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
||
|
|
}
|
||
|
|
|
||
|
|
void C9118SPtgDlg::OnSysCommand(UINT nID, LPARAM lParam)
|
||
|
|
{
|
||
|
|
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
|
||
|
|
{
|
||
|
|
CAboutDlg dlgAbout;
|
||
|
|
dlgAbout.DoModal();
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
CDialog::OnSysCommand(nID, lParam);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// If you add a minimize button to your dialog, you will need the code below
|
||
|
|
// to draw the icon. For MFC applications using the document/view model,
|
||
|
|
// this is automatically done for you by the framework.
|
||
|
|
|
||
|
|
void C9118SPtgDlg::OnPaint()
|
||
|
|
{
|
||
|
|
if (IsIconic())
|
||
|
|
{
|
||
|
|
CPaintDC dc(this); // device context for painting
|
||
|
|
|
||
|
|
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
|
||
|
|
|
||
|
|
// Center icon in client rectangle
|
||
|
|
int cxIcon = GetSystemMetrics(SM_CXICON);
|
||
|
|
int cyIcon = GetSystemMetrics(SM_CYICON);
|
||
|
|
CRect rect;
|
||
|
|
GetClientRect(&rect);
|
||
|
|
int x = (rect.Width() - cxIcon + 1) / 2;
|
||
|
|
int y = (rect.Height() - cyIcon + 1) / 2;
|
||
|
|
|
||
|
|
// Draw the icon
|
||
|
|
dc.DrawIcon(x, y, m_hIcon);
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
redraw_display_area();
|
||
|
|
CDialog::OnPaint();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// The system calls this function to obtain the cursor to display while the user drags
|
||
|
|
// the minimized window.
|
||
|
|
HCURSOR C9118SPtgDlg::OnQueryDragIcon()
|
||
|
|
{
|
||
|
|
return static_cast<HCURSOR>(m_hIcon);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
void C9118SPtgDlg::redraw_display_area(void)
|
||
|
|
{
|
||
|
|
CPen *oldPen;
|
||
|
|
|
||
|
|
int oldMode;
|
||
|
|
COLORREF oldColor;
|
||
|
|
|
||
|
|
CString y_lable;
|
||
|
|
|
||
|
|
CPen minor_tick( PS_SOLID,1,RGB(132,130,132) );
|
||
|
|
// CPen y_grid( PS_SOLID,1,RGB(206,203,132) );
|
||
|
|
|
||
|
|
int i, x_intv, y_intv;
|
||
|
|
// long total_sec;
|
||
|
|
|
||
|
|
CClientDC dc_plot(this);
|
||
|
|
|
||
|
|
// draw the base-line for x-y axises
|
||
|
|
oldPen = (CPen *)dc_plot.SelectStockObject(BLACK_PEN);
|
||
|
|
|
||
|
|
// redraw the background
|
||
|
|
dc_plot.FillSolidRect( plotRect, RGB(0,0,0) );
|
||
|
|
|
||
|
|
// Re-Draw the AREA for Y-Lable
|
||
|
|
{
|
||
|
|
CBrush DIALOG_BRUSH;
|
||
|
|
CRect redraw_area, full_client;
|
||
|
|
|
||
|
|
GetClientRect(&full_client);
|
||
|
|
ScreenToClient(&full_client);
|
||
|
|
|
||
|
|
redraw_area.left = full_client.left;
|
||
|
|
redraw_area.top = plotRect.top - 5;
|
||
|
|
redraw_area.right = plotRect.left - 3;
|
||
|
|
redraw_area.bottom = plotRect.bottom + 10;
|
||
|
|
|
||
|
|
DIALOG_BRUSH.CreateSysColorBrush( COLOR_3DFACE );
|
||
|
|
|
||
|
|
dc_plot.FillRect( redraw_area, &DIALOG_BRUSH );
|
||
|
|
|
||
|
|
DIALOG_BRUSH.DeleteObject();
|
||
|
|
}
|
||
|
|
|
||
|
|
dc_plot.MoveTo( plotRect.left - 3, plotRect.top );
|
||
|
|
dc_plot.LineTo( plotRect.left - 3, plotRect.bottom );
|
||
|
|
|
||
|
|
// calculate the interval for tick/grid
|
||
|
|
y_intv = (plotRect.Height() - 10) /y_divider;
|
||
|
|
x_intv = plotRect.Width()/x_divider;
|
||
|
|
|
||
|
|
|
||
|
|
// set the color for tick
|
||
|
|
oldColor = dc_plot.SetTextColor( RGB(0,0,0) );
|
||
|
|
oldMode = dc_plot.SetBkMode( TRANSPARENT );
|
||
|
|
|
||
|
|
for( i=0; i<= y_divider; i++ )
|
||
|
|
{
|
||
|
|
CString tick_str;
|
||
|
|
CRect tmp_rect, tick_rect;
|
||
|
|
|
||
|
|
// draw the tick for y-axis
|
||
|
|
dc_plot.MoveTo( plotRect.left -12, plotRect.bottom -5 - (i*y_intv) );
|
||
|
|
dc_plot.LineTo( plotRect.left -3, plotRect.bottom -5 - (i*y_intv) );
|
||
|
|
|
||
|
|
tick_str.Format( _T("%.1f"), ( ((max_range-min_range)/y_divider) * i)+min_range );
|
||
|
|
|
||
|
|
// calculate the rectangle for text
|
||
|
|
dc_plot.DrawText( tick_str, &tmp_rect, DT_CALCRECT|DT_SINGLELINE );
|
||
|
|
tick_rect.right = plotRect.left -14;
|
||
|
|
tick_rect.left = tick_rect.right - tmp_rect.Width();
|
||
|
|
tick_rect.top = plotRect.bottom -5 - (i*y_intv) - tmp_rect.Height()/2;
|
||
|
|
tick_rect.bottom = tick_rect.top + tmp_rect.Height();
|
||
|
|
|
||
|
|
// draw the text
|
||
|
|
dc_plot.DrawText( tick_str, &tick_rect, DT_SINGLELINE|DT_RIGHT );
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
// draw the minor_tick for Y axises
|
||
|
|
dc_plot.SelectObject(&minor_tick);
|
||
|
|
for( i=0; i< y_divider; i++ )
|
||
|
|
{
|
||
|
|
dc_plot.MoveTo( plotRect.left -9, plotRect.bottom -5 - (i*y_intv) - y_intv/2 );
|
||
|
|
dc_plot.LineTo( plotRect.left -4, plotRect.bottom -5 - (i*y_intv) - y_intv/2 );
|
||
|
|
}
|
||
|
|
|
||
|
|
dc_plot.SetTextColor( oldColor );
|
||
|
|
dc_plot.SetBkMode( oldMode );
|
||
|
|
dc_plot.SelectObject( oldPen );
|
||
|
|
}
|
||
|
|
|
||
|
|
void C9118SPtgDlg::OnDestroy()
|
||
|
|
{
|
||
|
|
CDialog::OnDestroy();
|
||
|
|
|
||
|
|
// TODO: Add your message handler code here
|
||
|
|
if( m_nTimer != -1 )
|
||
|
|
{
|
||
|
|
KillTimer( m_nTimer );
|
||
|
|
m_nTimer = -1;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (m_hMem != NULL)
|
||
|
|
{
|
||
|
|
GlobalUnfix(m_hMem);
|
||
|
|
GlobalUnlock(m_hMem);
|
||
|
|
GlobalFree(m_hMem);
|
||
|
|
|
||
|
|
m_hMem = NULL;
|
||
|
|
}
|
||
|
|
|
||
|
|
if( OnBrush != NULL )
|
||
|
|
::DeleteObject( OnBrush );
|
||
|
|
|
||
|
|
if( OffBrush != NULL )
|
||
|
|
::DeleteObject( OffBrush );
|
||
|
|
|
||
|
|
RedPen.DeleteObject();
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
void C9118SPtgDlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
|
||
|
|
{
|
||
|
|
// TODO: Add your message handler code here and/or call default
|
||
|
|
switch ( nSBCode )
|
||
|
|
{
|
||
|
|
case SB_LINEUP :
|
||
|
|
m_fSampleRate += 5000.0;
|
||
|
|
if (m_fSampleRate > 50000.0 ) m_fSampleRate = 50000.0;
|
||
|
|
break;
|
||
|
|
case SB_LINEDOWN:
|
||
|
|
m_fSampleRate -= 5000.0;
|
||
|
|
if (m_fSampleRate < 5000.0 ) m_fSampleRate = 5000.0;
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
|
||
|
|
SetDlgItemInt( IDC_EDIT_SAMPLE_RATE, (UINT)(m_fSampleRate/1000) );
|
||
|
|
|
||
|
|
CDialog::OnVScroll(nSBCode, nPos, pScrollBar);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
void C9118SPtgDlg::OnStop()
|
||
|
|
{
|
||
|
|
// TODO: Add your control notification handler code here
|
||
|
|
U32 count;
|
||
|
|
|
||
|
|
|
||
|
|
AI_AsyncClear(m_hCard, &count);
|
||
|
|
|
||
|
|
if( m_nTimer != -1 )
|
||
|
|
{
|
||
|
|
KillTimer( m_nTimer );
|
||
|
|
m_nTimer = -1;
|
||
|
|
}
|
||
|
|
|
||
|
|
GetDlgItem( IDC_BT_START )->EnableWindow(TRUE);
|
||
|
|
}
|
||
|
|
|
||
|
|
void C9118SPtgDlg::OnStart()
|
||
|
|
{
|
||
|
|
// TODO: Add your control notification handler code here
|
||
|
|
DWORD mem_size;
|
||
|
|
CString strTemp;
|
||
|
|
I16 err;
|
||
|
|
|
||
|
|
GetDlgItem( IDC_BT_START )->EnableWindow(FALSE);
|
||
|
|
|
||
|
|
m_dwReadCount = GetDlgItemInt(IDC_EDIT_BUF_SIZE);
|
||
|
|
m_wTraceCount = GetDlgItemInt(IDC_EDIT_TRACE_CNT);
|
||
|
|
|
||
|
|
|
||
|
|
if (m_dwReadCount <= m_wTraceCount)
|
||
|
|
{
|
||
|
|
strTemp.Format( TEXT("Buffer Size have to be larger than %d"), m_wTraceCount+2);
|
||
|
|
AfxMessageBox( strTemp );
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (m_hMem != NULL)
|
||
|
|
{
|
||
|
|
GlobalUnfix(m_hMem);
|
||
|
|
GlobalUnlock(m_hMem);
|
||
|
|
GlobalFree(m_hMem);
|
||
|
|
|
||
|
|
m_hMem = NULL;
|
||
|
|
}
|
||
|
|
|
||
|
|
// allocate a memory for user DMA buffer
|
||
|
|
mem_size = m_dwReadCount * sizeof(I16);
|
||
|
|
m_hMem = GlobalAlloc(GMEM_ZEROINIT, mem_size);
|
||
|
|
m_pAIBuf = (U16*) GlobalLock(m_hMem);
|
||
|
|
if (m_pAIBuf == NULL )
|
||
|
|
{
|
||
|
|
AfxMessageBox( TEXT("Memory allocation failed") );
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
GlobalFix(m_hMem);
|
||
|
|
|
||
|
|
err = AI_9118_Config(m_hCard, P9118_AI_BiPolar|P9118_AI_SingEnded, P9118_AI_DtrgPositive|P9118_AI_EtrgPositive|P9118_AI_PostTrgEn, 0, m_wTraceCount);
|
||
|
|
if (err!=0)
|
||
|
|
{
|
||
|
|
strTemp.Format( TEXT("AI_9118_Config error=%d"), err);
|
||
|
|
AfxMessageBox( strTemp );
|
||
|
|
}
|
||
|
|
|
||
|
|
err=AI_AsyncDblBufferMode(m_hCard, 0); // single-buffer mode
|
||
|
|
if (err!=0)
|
||
|
|
{
|
||
|
|
strTemp.Format( TEXT("AI_DblBufferMode error=%d"), err);
|
||
|
|
AfxMessageBox( strTemp );
|
||
|
|
}
|
||
|
|
|
||
|
|
err=AI_ContReadChannel (m_hCard, m_wChannel, m_wRange, (U16*)m_pAIBuf, m_dwReadCount, (F64)m_fSampleRate, ASYNCH_OP);
|
||
|
|
if (err!=0)
|
||
|
|
{
|
||
|
|
strTemp.Format( TEXT("AI_ContReadChannel error=%d"), err);
|
||
|
|
AfxMessageBox( strTemp );
|
||
|
|
}
|
||
|
|
|
||
|
|
m_nTimer = SetTimer( 1, 50, NULL );
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
int C9118SPtgDlg::display_buffer_data(U16* pBuf)
|
||
|
|
{
|
||
|
|
CClientDC dc_plot(this);
|
||
|
|
int nDraw_Origin_Y;
|
||
|
|
int cur_channel;
|
||
|
|
|
||
|
|
int newY = -1;
|
||
|
|
int newX = -1;
|
||
|
|
U32 index;
|
||
|
|
|
||
|
|
// redraw the background
|
||
|
|
dc_plot.FillSolidRect( plotRect, RGB(0,0,0) );
|
||
|
|
|
||
|
|
dc_plot.SelectObject(&RedPen);
|
||
|
|
nDraw_Origin_Y = ( plotRect.bottom - 5 ); // - n_PlotHeight/2;
|
||
|
|
|
||
|
|
for( index=0; index<m_wTraceCount; index++ )
|
||
|
|
{
|
||
|
|
|
||
|
|
if( m_wCardType == PCI_9118HR )
|
||
|
|
{
|
||
|
|
I16 ai_data2;
|
||
|
|
|
||
|
|
cur_channel = index%(m_wScanChans+1);
|
||
|
|
ai_data2 = (I16)(pBuf[index]);
|
||
|
|
newY = (int)( (nDraw_Origin_Y - n_PlotHeight/2) - ((n_PlotHeight * ai_data2) >> 16) ); // ( n_PlotHeight * ai_data / 65536) ); // ( (n_PlotHeight/2) * ai_data/32768 ) );
|
||
|
|
}
|
||
|
|
else // PCI_9118DG & PCI_9118HG
|
||
|
|
{
|
||
|
|
U16 ai_data;
|
||
|
|
|
||
|
|
cur_channel = pBuf[index] & 0x0f;
|
||
|
|
ai_data = (U16)(pBuf[index]) >> 4;
|
||
|
|
newY = (int)( nDraw_Origin_Y - ((n_PlotHeight * ai_data) >> 12 ) ); // (n_PlotHeight * ai_data / 4096 ) ); // ( (n_PlotHeight/2) * ai_data/2048 ) );
|
||
|
|
}
|
||
|
|
|
||
|
|
newX = (int)( index*n_PlotWidth/m_dwReadCount + plotRect.left );
|
||
|
|
|
||
|
|
if ( index == 0 )
|
||
|
|
{
|
||
|
|
dc_plot.MoveTo( newX, newY );
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
dc_plot.MoveTo( m_oldX, m_oldY );
|
||
|
|
dc_plot.LineTo( newX, newY );
|
||
|
|
}
|
||
|
|
|
||
|
|
m_oldX = newX;
|
||
|
|
m_oldY = newY;
|
||
|
|
}
|
||
|
|
|
||
|
|
return 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
void C9118SPtgDlg::OnTimer(UINT_PTR nIDEvent)
|
||
|
|
{
|
||
|
|
// TODO: Add your message handler code here and/or call default
|
||
|
|
BOOLEAN fstop;
|
||
|
|
U32 count;
|
||
|
|
|
||
|
|
AI_AsyncCheck(m_hCard, &fstop, &count);
|
||
|
|
|
||
|
|
if( fstop == TRUE )
|
||
|
|
{
|
||
|
|
AI_AsyncClear(m_hCard, &count);
|
||
|
|
|
||
|
|
KillTimer( m_nTimer );
|
||
|
|
m_nTimer = -1;
|
||
|
|
|
||
|
|
display_buffer_data( m_pAIBuf );
|
||
|
|
|
||
|
|
GetDlgItem( IDC_BT_START )->EnableWindow(TRUE);
|
||
|
|
}
|
||
|
|
|
||
|
|
CDialog::OnTimer(nIDEvent);
|
||
|
|
}
|
||
|
|
|
||
|
|
void C9118SPtgDlg::OnCh0()
|
||
|
|
{
|
||
|
|
// TODO: Add your control notification handler code here
|
||
|
|
int CheckSts;
|
||
|
|
|
||
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_RADIO_CH0 ))->GetCheck();
|
||
|
|
|
||
|
|
if( CheckSts == BST_CHECKED )
|
||
|
|
{
|
||
|
|
m_wChannel = 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
void C9118SPtgDlg::OnCh1()
|
||
|
|
{
|
||
|
|
// TODO: Add your control notification handler code here
|
||
|
|
int CheckSts;
|
||
|
|
|
||
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_RADIO_CH1 ))->GetCheck();
|
||
|
|
|
||
|
|
if( CheckSts == BST_CHECKED )
|
||
|
|
{
|
||
|
|
m_wChannel = 1;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
void C9118SPtgDlg::OnCh2()
|
||
|
|
{
|
||
|
|
// TODO: Add your control notification handler code here
|
||
|
|
int CheckSts;
|
||
|
|
|
||
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_RADIO_CH2 ))->GetCheck();
|
||
|
|
|
||
|
|
if( CheckSts == BST_CHECKED )
|
||
|
|
{
|
||
|
|
m_wChannel = 2;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
void C9118SPtgDlg::OnCh3()
|
||
|
|
{
|
||
|
|
// TODO: Add your control notification handler code here
|
||
|
|
int CheckSts;
|
||
|
|
|
||
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_RADIO_CH3 ))->GetCheck();
|
||
|
|
|
||
|
|
if( CheckSts == BST_CHECKED )
|
||
|
|
{
|
||
|
|
m_wChannel = 3;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
void C9118SPtgDlg::OnCh4()
|
||
|
|
{
|
||
|
|
// TODO: Add your control notification handler code here
|
||
|
|
int CheckSts;
|
||
|
|
|
||
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_RADIO_CH4 ))->GetCheck();
|
||
|
|
|
||
|
|
if( CheckSts == BST_CHECKED )
|
||
|
|
{
|
||
|
|
m_wChannel = 4;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
void C9118SPtgDlg::OnCh5()
|
||
|
|
{
|
||
|
|
// TODO: Add your control notification handler code here
|
||
|
|
int CheckSts;
|
||
|
|
|
||
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_RADIO_CH5 ))->GetCheck();
|
||
|
|
|
||
|
|
if( CheckSts == BST_CHECKED )
|
||
|
|
{
|
||
|
|
m_wChannel = 5;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
void C9118SPtgDlg::OnCh6()
|
||
|
|
{
|
||
|
|
// TODO: Add your control notification handler code here
|
||
|
|
int CheckSts;
|
||
|
|
|
||
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_RADIO_CH6 ))->GetCheck();
|
||
|
|
|
||
|
|
if( CheckSts == BST_CHECKED )
|
||
|
|
{
|
||
|
|
m_wChannel = 6;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
void C9118SPtgDlg::OnCh7()
|
||
|
|
{
|
||
|
|
// TODO: Add your control notification handler code here
|
||
|
|
int CheckSts;
|
||
|
|
|
||
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_RADIO_CH7 ))->GetCheck();
|
||
|
|
|
||
|
|
if( CheckSts == BST_CHECKED )
|
||
|
|
{
|
||
|
|
m_wChannel = 7;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|