⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 autoteachstatus.cpp

📁 机械手IPC控制器伺服运动程序
💻 CPP
字号:
// autoteachstatus.cpp : implementation file
//

#include "stdafx.h"
#include "alfa.h"
#include "autoteachstatus.h"
#include "mccl.h"
#include "sys.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// Cautoteachstatus dialog


Cautoteachstatus::Cautoteachstatus(CWnd* pParent /*=NULL*/)
	: CDialog(Cautoteachstatus::IDD, pParent)
{
	//{{AFX_DATA_INIT(Cautoteachstatus)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void Cautoteachstatus::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(Cautoteachstatus)
	DDX_Control(pDX, IDC_VAC, m_vac);
	DDX_Control(pDX, IDC_SDM, m_sdm);
	DDX_Control(pDX, IDC_MOP, m_mop);
	DDX_Control(pDX, IDC_EMC, m_emc);
	DDX_Control(pDX, IDC_EFP, m_efp);
	DDX_Control(pDX, IDC_CK, m_ck);
	DDX_Control(pDX, IDC_AUTO, m_auto);
	DDX_Control(pDX, IDC_HOLD1, m_hold1);
	DDX_Control(pDX, IDC_HOLD2, m_hold2);
	DDX_Control(pDX, IDC_CLOSE, m_close);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(Cautoteachstatus, CDialog)
	//{{AFX_MSG_MAP(Cautoteachstatus)
	ON_WM_SHOWWINDOW()
	ON_WM_TIMER()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// Cautoteachstatus message handlers

void Cautoteachstatus::OnShowWindow(BOOL bShow, UINT nStatus) 
{
	CDialog::OnShowWindow(bShow, nStatus);
	if(bShow=1)
		SetTimer(20, 200, NULL);
	else
		KillTimer(20);
	// TODO: Add your message handler code here
	
}

void Cautoteachstatus::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	CClientDC dc(this);
	CBitmap ON_BitMap;
	CBitmap OFF_BitMap;
	ON_BitMap.LoadBitmap(IDB_BITMAP7);
	OFF_BitMap.LoadBitmap(IDB_BITMAP8);
	WORD	wInput0, wInput1;
	WORD	wInput;
	WORD	wOUTPUT;

	MCC_GetRIOInputValue(&wInput0, RIO_SET1, RIO_PORT0, CARD_INDEX);
	MCC_GetRIOInputValue(&wInput1, RIO_SET1, RIO_PORT1, CARD_INDEX);

	wInput=wInput0;
	if((wInput & 0x0001)>0) // Mold Open
		DrawTransparent(led[2].x,led[2].y,&dc,&ON_BitMap, RGB(255,0,255));
	else
		DrawTransparent(led[2].x,led[2].y,&dc,&OFF_BitMap, RGB(255,0,255));
	if((wInput & 0x0002)>0) // Vac. Check 
		DrawTransparent(led[0].x,led[0].y,&dc,&ON_BitMap, RGB(255,0,255));
	else
		DrawTransparent(led[0].x,led[0].y,&dc,&OFF_BitMap, RGB(255,0,255));
	if((wInput & 0x0040)>0) // Grisp Check
		DrawTransparent(led[1].x,led[1].y,&dc,&ON_BitMap, RGB(255,0,255));
	else
		DrawTransparent(led[1].x,led[1].y,&dc,&OFF_BitMap, RGB(255,0,255));
	if((wInput & 0x0080)>0) // Automatic
		DrawTransparent(led[6].x,led[6].y,&dc,&ON_BitMap, RGB(255,0,255));
	else
		DrawTransparent(led[6].x,led[6].y,&dc,&OFF_BitMap, RGB(255,0,255));
	if((wInput & 0x0100)>0) // Door
		DrawTransparent(led[3].x,led[3].y,&dc,&ON_BitMap, RGB(255,0,255));
	else
		DrawTransparent(led[3].x,led[3].y,&dc,&OFF_BitMap, RGB(255,0,255));
	
	wOUTPUT=OUTPUT0;
	if((wOUTPUT & 0x8000)>0)  //  Mold Area Safety
		DrawTransparent(led[5].x,led[5].y,&dc,&ON_BitMap, RGB(255,0,255));
	else
		DrawTransparent(led[5].x,led[5].y,&dc,&OFF_BitMap, RGB(255,0,255));
	if((wInput & 0x4000)>0) // Mold Close
		DrawTransparent(led[7].x,led[7].y,&dc,&ON_BitMap, RGB(255,0,255));
	else 
		DrawTransparent(led[7].x,led[7].y,&dc,&OFF_BitMap, RGB(255,0,255));
	if((wInput & 0x0004)>0) // Hold 1 Check
		DrawTransparent(led[8].x,led[8].y,&dc,&ON_BitMap, RGB(255,0,255));
	else 
		DrawTransparent(led[8].x,led[8].y,&dc,&OFF_BitMap, RGB(255,0,255));
	if((wInput & 0x0008)>0 && (wInput & 0x0010)>0 && (wInput & 0x0020)>0) // Hold 2 Check
		DrawTransparent(led[9].x,led[9].y,&dc,&ON_BitMap, RGB(255,0,255));
	else 
		DrawTransparent(led[9].x,led[9].y,&dc,&OFF_BitMap, RGB(255,0,255));

	wInput=wInput1;
	if((wInput & 0x0020)>0)  // Pin Limit 
		DrawTransparent(led[4].x,led[4].y,&dc,&ON_BitMap, RGB(255,0,255));
	else
		DrawTransparent(led[4].x,led[4].y,&dc,&OFF_BitMap, RGB(255,0,255));

	CDialog::OnTimer(nIDEvent);
}

BOOL Cautoteachstatus::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	CRect rt;
	m_vac.GetWindowRect(rt);
	led[0].x=rt.left;
	led[0].y=rt.top;
	m_ck.GetWindowRect(rt);
	led[1].x=rt.left;
	led[1].y=rt.top;
	m_mop.GetWindowRect(rt);
	led[2].x=rt.left;
	led[2].y=rt.top;
	m_sdm.GetWindowRect(rt);
	led[3].x=rt.left;
	led[3].y=rt.top;
	m_efp.GetWindowRect(rt);
	led[4].x=rt.left;
	led[4].y=rt.top;
	m_emc.GetWindowRect(rt);
	led[5].x=rt.left;
	led[5].y=rt.top;
	m_auto.GetWindowRect(rt);
	led[6].x=rt.left;
	led[6].y=rt.top;
	m_close.GetWindowRect(rt);
	led[7].x=rt.left;
	led[7].y=rt.top;
	m_hold1.GetWindowRect(rt);
	led[8].x=rt.left;
	led[8].y=rt.top;
	m_hold2.GetWindowRect(rt);
	led[9].x=rt.left;
	led[9].y=rt.top;

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -