ÇнÀ¸ñÇ¥    1

ÇнÀÁÖÁ¦    1

¿¹½À³»¿ë    1

½Ç½À¹æ¹ý    1

°ú    Á¦    1

Áß¿äÇÔ¼ö    1

±×·¡ÇÁ ±×¸®±â

ÇнÀ¸ñÇ¥

µ¥ÀÌÅ͸¦ ±×·¡ÇÁ·Î ±×¸®´Â ¹æ¹ýÀ» ¹è¿î´Ù.

ÇнÀÁÖÁ¦

ŸÀ̸Ӹ¦ 0.1ÃÊ·Î µ¿ÀÛ½ÃÅ°°í ÀÌ ¶§1ºÎÅÍ 1¾¿ Áõ°¡ÇÏ´Â µ¥ÀÌÅ͸¦ ¸Þ¸ð¸®¿¡ ÀúÀåÇÏ°í À̸¦ ±×·¡ÇÁ·Î ±×¸°´Ù.

¿¹½À³»¿ë

 

½Ç½À¹æ¹ý

¸ñ    Â÷

(1)     ÇÁ·ÎÁ§Æ® À̸§À» Graph·Î ¸¸µç´Ù. ¾Æ·¡ ÇØ´ç¹øÈ£ÀÇ ÇÁ·Î±×·¥Àº GraphDlg.cpp¿¡ »¡°£ ±Û¾¾·Î Ç¥½ÃµÇ¾î ÀÖ´Ù.

(2)     ¸Þ´ºÀÇ View->ClassWizard¿¡¼­ 0.5Ãʸ¶´Ù µ¿ÀÛÇϴ ŸÀ̸Ӹ¦ ¼³Á¤ÇÑ´Ù.

WM_TIMER ¸¦ ¸¶¿ì½º ¿ÞÂÊ ¹öÆ°À» µÎ¹ø Å©¸¯Çϸé OnTimer ÇÔ¼ö°¡ ¸¸µé¸é ÀÌ ÇÔ¼ö´Â 0.1Ãʸ¶´Ù µ¿ÀÛÇÏ°Ô µÈ´Ù.

(3)     BOOL CGraphDlg::OnInitDialog()¿¡ SetTimer(1,100,NULL);¸¦ Ãß°¡ÇÏ¿© ŸÀ̸Ӱ¡ 0.1Ãʸ¶´Ù µ¿ÀÛÇÏ°Ô ÇÑ´Ù.

(4)     Control Tool Bar¿¡¼­  ¸¦ ¼±ÅÃÇÏ¿© ±×·¡ÇÁâÀ» ¸¸µç´Ù.

 

CWGraph1À» ¿À¸¥ÂÊ ¸¶¿ìÅ°¸¦ ´­·¯ Properties¸¦ ¼±ÅÃÇÑ´Ù. ¾Æ·¡ ±×¸²°ú °°ÀÌ Xaxis, Yaxis-1 ÀÇ Auto scaleÀ» ¼±ÅÃÀ» ÇØÁ¦ÇÏ°í Minimur, Maximur¸¦ 0~100À¸·Î ÇÑ´Ù.

 

(5)     ±×·¡ÇÁÀÇ VariableÀ» ¾Æ·¡¿Í °°ÀÌ Ãß°¡ÇÑ´Ù.

(5)     ClassView¿¡¼­ ¸¶¿ì½º ¿À¸¥ÂÊÅ°¸¦ ´­·¯ YÃà µ¥ÀÌÅÍ ÀúÀåÀ» À§ÇÑ ¹è¿­À» Á¤ÀÇ ÇÑ´Ù.

BOOL CGraphDlg::OnInitDialog() ÇÔ¼ö¿¡ ¹è¿­À» ¸¸µç´Ù.

Yvalue = new double[100];                           // (6)

 

(7)     °°Àº ¹æ¹ýÀ¸·Î iTimeÀ» Á¤ÀÇ ÇÏ¿© ŸÀ̸Ӱ¡ On µÉ ¶§¸¶´Ù 1¾¿ Áõ°¡ ½ÃŲ´Ù. 100°³±îÁö ÀúÀåµÇ°Ô ÇÑ´Ù.

