|
ŸÀÌ¸Ó ¸¸µé±â(MASTER-K10s1) |
|||||||||
ÇнÀ¸ñÇ¥ |
||||||||||
0.5ÃÊ °£°ÝÀ¸·Î ŸÀ̸Ӹ¦ µ¿ÀÛ ½ÃÄÑ ½Ã°£À» È®ÀÎÇÏ°í ÄÄÇ»ÅÍÀÇ ¼³Á¤ÇÑ ½Ã°£ µ¿¾È PLC¸¦ µ¿ÀÛ ½ÃŲ´Ù. |
||||||||||
ÇнÀÁÖÁ¦ |
||||||||||
1. ¡°¿ø°ÝÁ¦¾î¡± 3ÁÖÂ÷ ÇÁ·Î±×·¥À» »ç¿ëÇÏ¿© ÇÁ·Î±×·¥ÇÑ´Ù. 2. ŸÀÌ¸Ó ¼³Á¤À» 0.5ÃÊ·Î µ¿ÀÛ ½ÃŲ´Ù. 3. Àоî¿Ã PLC ¹øÈ£¸¦ ¼³Á¤ÇÑ´Ù. 4. PLC µ¿ÀÛ ½Ã°£À» ¼³Á¤ÇÑ´Ù. 5. ŸÀÌ¸Ó ÇÔ¼ö ¾È¿¡ ÀÔ·ÂµÈ ½Ã°£°ú ÄÄÇ»ÅÍ ½Ã°£À» ºñ±³ÇÏ¿© 0.5ÃÊ À̳»¸é On/Off¸¦ PLC·Î Ãâ·ÂÇÑ´Ù. 6. ÄÄÇ»ÅÍ¿¡¼ Ãâ·Â¸¸ ³»º¸³»¹Ç·Î ¼ö½Å ÇÁ·Î±×·¥ OnCommunication() Àº µ¿ÀÛ ÇÁ·Î±×·¥À» ÀÔ·ÂÇÒ ÇÊ¿ä°¡ ¾ø´Ù. |
||||||||||
¿¹½À³»¿ë |
||||||||||
1. ¡°PLC µ¥ÀÌÅÍ Àб⡱ ¸í·É¹® ÀÛ¼º Àб⠸í·ÉÀ» ¾Æ·¡¿Í °°ÀÌ º¸³½´Ù. STX01GP000008EOT À§¿¡¼ 01Àº ±â±â¹øÈ£, G´Â µ¥ÀÌÅÍ Àб⠸í·É, P0000 µ¥ÀÌÅÍ ÀбâÀÇ ½ÃÀÛ¹øÁö, 08Àº ÀÐÀ» µ¥ÀÌÅÍ °³¼ö ÀÌ´Ù. À̸¦ ÇÁ·Î±×·¥ ÇÏ¸é ¾Æ·¡¿Í °°´Ù. strTemp.Format("%c%02dGP000008%c",0x05,(int)m_nMachinNo.Value,0x04); m_nMachinNo´Â PLC ¹øÈ£ 2. ¼ö½Åµ¥ÀÌÅÍ ºÐ¼® À§¿Í °°ÀÌ º¸³»¸é ¼ö½ÅµÇ¾î ¿À´Â µ¥ÀÌÅÍ´Â ¾Æ·¡¿Í °°´Ù. STX01G10000000EOT ¿©±â¼ 01Àº ±â±â¹øÈ£, G Àб⠸í·É ÄÚµå, 10000000 Àº 8°³ ÀÔ·Â Æ÷Æ® P00~P07 ±îÁö 8°³ÀÇ µ¥ÀÌÅÍ »óÅ·ΠÁö±ÝÀº P00Àº 24V°£ ¿¬°áµÇ°í ³ª¸ÓÁö P01~P07Àº 0V°¡ ÀԷµǰí ÀÖ´Ù. |
||||||||||
½Ç½À¹æ¹ý |
||||||||||
¸ñ Â÷ |
||||||||||
|
||||||||||
|
¿¹Á¦1 OnInitDialog() ÇÔ¼ö ¾È¿¡ ŸÀÌ¸Ó ¼³Á¤À» 0.5ÃÊ(500ms)·Î ¹Ù²Û´Ù. |
|
||||||||
|
BOOL CRs232Dlg::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) { CString strAboutMenu; strAboutMenu.LoadString(IDS_ABOUTBOX); 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_ComuPort.OpenPort( "COM1", 9600, 1 ); SetTimer(1,500,NULL); return TRUE; // return TRUE unless you set the focus to a control } |
|
||||||||
|
||||||||||
¡°NumEdit Control¡±À» ¼±ÅÃÇÏ°í ¸¶¿ì½º ¿À¸¥ÂÊ Å°¸¦ ´·¯¼ ¡°Properties¡±¸¦ ¼±ÅÃÇÏ¿© ¡°styles¡±¸¦ ¡°Time¡±À¸·Î ¼³Á¤ÇÑ´Ù. °°Àº ¹æ¹ýÀ¸·Î ¿À¸¥ÂÊ ±×¸²°ú °°ÀÌ ¡°½ÃÀ۽𣡱 ¡°Á¾·á½Ã°£¡± ¡°ÇöÀç½Ã°£¡± 3°³¸¦ ¸¸µç´Ù. |
||||||||||
|
|
|||||||||
|
||||||||||
¡°ClassWizard¡± ´ÙÀ½ÀÇ Member VariableÀ» ¾Æ·¡¿Í °°ÀÌ Á¤ÀÇ ÇÑ´Ù. |
||||||||||
|
½Ã°£Ç¥½Ã |
Control IDs |
Member |
|
||||||
|
½ÃÀ۽ð£ |
IDC_CWNUMEDIT1 |
m_StartTime |
|
||||||
|
Á¾·á½Ã°£ |
IDC_CWNUMEDIT2 |
m_EndTime |
|
||||||
|
ÇöÀç½Ã°£ |
IDC_CWNUMEDIT3 |
m_NowTime |
|
||||||
|
||||||||||
|
||||||||||
¡°OnTimer¡± ÇÔ¼ö¿¡¼ ÇöÀç ½Ã°£À» üũÇÏ¿© ¼³Á¤ ½Ã°£ »çÀÌ¿¡ ÀÖÀ¸¸é Ãâ·Â ½ºÀ§Ä¡ÀÇ On/Off¸¦ üũÇÏ¿© ±× »óŸ¦ Ãâ·ÂÀ¸·Î ³»º¸³½´Ù. ´ÙÀ½Àº ±× ÇÔ¼ö ÀÌ´Ù. |
||||||||||
|
¿¹Á¦2 OnTimer ÇÔ¼ö |
|
||||||||
|
void CRs232Dlg::OnTimer(UINT nIDEvent) { // TODO: Add your message handler code here and/or call default struct _timeb timebuffer; // (7) char *timeline; char Tbuf[9]; _ftime( &timebuffer ); timeline = ctime( & ( timebuffer.time ) ); Tbuf[0]=timeline[11]; Tbuf[1]=timeline[12]; Tbuf[2]=timeline[13]; Tbuf[3]=timeline[14]; Tbuf[4]=timeline[15]; Tbuf[5]=timeline[16]; Tbuf[6]=timeline[17]; Tbuf[7]=timeline[18]; Tbuf[8]=0x00; // ÇöÀç ½Ã°£ °è»êÇÏ¿© Ç¥½ÃÇÑ´Ù. m_NowTime.Value =((double)(timeline[11]-0x30)*10+(double)(timeline[12]-0x30))/24. +((double)(timeline[14]-0x30)*10+(double)(timeline[15]-0x30))/(24.*60.) +((double)(timeline[17]-0x30)*10+(double)(timeline[18]-0x30))/(24.*60.*60.); // ¼³Á¤ ½Ã°£ »çÀÌ¿¡ ÀÖÀ¸¸é Ãâ·ÂÀ» ³»º¸³½´Ù. if(m_NowTime.Value>=m_StartTime.Value && m_NowTime.Value<=m_EndTime.Value) CheckOut(); else { CString strTemp; strTemp.Format("%c%02dHP001006000000%c",0x05, (int)m_nMachinNo.Value,0x04); // P0001 ¿¡¼ºÎÅÍ 6°³ÀÇ Æ÷Æ®·Î 111111 ºñÆ® »óÅ·ΠÃâ·Â m_ComuPort.WriteComm((unsigned char*)(LPCTSTR)strTemp,strTemp.GetLength()); } UpdateData(FALSE); CDialog::OnTimer(nIDEvent); } |
|
||||||||
|
||||||||||
|
||||||||||
|
||||||||||
°ú Á¦ |
||||||||||
|
||||||||||
Áß¿äÇÔ¼ö |
||||||||||
|
||||||||||