리크 테스트 gui
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.

1338 lines
28 KiB

// Util7248Dlg.cpp : implementation file
//
#include "stdafx.h"
#include "Util7248.h"
#include "Util7248Dlg.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()
// CUtil7248Dlg dialog
CUtil7248Dlg::CUtil7248Dlg(I16 hCard, CWnd* pParent /*=NULL*/)
: CDialog(CUtil7248Dlg::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 CUtil7248Dlg::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(CUtil7248Dlg, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
//}}AFX_MSG_MAP
ON_CBN_SELCHANGE(IDC_COMBO_IN_PA, &CUtil7248Dlg::OnInPASelchange)
ON_CBN_SELCHANGE(IDC_COMBO_OUT_PA, &CUtil7248Dlg::OnOutPASelchange)
ON_CBN_SELCHANGE(IDC_COMBO_IN_PB, &CUtil7248Dlg::OnInPBSelchange)
ON_CBN_SELCHANGE(IDC_COMBO_OUT_PB, &CUtil7248Dlg::OnOutPBSelchange)
ON_CBN_SELCHANGE(IDC_COMBO_IN_PCH, &CUtil7248Dlg::OnInPCHSelchange)
ON_CBN_SELCHANGE(IDC_COMBO_OUT_PCH, &CUtil7248Dlg::OnOutPCHSelchange)
ON_CBN_SELCHANGE(IDC_COMBO_IN_PCL, &CUtil7248Dlg::OnInPCLSelchange)
ON_CBN_SELCHANGE(IDC_COMBO_OUT_PCL, &CUtil7248Dlg::OnOutPCLSelchange)
ON_WM_DESTROY()
ON_WM_TIMER()
ON_BN_CLICKED(IDC_CHECK_PC0, &CUtil7248Dlg::OnOutputPC0)
ON_BN_CLICKED(IDC_CHECK_PC1, &CUtil7248Dlg::OnOutputPC1)
ON_BN_CLICKED(IDC_CHECK_PC2, &CUtil7248Dlg::OnOutputPC2)
ON_BN_CLICKED(IDC_CHECK_PC3, &CUtil7248Dlg::OnOutputPC3)
ON_BN_CLICKED(IDC_CHECK_PC4, &CUtil7248Dlg::OnOutputPC4)
ON_BN_CLICKED(IDC_CHECK_PC5, &CUtil7248Dlg::OnOutputPC5)
ON_BN_CLICKED(IDC_CHECK_PC6, &CUtil7248Dlg::OnOutputPC6)
ON_BN_CLICKED(IDC_CHECK_PC7, &CUtil7248Dlg::OnOutputPC7)
ON_BN_CLICKED(IDC_CHECK_PB0, &CUtil7248Dlg::OnOutputPB0)
ON_BN_CLICKED(IDC_CHECK_PB1, &CUtil7248Dlg::OnOutputPB1)
ON_BN_CLICKED(IDC_CHECK_PB2, &CUtil7248Dlg::OnOutputPB2)
ON_BN_CLICKED(IDC_CHECK_PB3, &CUtil7248Dlg::OnOutputPB3)
ON_BN_CLICKED(IDC_CHECK_PB4, &CUtil7248Dlg::OnOutputPB4)
ON_BN_CLICKED(IDC_CHECK_PB5, &CUtil7248Dlg::OnOutputPB5)
ON_BN_CLICKED(IDC_CHECK_PB6, &CUtil7248Dlg::OnOutputPB6)
ON_BN_CLICKED(IDC_CHECK_PB7, &CUtil7248Dlg::OnOutputPB7)
ON_BN_CLICKED(IDC_CHECK_PA0, &CUtil7248Dlg::OnOutputPA0)
ON_BN_CLICKED(IDC_CHECK_PA1, &CUtil7248Dlg::OnOutputPA1)
ON_BN_CLICKED(IDC_CHECK_PA2, &CUtil7248Dlg::OnOutputPA2)
ON_BN_CLICKED(IDC_CHECK_PA3, &CUtil7248Dlg::OnOutputPA3)
ON_BN_CLICKED(IDC_CHECK_PA4, &CUtil7248Dlg::OnOutputPA4)
ON_BN_CLICKED(IDC_CHECK_PA5, &CUtil7248Dlg::OnOutputPA5)
ON_BN_CLICKED(IDC_CHECK_PA6, &CUtil7248Dlg::OnOutputPA6)
ON_BN_CLICKED(IDC_CHECK_PA7, &CUtil7248Dlg::OnOutputPA7)
ON_WM_CTLCOLOR()
END_MESSAGE_MAP()
// CUtil7248Dlg message handlers
BOOL CUtil7248Dlg::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, 50, NULL );
return TRUE; // return TRUE unless you set the focus to a control
}
void CUtil7248Dlg::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 CUtil7248Dlg::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 CUtil7248Dlg::OnQueryDragIcon()
{
return static_cast<HCURSOR>(m_hIcon);
}
void CUtil7248Dlg::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;
}
{
if( tmpInPA != m_InPortA )
{ // update m_InPortA and configure the target Port
m_InPortA = tmpInPA;
DIO_PortConfig(m_hCard, m_InPortA, INPUT_PORT);
}
}
}
void CUtil7248Dlg::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;
}
{
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 CUtil7248Dlg::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;
}
{
if( tmpInPB != m_InPortB )
{ // update m_InPortA and configure the target Port
m_InPortB = tmpInPB;
DIO_PortConfig(m_hCard, m_InPortB, INPUT_PORT);
}
}
}
void CUtil7248Dlg::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;
}
{
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 CUtil7248Dlg::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;
}
{
if( tmpInPCH != m_InPortCH )
{ // update m_InPortA and configure the target Port
m_InPortCH = tmpInPCH;
DIO_PortConfig(m_hCard, m_InPortCH, INPUT_PORT);
}
}
}
void CUtil7248Dlg::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;
}
{
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 CUtil7248Dlg::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;
}
{
if( tmpInPCL != m_InPortCL )
{ // update m_InPortA and configure the target Port
m_InPortCL = tmpInPCL;
DIO_PortConfig(m_hCard, m_InPortCL, INPUT_PORT);
}
}
}
void CUtil7248Dlg::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;
}
{
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 CUtil7248Dlg::OnDestroy()
{
CDialog::OnDestroy();
// TODO: Add your message handler code here
if( m_nTimer != -1 )
{
KillTimer( m_nTimer );
m_nTimer = -1;
}
}
void CUtil7248Dlg::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 CUtil7248Dlg::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 CUtil7248Dlg::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 CUtil7248Dlg::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 CUtil7248Dlg::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 CUtil7248Dlg::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 CUtil7248Dlg::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 CUtil7248Dlg::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 CUtil7248Dlg::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 CUtil7248Dlg::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 CUtil7248Dlg::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 CUtil7248Dlg::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 CUtil7248Dlg::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 CUtil7248Dlg::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 CUtil7248Dlg::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 CUtil7248Dlg::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 CUtil7248Dlg::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 CUtil7248Dlg::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 CUtil7248Dlg::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 CUtil7248Dlg::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 CUtil7248Dlg::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 CUtil7248Dlg::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 CUtil7248Dlg::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 CUtil7248Dlg::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 CUtil7248Dlg::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 CUtil7248Dlg::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;
}