BOOL CGraphDlg::OnInitDialog()¿¡ iTime=0À¸·Î ÃʱâÈ­¸¦ ÇÑ´Ù.

 

(8)     OnTimer(UINT nIDEvent) ÇÔ¼ö¸¦ ¾Æ·¡¿Í °°ÀÌ ±¸¼ºÇÑ´Ù.

 

void CGraphDlg::OnTimer(UINT nIDEvent)

{

              // TODO: Add your message handler code here and/or call default

              if(iTime >= 100)      // µ¥ÀÌŸ¸¦ 100°³±îÁö ¹Ýº¹ÀûÀ¸·Î ÀúÀå

                                                                iTime = 0;

              Yvalue[iTime] = (double)iTime;

             

              // Move the data to the CNiReal64Vector data type

              CNiReal64Vector myvector(iTime+1, Yvalue);

              m_graph.PlotY(myvector, 0., 1.);

              iTime++;

 

              CDialog::OnTimer(nIDEvent);

}

 

óÀ½

°ú    Á¦

1.        ±×·¡ÇÁ¸¦ ±×¸± ¶§¸¶´Ù ¡°sndPlaySound("²ÞÀǼҸ®", SND_SYNC)¡± ÇÔ¼ö¸¦ ½á¼­ ½ºÇÇÄ¿¿¡¼­ ¼Ò¸®°¡ ³ªµµ·Ï ÇÁ·Î±×·¥ÇÑ´Ù. ¡°²ÞÀǼҸ®.wav¡± ÆÄÀÏÀº ½ÇÇà ÆÄÀÏ°ú °°Àº µð·ºÅ丮¿¡ ÀÖ¾î¾ß ÇÑ´Ù.

¾Æ·¡´Â ¡°OnTimer¡± ÇÔ¼ö¿¡ ÇÁ·Î±×·¥À» ¼öÁ¤ÇÑ °ÍÀÌ´Ù.

 

void CGraphDlg::OnTimer(UINT nIDEvent)

{

              // TODO: Add your message handler code here and/or call default

              if(iTime >= 100)                    // µ¥ÀÌŸ¸¦ 100°³±îÁö ¹Ýº¹ÀûÀ¸·Î ÀúÀå

                             iTime = 0;

              Yvalue[iTime] = (double)iTime;

             

              // Move the data to the CNiReal64Vector data type

              CNiReal64Vector myvector(iTime+1, Yvalue);

              m_graph.PlotY(myvector, 0., 1.);

              iTime++;

              sndPlaySound("²ÞÀǼҸ®", SND_SYNC);

 

              CDialog::OnTimer(nIDEvent);

}

 

2.        À§ÀÇ ¿¹Á¦ ŸÀ̸Ӹ¦ Á¤Áö ½ÃÅ°°í ¸¶¿ì½º¸¦ ¿òÁ÷ÀÏ ¶§¸¶´Ù ±×·¡ÇÁ°¡ ±×·ÁÁöµµ·Ï ÇÁ·Î±×·¥ ÇϽÿÀ.

1)       OnInitDialog()¿¡¼­ SetTimer() ÇÔ¼ö¸¦ Á¤Áö ½ÃŲ´Ù.

2)       ¸Þ´º¿¡¼­ ClassWizard¸¦ ¼±ÅÃÇÏ°í ¡°WM_MOUSEMOVE¡±¸¦ ¼±ÅÃÇØ OnMouseMove(UINT nFlags, CPoint point) ÇÔ¼ö¸¦ ¸¸µé°í ¿©±â¿¡ À§ÀÇ OnTimer()¿¡ ÀÖ´Â ÇÔ¼ö¸¦ ±×´ë·Î º¹»çÇÑ´Ù.

    ¾Æ·¡´Â ¡°OnMouseMove¡± ÇÔ¼öÀÌ´Ù.

 

void CGraphDlg::OnMouseMove(UINT nFlags, CPoint point)

{

              // TODO: Add your message handler code here and/or call default

              if(iTime >= 100)      // µ¥ÀÌŸ¸¦ 100°³±îÁö ¹Ýº¹ÀûÀ¸·Î ÀúÀå

                             iTime = 0;

              Yvalue[iTime] = (double)iTime;

             

              // Move the data to the CNiReal64Vector data type

              CNiReal64Vector myvector(iTime+1, Yvalue);

              m_graph.PlotY(myvector, 0., 1.);

              iTime++;

              CDialog::OnMouseMove(nFlags, point);

}

 

 

