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.
1582 lines
32 KiB
1582 lines
32 KiB
|
|
// Util7296Dlg.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "Util7296.h"
|
|
#include "Util7296Dlg.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#endif
|
|
|
|
|
|
// 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()
|
|
|
|
|
|
// CUtil7296Dlg dialog
|
|
|
|
|
|
|
|
|
|
CUtil7296Dlg::CUtil7296Dlg(I16 hCard, CWnd* pParent /*=NULL*/)
|
|
: CDialog(CUtil7296Dlg::IDD, pParent)
|
|
{
|
|
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
|
|
|
|
m_InPortA = Channel_P1A;
|
|
m_OutPortA = Channel_P2A;
|
|
m_InPortB = Channel_P1B;
|
|
m_OutPortB = Channel_P2B;
|
|
m_InPortCL = Channel_P1CL;
|
|
m_OutPortCL = Channel_P2CL;
|
|
m_InPortCH = Channel_P1CH;
|
|
m_OutPortCH = Channel_P2CH;
|
|
|
|
m_InDataPortA = 0x00;
|
|
m_OutDataPortA = 0x00;
|
|
m_InDataPortB = 0x00;
|
|
m_OutDataPortB = 0x00;
|
|
m_InDataPortCL = 0x00;
|
|
m_OutDataPortCL = 0x00;
|
|
m_InDataPortCH = 0x00;
|
|
m_OutDataPortCH = 0x00;
|
|
|
|
m_hCard = hCard;
|
|
m_nTimer = -1;
|
|
}
|
|
|
|
void CUtil7296Dlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
DDX_Control(pDX, IDC_ICON_PC0, m_Icon_PC0);
|
|
DDX_Control(pDX, IDC_ICON_PC1, m_Icon_PC1);
|
|
DDX_Control(pDX, IDC_ICON_PC2, m_Icon_PC2);
|
|
DDX_Control(pDX, IDC_ICON_PC3, m_Icon_PC3);
|
|
DDX_Control(pDX, IDC_ICON_PC4, m_Icon_PC4);
|
|
DDX_Control(pDX, IDC_ICON_PC5, m_Icon_PC5);
|
|
DDX_Control(pDX, IDC_ICON_PC6, m_Icon_PC6);
|
|
DDX_Control(pDX, IDC_ICON_PC7, m_Icon_PC7);
|
|
DDX_Control(pDX, IDC_ICON_PB0, m_Icon_PB0);
|
|
DDX_Control(pDX, IDC_ICON_PB1, m_Icon_PB1);
|
|
DDX_Control(pDX, IDC_ICON_PB2, m_Icon_PB2);
|
|
DDX_Control(pDX, IDC_ICON_PB3, m_Icon_PB3);
|
|
DDX_Control(pDX, IDC_ICON_PB4, m_Icon_PB4);
|
|
DDX_Control(pDX, IDC_ICON_PB5, m_Icon_PB5);
|
|
DDX_Control(pDX, IDC_ICON_PB6, m_Icon_PB6);
|
|
DDX_Control(pDX, IDC_ICON_PB7, m_Icon_PB7);
|
|
DDX_Control(pDX, IDC_ICON_PA0, m_Icon_PA0);
|
|
DDX_Control(pDX, IDC_ICON_PA1, m_Icon_PA1);
|
|
DDX_Control(pDX, IDC_ICON_PA2, m_Icon_PA2);
|
|
DDX_Control(pDX, IDC_ICON_PA3, m_Icon_PA3);
|
|
DDX_Control(pDX, IDC_ICON_PA4, m_Icon_PA4);
|
|
DDX_Control(pDX, IDC_ICON_PA5, m_Icon_PA5);
|
|
DDX_Control(pDX, IDC_ICON_PA6, m_Icon_PA6);
|
|
DDX_Control(pDX, IDC_ICON_PA7, m_Icon_PA7);
|
|
DDX_Control(pDX, IDC_COMBO_IN_PA, m_cbPortAIn);
|
|
DDX_Control(pDX, IDC_COMBO_IN_PB, m_cbPortBIn);
|
|
DDX_Control(pDX, IDC_COMBO_IN_PCL, m_cbPortCLIn);
|
|
DDX_Control(pDX, IDC_COMBO_IN_PCH, m_cbPortCHIn);
|
|
DDX_Control(pDX, IDC_COMBO_OUT_PA, m_cbPortAOut);
|
|
DDX_Control(pDX, IDC_COMBO_OUT_PB, m_cbPortBOut);
|
|
DDX_Control(pDX, IDC_COMBO_OUT_PCL, m_cbPortCLOut);
|
|
DDX_Control(pDX, IDC_COMBO_OUT_PCH, m_cbPortCHOut);
|
|
}
|
|
|
|
BEGIN_MESSAGE_MAP(CUtil7296Dlg, CDialog)
|
|
ON_WM_SYSCOMMAND()
|
|
ON_WM_PAINT()
|
|
ON_WM_QUERYDRAGICON()
|
|
//}}AFX_MSG_MAP
|
|
ON_CBN_SELCHANGE(IDC_COMBO_IN_PA, &CUtil7296Dlg::OnInPASelchange)
|
|
ON_CBN_SELCHANGE(IDC_COMBO_OUT_PA, &CUtil7296Dlg::OnOutPASelchange)
|
|
ON_CBN_SELCHANGE(IDC_COMBO_IN_PB, &CUtil7296Dlg::OnInPBSelchange)
|
|
ON_CBN_SELCHANGE(IDC_COMBO_OUT_PB, &CUtil7296Dlg::OnOutPBSelchange)
|
|
ON_CBN_SELCHANGE(IDC_COMBO_IN_PCH, &CUtil7296Dlg::OnInPCHSelchange)
|
|
ON_CBN_SELCHANGE(IDC_COMBO_OUT_PCH, &CUtil7296Dlg::OnOutPCHSelchange)
|
|
ON_CBN_SELCHANGE(IDC_COMBO_IN_PCL, &CUtil7296Dlg::OnInPCLSelchange)
|
|
ON_CBN_SELCHANGE(IDC_COMBO_OUT_PCL, &CUtil7296Dlg::OnOutPCLSelchange)
|
|
ON_WM_DESTROY()
|
|
ON_WM_TIMER()
|
|
ON_BN_CLICKED(IDC_CHECK_PC0, &CUtil7296Dlg::OnOutputPC0)
|
|
ON_BN_CLICKED(IDC_CHECK_PC1, &CUtil7296Dlg::OnOutputPC1)
|
|
ON_BN_CLICKED(IDC_CHECK_PC2, &CUtil7296Dlg::OnOutputPC2)
|
|
ON_BN_CLICKED(IDC_CHECK_PC3, &CUtil7296Dlg::OnOutputPC3)
|
|
ON_BN_CLICKED(IDC_CHECK_PC4, &CUtil7296Dlg::OnOutputPC4)
|
|
ON_BN_CLICKED(IDC_CHECK_PC5, &CUtil7296Dlg::OnOutputPC5)
|
|
ON_BN_CLICKED(IDC_CHECK_PC6, &CUtil7296Dlg::OnOutputPC6)
|
|
ON_BN_CLICKED(IDC_CHECK_PC7, &CUtil7296Dlg::OnOutputPC7)
|
|
ON_BN_CLICKED(IDC_CHECK_PB0, &CUtil7296Dlg::OnOutputPB0)
|
|
ON_BN_CLICKED(IDC_CHECK_PB1, &CUtil7296Dlg::OnOutputPB1)
|
|
ON_BN_CLICKED(IDC_CHECK_PB2, &CUtil7296Dlg::OnOutputPB2)
|
|
ON_BN_CLICKED(IDC_CHECK_PB3, &CUtil7296Dlg::OnOutputPB3)
|
|
ON_BN_CLICKED(IDC_CHECK_PB4, &CUtil7296Dlg::OnOutputPB4)
|
|
ON_BN_CLICKED(IDC_CHECK_PB5, &CUtil7296Dlg::OnOutputPB5)
|
|
ON_BN_CLICKED(IDC_CHECK_PB6, &CUtil7296Dlg::OnOutputPB6)
|
|
ON_BN_CLICKED(IDC_CHECK_PB7, &CUtil7296Dlg::OnOutputPB7)
|
|
ON_BN_CLICKED(IDC_CHECK_PA0, &CUtil7296Dlg::OnOutputPA0)
|
|
ON_BN_CLICKED(IDC_CHECK_PA1, &CUtil7296Dlg::OnOutputPA1)
|
|
ON_BN_CLICKED(IDC_CHECK_PA2, &CUtil7296Dlg::OnOutputPA2)
|
|
ON_BN_CLICKED(IDC_CHECK_PA3, &CUtil7296Dlg::OnOutputPA3)
|
|
ON_BN_CLICKED(IDC_CHECK_PA4, &CUtil7296Dlg::OnOutputPA4)
|
|
ON_BN_CLICKED(IDC_CHECK_PA5, &CUtil7296Dlg::OnOutputPA5)
|
|
ON_BN_CLICKED(IDC_CHECK_PA6, &CUtil7296Dlg::OnOutputPA6)
|
|
ON_BN_CLICKED(IDC_CHECK_PA7, &CUtil7296Dlg::OnOutputPA7)
|
|
ON_WM_CTLCOLOR()
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
// CUtil7296Dlg message handlers
|
|
|
|
BOOL CUtil7296Dlg::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
|
|
m_cbPortAIn.SetCurSel(0);
|
|
m_cbPortBIn.SetCurSel(0);
|
|
m_cbPortCLIn.SetCurSel(0);
|
|
m_cbPortCHIn.SetCurSel(0);
|
|
|
|
m_cbPortAOut.SetCurSel(1);
|
|
m_cbPortBOut.SetCurSel(1);
|
|
m_cbPortCLOut.SetCurSel(1);
|
|
m_cbPortCHOut.SetCurSel(1);
|
|
|
|
// Port Configuration
|
|
DIO_PortConfig(m_hCard, m_InPortA, INPUT_PORT);
|
|
DIO_PortConfig(m_hCard, m_OutPortA, OUTPUT_PORT);
|
|
DIO_PortConfig(m_hCard, m_InPortB, INPUT_PORT);
|
|
DIO_PortConfig(m_hCard, m_OutPortB, OUTPUT_PORT);
|
|
DIO_PortConfig(m_hCard, m_InPortCH, INPUT_PORT);
|
|
DIO_PortConfig(m_hCard, m_OutPortCH, OUTPUT_PORT);
|
|
DIO_PortConfig(m_hCard, m_InPortCL, INPUT_PORT);
|
|
DIO_PortConfig(m_hCard, m_OutPortCL, OUTPUT_PORT);
|
|
|
|
DO_WritePort( m_hCard, m_OutPortA, m_OutDataPortA );
|
|
DO_WritePort( m_hCard, m_OutPortB, m_OutDataPortB );
|
|
DO_WritePort( m_hCard, m_OutPortCL, m_OutDataPortCL );
|
|
DO_WritePort( m_hCard, m_OutPortCH, m_OutDataPortCH );
|
|
|
|
m_nTimer = SetTimer( 1, 250, NULL );
|
|
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
}
|
|
|
|
void CUtil7296Dlg::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 CUtil7296Dlg::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
|
|
{
|
|
CDialog::OnPaint();
|
|
}
|
|
}
|
|
|
|
// The system calls this function to obtain the cursor to display while the user drags
|
|
// the minimized window.
|
|
HCURSOR CUtil7296Dlg::OnQueryDragIcon()
|
|
{
|
|
return static_cast<HCURSOR>(m_hIcon);
|
|
}
|
|
|
|
|
|
void CUtil7296Dlg::OnInPASelchange()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
U16 tmpInPA;
|
|
int nIndex;
|
|
|
|
nIndex = m_cbPortAIn.GetCurSel();
|
|
switch( nIndex )
|
|
{
|
|
case 0:
|
|
tmpInPA = Channel_P1A;
|
|
break;
|
|
case 1:
|
|
tmpInPA = Channel_P2A;
|
|
break;
|
|
case 2:
|
|
tmpInPA = Channel_P3A;
|
|
break;
|
|
case 3:
|
|
tmpInPA = Channel_P4A;
|
|
break;
|
|
}
|
|
|
|
if( tmpInPA == m_OutPortA )
|
|
{
|
|
|
|
AfxMessageBox( TEXT(" The Port had been configured as Output-Mode ") );
|
|
// restore the sellection of ComboBox
|
|
switch( m_InPortA )
|
|
{
|
|
case Channel_P1A:
|
|
nIndex = 0;
|
|
break;
|
|
case Channel_P2A:
|
|
nIndex = 1;
|
|
break;
|
|
case Channel_P3A:
|
|
nIndex = 2;
|
|
break;
|
|
case Channel_P4A:
|
|
nIndex = 3;
|
|
break;
|
|
}
|
|
|
|
m_cbPortAIn.SetCurSel( nIndex );
|
|
|
|
}
|
|
else
|
|
{
|
|
if( tmpInPA != m_InPortA )
|
|
{ // update m_InPortA and configure the target Port
|
|
m_InPortA = tmpInPA;
|
|
|
|
DIO_PortConfig(m_hCard, m_InPortA, INPUT_PORT);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
void CUtil7296Dlg::OnOutPASelchange()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
U16 tmpOutPA;
|
|
int nIndex;
|
|
|
|
nIndex = m_cbPortAOut.GetCurSel();
|
|
switch( nIndex )
|
|
{
|
|
case 0:
|
|
tmpOutPA = Channel_P1A;
|
|
break;
|
|
case 1:
|
|
tmpOutPA = Channel_P2A;
|
|
break;
|
|
case 2:
|
|
tmpOutPA = Channel_P3A;
|
|
break;
|
|
case 3:
|
|
tmpOutPA = Channel_P4A;
|
|
break;
|
|
}
|
|
|
|
if( tmpOutPA == m_InPortA )
|
|
{
|
|
|
|
AfxMessageBox( TEXT(" The Port had been configured as Input-Mode ") );
|
|
// restore the sellection of ComboBox
|
|
switch( m_OutPortA )
|
|
{
|
|
case Channel_P1A:
|
|
nIndex = 0;
|
|
break;
|
|
case Channel_P2A:
|
|
nIndex = 1;
|
|
break;
|
|
case Channel_P3A:
|
|
nIndex = 2;
|
|
break;
|
|
case Channel_P4A:
|
|
nIndex = 3;
|
|
break;
|
|
}
|
|
|
|
m_cbPortAOut.SetCurSel( nIndex );
|
|
|
|
}
|
|
else
|
|
{
|
|
if( tmpOutPA != m_OutPortA )
|
|
{ // update m_InPortA and configure the target Port
|
|
m_OutPortA = tmpOutPA;
|
|
|
|
DIO_PortConfig(m_hCard, m_OutPortA, OUTPUT_PORT);
|
|
// reset Output data
|
|
m_OutDataPortA = 0x00;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
void CUtil7296Dlg::OnInPBSelchange()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
U16 tmpInPB;
|
|
int nIndex;
|
|
|
|
nIndex = m_cbPortBIn.GetCurSel();
|
|
switch( nIndex )
|
|
{
|
|
case 0:
|
|
tmpInPB = Channel_P1B;
|
|
break;
|
|
case 1:
|
|
tmpInPB = Channel_P2B;
|
|
break;
|
|
case 2:
|
|
tmpInPB = Channel_P3B;
|
|
break;
|
|
case 3:
|
|
tmpInPB = Channel_P4B;
|
|
break;
|
|
}
|
|
|
|
if( tmpInPB == m_OutPortB )
|
|
{
|
|
|
|
AfxMessageBox( TEXT(" The Port had been configured as Output-Mode ") );
|
|
// restore the sellection of ComboBox
|
|
switch( m_InPortB )
|
|
{
|
|
case Channel_P1B:
|
|
nIndex = 0;
|
|
break;
|
|
case Channel_P2B:
|
|
nIndex = 1;
|
|
break;
|
|
case Channel_P3B:
|
|
nIndex = 2;
|
|
break;
|
|
case Channel_P4B:
|
|
nIndex = 3;
|
|
break;
|
|
}
|
|
|
|
m_cbPortBIn.SetCurSel( nIndex );
|
|
|
|
}
|
|
else
|
|
{
|
|
if( tmpInPB != m_InPortB )
|
|
{ // update m_InPortA and configure the target Port
|
|
m_InPortB = tmpInPB;
|
|
|
|
DIO_PortConfig(m_hCard, m_InPortB, INPUT_PORT);
|
|
}
|
|
}
|
|
}
|
|
|
|
void CUtil7296Dlg::OnOutPBSelchange()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
U16 tmpOutPB;
|
|
int nIndex;
|
|
|
|
nIndex = m_cbPortBOut.GetCurSel();
|
|
switch( nIndex )
|
|
{
|
|
case 0:
|
|
tmpOutPB = Channel_P1B;
|
|
break;
|
|
case 1:
|
|
tmpOutPB = Channel_P2B;
|
|
break;
|
|
case 2:
|
|
tmpOutPB = Channel_P3B;
|
|
break;
|
|
case 3:
|
|
tmpOutPB = Channel_P4B;
|
|
break;
|
|
}
|
|
|
|
if( tmpOutPB == m_InPortB )
|
|
{
|
|
|
|
AfxMessageBox( TEXT(" The Port had been configured as Input-Mode ") );
|
|
// restore the sellection of ComboBox
|
|
switch( m_OutPortB )
|
|
{
|
|
case Channel_P1B:
|
|
nIndex = 0;
|
|
break;
|
|
case Channel_P2B:
|
|
nIndex = 1;
|
|
break;
|
|
case Channel_P3B:
|
|
nIndex = 2;
|
|
break;
|
|
case Channel_P4B:
|
|
nIndex = 3;
|
|
break;
|
|
}
|
|
|
|
m_cbPortBOut.SetCurSel( nIndex );
|
|
|
|
}
|
|
else
|
|
{
|
|
if( tmpOutPB != m_OutPortB )
|
|
{ // update m_InPortA and configure the target Port
|
|
m_OutPortB = tmpOutPB;
|
|
|
|
DIO_PortConfig(m_hCard, m_OutPortB, OUTPUT_PORT);
|
|
// reset Output data
|
|
m_OutDataPortB = 0x00;
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
void CUtil7296Dlg::OnInPCHSelchange()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
U16 tmpInPCH;
|
|
int nIndex;
|
|
|
|
nIndex = m_cbPortCHIn.GetCurSel();
|
|
switch( nIndex )
|
|
{
|
|
case 0:
|
|
tmpInPCH = Channel_P1CH;
|
|
break;
|
|
case 1:
|
|
tmpInPCH = Channel_P2CH;
|
|
break;
|
|
case 2:
|
|
tmpInPCH = Channel_P3CH;
|
|
break;
|
|
case 3:
|
|
tmpInPCH = Channel_P4CH;
|
|
break;
|
|
}
|
|
|
|
if( tmpInPCH == m_OutPortCH )
|
|
{
|
|
|
|
AfxMessageBox( TEXT(" The Port had been configured as Output-Mode ") );
|
|
// restore the sellection of ComboBox
|
|
switch( m_InPortCH )
|
|
{
|
|
case Channel_P1CH:
|
|
nIndex = 0;
|
|
break;
|
|
case Channel_P2CH:
|
|
nIndex = 1;
|
|
break;
|
|
case Channel_P3CH:
|
|
nIndex = 2;
|
|
break;
|
|
case Channel_P4CH:
|
|
nIndex = 3;
|
|
break;
|
|
}
|
|
|
|
m_cbPortCHIn.SetCurSel( nIndex );
|
|
|
|
}
|
|
else
|
|
{
|
|
if( tmpInPCH != m_InPortCH )
|
|
{ // update m_InPortA and configure the target Port
|
|
m_InPortCH = tmpInPCH;
|
|
|
|
DIO_PortConfig(m_hCard, m_InPortCH, INPUT_PORT);
|
|
}
|
|
}
|
|
}
|
|
|
|
void CUtil7296Dlg::OnOutPCHSelchange()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
U16 tmpOutPCH;
|
|
int nIndex;
|
|
|
|
nIndex = m_cbPortCHOut.GetCurSel();
|
|
switch( nIndex )
|
|
{
|
|
case 0:
|
|
tmpOutPCH = Channel_P1CH;
|
|
break;
|
|
case 1:
|
|
tmpOutPCH = Channel_P2CH;
|
|
break;
|
|
case 2:
|
|
tmpOutPCH = Channel_P3CH;
|
|
break;
|
|
case 3:
|
|
tmpOutPCH = Channel_P4CH;
|
|
break;
|
|
}
|
|
|
|
if( tmpOutPCH == m_InPortCH )
|
|
{
|
|
|
|
AfxMessageBox( TEXT(" The Port had been configured as Input-Mode ") );
|
|
// restore the sellection of ComboBox
|
|
switch( m_OutPortCH )
|
|
{
|
|
case Channel_P1CH:
|
|
nIndex = 0;
|
|
break;
|
|
case Channel_P2CH:
|
|
nIndex = 1;
|
|
break;
|
|
case Channel_P3CH:
|
|
nIndex = 2;
|
|
break;
|
|
case Channel_P4CH:
|
|
nIndex = 3;
|
|
break;
|
|
}
|
|
|
|
m_cbPortCHOut.SetCurSel( nIndex );
|
|
|
|
}
|
|
else
|
|
{
|
|
if( tmpOutPCH != m_OutPortCH )
|
|
{ // update m_InPortA and configure the target Port
|
|
m_OutPortCH = tmpOutPCH;
|
|
|
|
DIO_PortConfig(m_hCard, m_OutPortCH, OUTPUT_PORT);
|
|
// reset Output data
|
|
m_OutDataPortCH = 0x00;
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
void CUtil7296Dlg::OnInPCLSelchange()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
U16 tmpInPCL;
|
|
int nIndex;
|
|
|
|
nIndex = m_cbPortCLIn.GetCurSel();
|
|
switch( nIndex )
|
|
{
|
|
case 0:
|
|
tmpInPCL = Channel_P1CL;
|
|
break;
|
|
case 1:
|
|
tmpInPCL = Channel_P2CL;
|
|
break;
|
|
case 2:
|
|
tmpInPCL = Channel_P3CL;
|
|
break;
|
|
case 3:
|
|
tmpInPCL = Channel_P4CL;
|
|
break;
|
|
}
|
|
|
|
if( tmpInPCL == m_OutPortCL )
|
|
{
|
|
|
|
AfxMessageBox( TEXT(" The Port had been configured as Output-Mode ") );
|
|
// restore the sellection of ComboBox
|
|
switch( m_InPortCL )
|
|
{
|
|
case Channel_P1CL:
|
|
nIndex = 0;
|
|
break;
|
|
case Channel_P2CL:
|
|
nIndex = 1;
|
|
break;
|
|
case Channel_P3CL:
|
|
nIndex = 2;
|
|
break;
|
|
case Channel_P4CL:
|
|
nIndex = 3;
|
|
break;
|
|
}
|
|
|
|
m_cbPortCLIn.SetCurSel( nIndex );
|
|
|
|
}
|
|
else
|
|
{
|
|
if( tmpInPCL != m_InPortCL )
|
|
{ // update m_InPortA and configure the target Port
|
|
m_InPortCL = tmpInPCL;
|
|
|
|
DIO_PortConfig(m_hCard, m_InPortCL, INPUT_PORT);
|
|
}
|
|
}
|
|
}
|
|
|
|
void CUtil7296Dlg::OnOutPCLSelchange()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
U16 tmpOutPCL;
|
|
int nIndex;
|
|
|
|
nIndex = m_cbPortCLOut.GetCurSel();
|
|
switch( nIndex )
|
|
{
|
|
case 0:
|
|
tmpOutPCL = Channel_P1CL;
|
|
break;
|
|
case 1:
|
|
tmpOutPCL = Channel_P2CL;
|
|
break;
|
|
case 2:
|
|
tmpOutPCL = Channel_P3CL;
|
|
break;
|
|
case 3:
|
|
tmpOutPCL = Channel_P4CL;
|
|
break;
|
|
}
|
|
|
|
if( tmpOutPCL == m_InPortCL )
|
|
{
|
|
|
|
AfxMessageBox( TEXT(" The Port had been configured as Input-Mode ") );
|
|
// restore the sellection of ComboBox
|
|
switch( m_OutPortCL )
|
|
{
|
|
case Channel_P1CL:
|
|
nIndex = 0;
|
|
break;
|
|
case Channel_P2CL:
|
|
nIndex = 1;
|
|
break;
|
|
case Channel_P3CL:
|
|
nIndex = 2;
|
|
break;
|
|
case Channel_P4CL:
|
|
nIndex = 3;
|
|
break;
|
|
}
|
|
|
|
m_cbPortCLOut.SetCurSel( nIndex );
|
|
|
|
}
|
|
else
|
|
{
|
|
if( tmpOutPCL != m_OutPortCL )
|
|
{ // update m_InPortA and configure the target Port
|
|
m_OutPortCL = tmpOutPCL;
|
|
|
|
DIO_PortConfig(m_hCard, m_OutPortCL, OUTPUT_PORT);
|
|
// reset Output data
|
|
m_OutDataPortCL = 0x00;
|
|
}
|
|
}
|
|
}
|
|
|
|
void CUtil7296Dlg::OnDestroy()
|
|
{
|
|
CDialog::OnDestroy();
|
|
|
|
// TODO: Add your message handler code here
|
|
if( m_nTimer != -1 )
|
|
{
|
|
KillTimer( m_nTimer );
|
|
m_nTimer = -1;
|
|
}
|
|
}
|
|
|
|
void CUtil7296Dlg::OnTimer(UINT_PTR nIDEvent)
|
|
{
|
|
// TODO: Add your message handler code here and/or call default
|
|
|
|
U32 dwPortData,dwChangeMask;
|
|
|
|
|
|
// process the InData of PortA
|
|
DI_ReadPort( m_hCard, m_InPortA, &dwPortData);
|
|
dwChangeMask = dwPortData ^ m_InDataPortA;
|
|
|
|
if( dwChangeMask != 0x00 ) // Input had been changed
|
|
{
|
|
|
|
m_InDataPortA = dwPortData;
|
|
|
|
if( (dwChangeMask & 0x01) == 0x01 ) // if the target bit is changed
|
|
{
|
|
if( (dwPortData & 0x01) == 0x01 )
|
|
{
|
|
m_Icon_PA0.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ;
|
|
}
|
|
else
|
|
{
|
|
m_Icon_PA0.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ;
|
|
}
|
|
}
|
|
|
|
|
|
if( (dwChangeMask & 0x02) == 0x02 ) // if the target bit is changed
|
|
{
|
|
if( (dwPortData & 0x02) == 0x02 )
|
|
{
|
|
m_Icon_PA1.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ;
|
|
}
|
|
else
|
|
{
|
|
m_Icon_PA1.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ;
|
|
}
|
|
}
|
|
|
|
if( (dwChangeMask & 0x04) == 0x04 ) // if the target bit is changed
|
|
{
|
|
if( (dwPortData & 0x04) == 0x04 )
|
|
{
|
|
m_Icon_PA2.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ;
|
|
}
|
|
else
|
|
{
|
|
m_Icon_PA2.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ;
|
|
}
|
|
}
|
|
|
|
if( (dwChangeMask & 0x08) == 0x08 ) // if the target bit is changed
|
|
{
|
|
if( (dwPortData & 0x08) == 0x08 )
|
|
{
|
|
m_Icon_PA3.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ;
|
|
}
|
|
else
|
|
{
|
|
m_Icon_PA3.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ;
|
|
}
|
|
}
|
|
|
|
if( (dwChangeMask & 0x10) == 0x10 ) // if the target bit is changed
|
|
{
|
|
if( (dwPortData & 0x10) == 0x10 )
|
|
{
|
|
m_Icon_PA4.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ;
|
|
}
|
|
else
|
|
{
|
|
m_Icon_PA4.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ;
|
|
}
|
|
}
|
|
|
|
if( (dwChangeMask & 0x20) == 0x20 ) // if the target bit is changed
|
|
{
|
|
if( (dwPortData & 0x20) == 0x20 )
|
|
{
|
|
m_Icon_PA5.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ;
|
|
}
|
|
else
|
|
{
|
|
m_Icon_PA5.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ;
|
|
}
|
|
}
|
|
|
|
if( (dwChangeMask & 0x40) == 0x40 ) // if the target bit is changed
|
|
{
|
|
if( (dwPortData & 0x40) == 0x40 )
|
|
{
|
|
m_Icon_PA6.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ;
|
|
}
|
|
else
|
|
{
|
|
m_Icon_PA6.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ;
|
|
}
|
|
}
|
|
|
|
if( (dwChangeMask & 0x80) == 0x80 ) // if the target bit is changed
|
|
{
|
|
if( (dwPortData & 0x80) == 0x80 )
|
|
{
|
|
m_Icon_PA7.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ;
|
|
}
|
|
else
|
|
{
|
|
m_Icon_PA7.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ;
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// process the InData of PortB
|
|
DI_ReadPort( m_hCard, m_InPortB, &dwPortData);
|
|
dwChangeMask = dwPortData ^ m_InDataPortB;
|
|
|
|
if( dwChangeMask != 0x00 ) // Input had been changed
|
|
{
|
|
|
|
m_InDataPortB = dwPortData;
|
|
|
|
if( (dwChangeMask & 0x01) == 0x01 ) // if the target bit is changed
|
|
{
|
|
if( (dwPortData & 0x01) == 0x01 )
|
|
{
|
|
m_Icon_PB0.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ;
|
|
}
|
|
else
|
|
{
|
|
m_Icon_PB0.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ;
|
|
}
|
|
}
|
|
|
|
|
|
if( (dwChangeMask & 0x02) == 0x02 ) // if the target bit is changed
|
|
{
|
|
if( (dwPortData & 0x02) == 0x02 )
|
|
{
|
|
m_Icon_PB1.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ;
|
|
}
|
|
else
|
|
{
|
|
m_Icon_PB1.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ;
|
|
}
|
|
}
|
|
|
|
if( (dwChangeMask & 0x04) == 0x04 ) // if the target bit is changed
|
|
{
|
|
if( (dwPortData & 0x04) == 0x04 )
|
|
{
|
|
m_Icon_PB2.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ;
|
|
}
|
|
else
|
|
{
|
|
m_Icon_PB2.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ;
|
|
}
|
|
}
|
|
|
|
if( (dwChangeMask & 0x08) == 0x08 ) // if the target bit is changed
|
|
{
|
|
if( (dwPortData & 0x08) == 0x08 )
|
|
{
|
|
m_Icon_PB3.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ;
|
|
}
|
|
else
|
|
{
|
|
m_Icon_PB3.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ;
|
|
}
|
|
}
|
|
|
|
if( (dwChangeMask & 0x10) == 0x10 ) // if the target bit is changed
|
|
{
|
|
if( (dwPortData & 0x10) == 0x10 )
|
|
{
|
|
m_Icon_PB4.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ;
|
|
}
|
|
else
|
|
{
|
|
m_Icon_PB4.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ;
|
|
}
|
|
}
|
|
|
|
if( (dwChangeMask & 0x20) == 0x20 ) // if the target bit is changed
|
|
{
|
|
if( (dwPortData & 0x20) == 0x20 )
|
|
{
|
|
m_Icon_PB5.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ;
|
|
}
|
|
else
|
|
{
|
|
m_Icon_PB5.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ;
|
|
}
|
|
}
|
|
|
|
if( (dwChangeMask & 0x40) == 0x40 ) // if the target bit is changed
|
|
{
|
|
if( (dwPortData & 0x40) == 0x40 )
|
|
{
|
|
m_Icon_PB6.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ;
|
|
}
|
|
else
|
|
{
|
|
m_Icon_PB6.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ;
|
|
}
|
|
}
|
|
|
|
if( (dwChangeMask & 0x80) == 0x80 ) // if the target bit is changed
|
|
{
|
|
if( (dwPortData & 0x80) == 0x80 )
|
|
{
|
|
m_Icon_PB7.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ;
|
|
}
|
|
else
|
|
{
|
|
m_Icon_PB7.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// process the InData of PortC Lower
|
|
DI_ReadPort( m_hCard, m_InPortCL, &dwPortData);
|
|
dwChangeMask = dwPortData ^ m_InDataPortCL;
|
|
|
|
if( dwChangeMask != 0x00 ) // Input had been changed
|
|
{
|
|
|
|
m_InDataPortCL = dwPortData;
|
|
|
|
if( (dwChangeMask & 0x01) == 0x01 ) // if the target bit is changed
|
|
{
|
|
if( (dwPortData & 0x01) == 0x01 )
|
|
{
|
|
m_Icon_PC0.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ;
|
|
}
|
|
else
|
|
{
|
|
m_Icon_PC0.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ;
|
|
}
|
|
}
|
|
|
|
|
|
if( (dwChangeMask & 0x02) == 0x02 ) // if the target bit is changed
|
|
{
|
|
if( (dwPortData & 0x02) == 0x02 )
|
|
{
|
|
m_Icon_PC1.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ;
|
|
}
|
|
else
|
|
{
|
|
m_Icon_PC1.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ;
|
|
}
|
|
}
|
|
|
|
if( (dwChangeMask & 0x04) == 0x04 ) // if the target bit is changed
|
|
{
|
|
if( (dwPortData & 0x04) == 0x04 )
|
|
{
|
|
m_Icon_PC2.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ;
|
|
}
|
|
else
|
|
{
|
|
m_Icon_PC2.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ;
|
|
}
|
|
}
|
|
|
|
if( (dwChangeMask & 0x08) == 0x08 ) // if the target bit is changed
|
|
{
|
|
if( (dwPortData & 0x08) == 0x08 )
|
|
{
|
|
m_Icon_PC3.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ;
|
|
}
|
|
else
|
|
{
|
|
m_Icon_PC3.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
// process the InData of PortC Upper
|
|
DI_ReadPort( m_hCard, m_InPortCH, &dwPortData);
|
|
dwChangeMask = dwPortData ^ m_InDataPortCH;
|
|
|
|
if( dwChangeMask != 0x00 ) // Input had been changed
|
|
{
|
|
|
|
m_InDataPortCH = dwPortData;
|
|
|
|
if( (dwChangeMask & 0x01) == 0x01 ) // if the target bit is changed
|
|
{
|
|
if( (dwPortData & 0x01) == 0x01 )
|
|
{
|
|
m_Icon_PC4.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ;
|
|
}
|
|
else
|
|
{
|
|
m_Icon_PC4.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ;
|
|
}
|
|
}
|
|
|
|
if( (dwChangeMask & 0x02) == 0x02 ) // if the target bit is changed
|
|
{
|
|
if( (dwPortData & 0x02) == 0x02 )
|
|
{
|
|
m_Icon_PC5.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ;
|
|
}
|
|
else
|
|
{
|
|
m_Icon_PC5.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ;
|
|
}
|
|
}
|
|
|
|
if( (dwChangeMask & 0x04) == 0x04 ) // if the target bit is changed
|
|
{
|
|
if( (dwPortData & 0x04) == 0x04 )
|
|
{
|
|
m_Icon_PC6.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ;
|
|
}
|
|
else
|
|
{
|
|
m_Icon_PC6.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ;
|
|
}
|
|
}
|
|
|
|
if( (dwChangeMask & 0x08) == 0x08 ) // if the target bit is changed
|
|
{
|
|
if( (dwPortData & 0x08) == 0x08 )
|
|
{
|
|
m_Icon_PC7.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_RED) ) ;
|
|
}
|
|
else
|
|
{
|
|
m_Icon_PC7.SetIcon( AfxGetApp()->LoadIcon(IDI_ICON_BLACK) ) ;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
CDialog::OnTimer(nIDEvent);
|
|
}
|
|
|
|
void CUtil7296Dlg::OnOutputPC0()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
int CheckSts;
|
|
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PC0 ))->GetCheck();
|
|
|
|
if( CheckSts == BST_CHECKED )
|
|
{
|
|
m_OutDataPortCL |= 0x01;
|
|
}
|
|
else if( CheckSts == BST_UNCHECKED )
|
|
{
|
|
m_OutDataPortCL &= (~0x01);
|
|
}
|
|
|
|
DO_WritePort( m_hCard, m_OutPortCL, m_OutDataPortCL );
|
|
|
|
}
|
|
|
|
void CUtil7296Dlg::OnOutputPC1()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
int CheckSts;
|
|
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PC1 ))->GetCheck();
|
|
|
|
if( CheckSts == BST_CHECKED )
|
|
{
|
|
m_OutDataPortCL |= 0x02;
|
|
}
|
|
else if( CheckSts == BST_UNCHECKED )
|
|
{
|
|
m_OutDataPortCL &= (~0x02);
|
|
}
|
|
|
|
DO_WritePort( m_hCard, m_OutPortCL, m_OutDataPortCL );
|
|
}
|
|
|
|
void CUtil7296Dlg::OnOutputPC2()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
int CheckSts;
|
|
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PC2 ))->GetCheck();
|
|
|
|
if( CheckSts == BST_CHECKED )
|
|
{
|
|
m_OutDataPortCL |= 0x04;
|
|
}
|
|
else if( CheckSts == BST_UNCHECKED )
|
|
{
|
|
m_OutDataPortCL &= (~0x04);
|
|
}
|
|
|
|
DO_WritePort( m_hCard, m_OutPortCL, m_OutDataPortCL );
|
|
|
|
}
|
|
|
|
void CUtil7296Dlg::OnOutputPC3()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
int CheckSts;
|
|
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PC3 ))->GetCheck();
|
|
|
|
if( CheckSts == BST_CHECKED )
|
|
{
|
|
m_OutDataPortCL |= 0x08;
|
|
}
|
|
else if( CheckSts == BST_UNCHECKED )
|
|
{
|
|
m_OutDataPortCL &= (~0x08);
|
|
}
|
|
|
|
DO_WritePort( m_hCard, m_OutPortCL, m_OutDataPortCL );
|
|
}
|
|
|
|
void CUtil7296Dlg::OnOutputPC4()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
int CheckSts;
|
|
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PC4 ))->GetCheck();
|
|
|
|
if( CheckSts == BST_CHECKED )
|
|
{
|
|
m_OutDataPortCH |= 0x01;
|
|
}
|
|
else if( CheckSts == BST_UNCHECKED )
|
|
{
|
|
m_OutDataPortCH &= (~0x01);
|
|
}
|
|
|
|
DO_WritePort( m_hCard, m_OutPortCH, m_OutDataPortCH );
|
|
|
|
}
|
|
|
|
void CUtil7296Dlg::OnOutputPC5()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
int CheckSts;
|
|
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PC5 ))->GetCheck();
|
|
|
|
if( CheckSts == BST_CHECKED )
|
|
{
|
|
m_OutDataPortCH |= 0x02;
|
|
}
|
|
else if( CheckSts == BST_UNCHECKED )
|
|
{
|
|
m_OutDataPortCH &= (~0x02);
|
|
}
|
|
|
|
DO_WritePort( m_hCard, m_OutPortCH, m_OutDataPortCH );
|
|
}
|
|
|
|
void CUtil7296Dlg::OnOutputPC6()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
int CheckSts;
|
|
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PC6 ))->GetCheck();
|
|
|
|
if( CheckSts == BST_CHECKED )
|
|
{
|
|
m_OutDataPortCH |= 0x04;
|
|
}
|
|
else if( CheckSts == BST_UNCHECKED )
|
|
{
|
|
m_OutDataPortCH &= (~0x04);
|
|
}
|
|
|
|
DO_WritePort( m_hCard, m_OutPortCH, m_OutDataPortCH );
|
|
}
|
|
|
|
void CUtil7296Dlg::OnOutputPC7()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
int CheckSts;
|
|
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PC7 ))->GetCheck();
|
|
|
|
if( CheckSts == BST_CHECKED )
|
|
{
|
|
m_OutDataPortCH |= 0x08;
|
|
}
|
|
else if( CheckSts == BST_UNCHECKED )
|
|
{
|
|
m_OutDataPortCH &= (~0x08);
|
|
}
|
|
|
|
DO_WritePort( m_hCard, m_OutPortCH, m_OutDataPortCH );
|
|
}
|
|
|
|
void CUtil7296Dlg::OnOutputPB0()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
int CheckSts;
|
|
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PB0 ))->GetCheck();
|
|
|
|
if( CheckSts == BST_CHECKED )
|
|
{
|
|
m_OutDataPortB |= 0x01;
|
|
}
|
|
else if( CheckSts == BST_UNCHECKED )
|
|
{
|
|
m_OutDataPortB &= (~0x01);
|
|
}
|
|
|
|
DO_WritePort( m_hCard, m_OutPortB, m_OutDataPortB );
|
|
|
|
}
|
|
|
|
void CUtil7296Dlg::OnOutputPB1()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
int CheckSts;
|
|
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PB1 ))->GetCheck();
|
|
|
|
if( CheckSts == BST_CHECKED )
|
|
{
|
|
m_OutDataPortB |= 0x02;
|
|
}
|
|
else if( CheckSts == BST_UNCHECKED )
|
|
{
|
|
m_OutDataPortB &= (~0x02);
|
|
}
|
|
|
|
DO_WritePort( m_hCard, m_OutPortB, m_OutDataPortB );
|
|
}
|
|
|
|
void CUtil7296Dlg::OnOutputPB2()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
int CheckSts;
|
|
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PB2 ))->GetCheck();
|
|
|
|
if( CheckSts == BST_CHECKED )
|
|
{
|
|
m_OutDataPortB |= 0x04;
|
|
}
|
|
else if( CheckSts == BST_UNCHECKED )
|
|
{
|
|
m_OutDataPortB &= (~0x04);
|
|
}
|
|
|
|
DO_WritePort( m_hCard, m_OutPortB, m_OutDataPortB );
|
|
}
|
|
|
|
void CUtil7296Dlg::OnOutputPB3()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
int CheckSts;
|
|
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PB3 ))->GetCheck();
|
|
|
|
if( CheckSts == BST_CHECKED )
|
|
{
|
|
m_OutDataPortB |= 0x08;
|
|
}
|
|
else if( CheckSts == BST_UNCHECKED )
|
|
{
|
|
m_OutDataPortB &= (~0x08);
|
|
}
|
|
|
|
DO_WritePort( m_hCard, m_OutPortB, m_OutDataPortB );
|
|
}
|
|
|
|
void CUtil7296Dlg::OnOutputPB4()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
int CheckSts;
|
|
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PB4 ))->GetCheck();
|
|
|
|
if( CheckSts == BST_CHECKED )
|
|
{
|
|
m_OutDataPortB |= 0x10;
|
|
}
|
|
else if( CheckSts == BST_UNCHECKED )
|
|
{
|
|
m_OutDataPortB &= (~0x10);
|
|
}
|
|
|
|
DO_WritePort( m_hCard, m_OutPortB, m_OutDataPortB );
|
|
}
|
|
|
|
void CUtil7296Dlg::OnOutputPB5()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
int CheckSts;
|
|
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PB5 ))->GetCheck();
|
|
|
|
if( CheckSts == BST_CHECKED )
|
|
{
|
|
m_OutDataPortB |= 0x20;
|
|
}
|
|
else if( CheckSts == BST_UNCHECKED )
|
|
{
|
|
m_OutDataPortB &= (~0x20);
|
|
}
|
|
|
|
DO_WritePort( m_hCard, m_OutPortB, m_OutDataPortB );
|
|
}
|
|
|
|
void CUtil7296Dlg::OnOutputPB6()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
int CheckSts;
|
|
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PB6 ))->GetCheck();
|
|
|
|
if( CheckSts == BST_CHECKED )
|
|
{
|
|
m_OutDataPortB |= 0x40;
|
|
}
|
|
else if( CheckSts == BST_UNCHECKED )
|
|
{
|
|
m_OutDataPortB &= (~0x40);
|
|
}
|
|
|
|
DO_WritePort( m_hCard, m_OutPortB, m_OutDataPortB );
|
|
}
|
|
|
|
void CUtil7296Dlg::OnOutputPB7()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
int CheckSts;
|
|
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PB7 ))->GetCheck();
|
|
|
|
if( CheckSts == BST_CHECKED )
|
|
{
|
|
m_OutDataPortB |= 0x80;
|
|
}
|
|
else if( CheckSts == BST_UNCHECKED )
|
|
{
|
|
m_OutDataPortB &= (~0x80);
|
|
}
|
|
|
|
DO_WritePort( m_hCard, m_OutPortB, m_OutDataPortB );
|
|
}
|
|
|
|
void CUtil7296Dlg::OnOutputPA0()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
int CheckSts;
|
|
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PA0 ))->GetCheck();
|
|
|
|
if( CheckSts == BST_CHECKED )
|
|
{
|
|
m_OutDataPortA |= 0x01;
|
|
}
|
|
else if( CheckSts == BST_UNCHECKED )
|
|
{
|
|
m_OutDataPortA &= (~0x01);
|
|
}
|
|
|
|
DO_WritePort( m_hCard, m_OutPortA, m_OutDataPortA );
|
|
}
|
|
|
|
void CUtil7296Dlg::OnOutputPA1()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
int CheckSts;
|
|
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PA1 ))->GetCheck();
|
|
|
|
if( CheckSts == BST_CHECKED )
|
|
{
|
|
m_OutDataPortA |= 0x02;
|
|
}
|
|
else if( CheckSts == BST_UNCHECKED )
|
|
{
|
|
m_OutDataPortA &= (~0x02);
|
|
}
|
|
|
|
DO_WritePort( m_hCard, m_OutPortA, m_OutDataPortA );
|
|
}
|
|
|
|
void CUtil7296Dlg::OnOutputPA2()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
int CheckSts;
|
|
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PA2 ))->GetCheck();
|
|
|
|
if( CheckSts == BST_CHECKED )
|
|
{
|
|
m_OutDataPortA |= 0x04;
|
|
}
|
|
else if( CheckSts == BST_UNCHECKED )
|
|
{
|
|
m_OutDataPortA &= (~0x04);
|
|
}
|
|
|
|
DO_WritePort( m_hCard, m_OutPortA, m_OutDataPortA );
|
|
}
|
|
|
|
void CUtil7296Dlg::OnOutputPA3()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
int CheckSts;
|
|
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PA3 ))->GetCheck();
|
|
|
|
if( CheckSts == BST_CHECKED )
|
|
{
|
|
m_OutDataPortA |= 0x08;
|
|
}
|
|
else if( CheckSts == BST_UNCHECKED )
|
|
{
|
|
m_OutDataPortA &= (~0x08);
|
|
}
|
|
|
|
DO_WritePort( m_hCard, m_OutPortA, m_OutDataPortA );
|
|
}
|
|
|
|
void CUtil7296Dlg::OnOutputPA4()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
int CheckSts;
|
|
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PA4 ))->GetCheck();
|
|
|
|
if( CheckSts == BST_CHECKED )
|
|
{
|
|
m_OutDataPortA |= 0x10;
|
|
}
|
|
else if( CheckSts == BST_UNCHECKED )
|
|
{
|
|
m_OutDataPortA &= (~0x10);
|
|
}
|
|
|
|
DO_WritePort( m_hCard, m_OutPortA, m_OutDataPortA );
|
|
}
|
|
|
|
void CUtil7296Dlg::OnOutputPA5()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
int CheckSts;
|
|
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PA5 ))->GetCheck();
|
|
|
|
if( CheckSts == BST_CHECKED )
|
|
{
|
|
m_OutDataPortA |= 0x20;
|
|
}
|
|
else if( CheckSts == BST_UNCHECKED )
|
|
{
|
|
m_OutDataPortA &= (~0x20);
|
|
}
|
|
|
|
DO_WritePort( m_hCard, m_OutPortA, m_OutDataPortA );
|
|
}
|
|
|
|
void CUtil7296Dlg::OnOutputPA6()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
int CheckSts;
|
|
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PA6 ))->GetCheck();
|
|
|
|
if( CheckSts == BST_CHECKED )
|
|
{
|
|
m_OutDataPortA |= 0x40;
|
|
}
|
|
else if( CheckSts == BST_UNCHECKED )
|
|
{
|
|
m_OutDataPortA &= (~0x40);
|
|
}
|
|
|
|
DO_WritePort( m_hCard, m_OutPortA, m_OutDataPortA );
|
|
}
|
|
|
|
void CUtil7296Dlg::OnOutputPA7()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
int CheckSts;
|
|
|
|
CheckSts = ((CButton*)GetDlgItem( IDC_CHECK_PA7 ))->GetCheck();
|
|
|
|
if( CheckSts == BST_CHECKED )
|
|
{
|
|
m_OutDataPortA |= 0x80;
|
|
}
|
|
else if( CheckSts == BST_UNCHECKED )
|
|
{
|
|
m_OutDataPortA &= (~0x80);
|
|
}
|
|
|
|
DO_WritePort( m_hCard, m_OutPortA, m_OutDataPortA );
|
|
}
|
|
|
|
HBRUSH CUtil7296Dlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
|
|
{
|
|
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
|
|
|
|
// TODO: Change any attributes of the DC here
|
|
if ( pWnd->GetDlgCtrlID() == IDC_LABEL_INPUT2 )
|
|
pDC->SetTextColor(RGB(255,0,0));
|
|
|
|
if ( pWnd->GetDlgCtrlID() == IDC_LABEL_OUTPUT )
|
|
pDC->SetTextColor(RGB(255,0,0));
|
|
|
|
// TODO: Return a different brush if the default is not desired
|
|
return hbr;
|
|
}
|
|
|