AVR Åë½Å ÇÁ·Î±×·¥

1.        À§ ¡°°úÁ¦1¡±¿¡ ±×·¡ÇÁ¸¦ ±×¸± ¶§ ¸¶´Ù Åë½ÅÀ¸·Î º¸µåÀÇ LED 8°³°¡ µ¿½Ã¿¡ On/Off ¸¦ ¹Ýº¹ÀûÀ¸·Î µ¿ÀÛÇϵµ·Ï ÇÁ·Î±×·¥ÇÑ´Ù.

if(iTime%2==0) ´Â iTimeÀ» 2·Î ³ª´« ³ª¸ÓÁö´Â 0°ú1À» ¹Ýº¹Çؼ­ ¹ß»ýÇÔÀ¸·Î ÀÌ °ªÀ» µû¶ó LED°¡ µ¿ÀÛÇϵµ·Ï ÇÁ·Î±×·¥ ÇÏ¿´´Ù.

 

void CRs232Dlg::OnTimer(UINT nIDEvent)

{

              // TODO: Add your message handler code here and/or call default

              if(iTime >= 100)      // µ¥ÀÌŸ¸¦ 100°³±îÁö ¹Ýº¹ÀûÀ¸·Î ÀúÀå

                             iTime = 0;

              Yvalue[iTime] = (double)iTime;

             

              // Move the data to the CNiReal64Vector data type

              CNiReal64Vector myvector(iTime+1, Yvalue);

              m_graph.PlotY(myvector, 0., 1.);

              iTime++;

              sndPlaySound("²ÞÀǼҸ®", SND_SYNC);

 

              // LED µ¿ÀÛÀ» Åë½ÅÀ¸·Î º¸³½´Ù.

              unsigned char buff[5]="";

              if(iTime%2==0) {

                             buff[0]=0x00;

                             m_ComuPort.WriteComm((unsigned char*)buff,1);

              }

              else {

                             buff[0]=0xff;

                             m_ComuPort.WriteComm((unsigned char*)buff,1);

              }

 

              CDialog::OnTimer(nIDEvent);

}

 

[ÀüüÇÁ·Î±×·¥ ³»·Á¹Þ±â]

2.        ¡°°úÁ¦2¡± ÇÁ·Î±×·¥¿¡¼­ ŸÀÌ¸Ó µ¿ÀÛÀ» Á¤Áö ½ÃÅ°°í ¸¶¿ì½º°¡ ¿òÁ÷ÀÏ ¶§ ¸¶´Ù ±×·¡ÇÁ¸¦ ±×¸®°í º¸µåÀÇ LED°¡ µ¿ÀÛ Çϵµ·Ï ÇÁ·Î±×·¥ ÇϽÿÀ.

 

void CRs232Dlg::OnMouseMove(UINT nFlags, CPoint point)

{

             // TODO: Add your message handler code here and/or call default

             if(iTime >= 100)       // µ¥ÀÌŸ¸¦ 100°³±îÁö ¹Ýº¹ÀûÀ¸·Î ÀúÀå

                               iTime = 0;

             Yvalue[iTime] = (double)iTime;

            

             // Move the data to the CNiReal64Vector data type

             CNiReal64Vector myvector(iTime+1, Yvalue);

             m_graph.PlotY(myvector, 0., 1.);

             iTime++;

             sndPlaySound("²ÞÀǼҸ®", SND_SYNC);

 

             // LED µ¿ÀÛÀ» Åë½ÅÀ¸·Î º¸³½´Ù.

             unsigned char buff[5]="";

             if(iTime%2==0) {

                               buff[0]=0x00;

                               m_ComuPort.WriteComm((unsigned char*)buff,1);

             }

             else {

                               buff[0]=0xff;

                               m_ComuPort.WriteComm((unsigned char*)buff,1);

             }

             CDialog::OnMouseMove(nFlags, point);

}

 

 [ÀüüÇÁ·Î±×·¥ ³»·Á¹Þ±â]

Áß¿äÇÔ¼ö