DC Motor control using C++
 DC motor control using VC++
 Stepper motor control using VC++
 Industrial DC Motor Control panel
 industrial stepper motor control panel
 remote control for AC Drive
 Traffic control system
 Wireless DC Motor controller
 Wireless Stepper motor controller

~: DC motor control panle program in VC++ :~

void CAutotimerDlg::OnStrt()

{

            // TODO: Add your control notification handler code here

            SetTimer(ID_CNT_TMR,1000,NULL);                   // start timer when start button

            m_ic = 0;                                                                     // is pressed with 1 sec delay     

            m_scnt.Format("%d",m_ic);

}

 

void CAutotimerDlg::OnTimer(UINT nIDEvent)

{

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

            UpdateData(TRUE);

            if(m_ic != m_intv)

            {

                        m_ic++;                                               // update the count after every sec

                        m_scnt.Format("%d",m_ic);                  // and display it

                        if((c%2)==0)                                        // change the direction after entered

                        {

                                    _outp(0x0378,0x12);               // time interval

                                    //MessageBox("Motor is running reverse");

                        }

                        else

                        {

                                    _outp(0x0378,0x32);

                                    //MessageBox("Motor is running forward");

                        }

            }

            else if(m_ic = m_intv)

            {

                        c++;

                        m_ic = 0;

                        m_scnt.Format("%d",m_ic);

            }

            UpdateData(FALSE);

            CDialog::OnTimer(nIDEvent);

}

 

void CAutotimerDlg::OnStop()

{

            // TODO: Add your control notification handler code here

            KillTimer(ID_CNT_TMR);                              // stop see-saw effect

            _outp(0x0378,0x00);

}

 

void CAutotimerDlg::OnFwd()

{

            // TODO: Add your control notification handler code here        

            f=0;

            UpdateData(TRUE);

            m_t = m_itime*250;    

            MessageBox("motor has started in forward direction");

            _outp(0x0378,0x11);                           // increase the speed gradually to maximum

            Sleep(m_t);                                          // with entered rise time

            _outp(0x0378,0x12);

            Sleep(m_t);

            _outp(0x0378,0x14);

            Sleep(m_t);

            _outp(0x0378,0x18);

            c1 =4;

            MessageBox("motor has attained full speed");

            UpdateData(FALSE);

}

 

void CAutotimerDlg::OnRev()

{

            // TODO: Add your control notification handler code here

            f=1;

            UpdateData(TRUE);

            m_t = m_itime*250;

            MessageBox("motor has started in reverse direction");

            _outp(0x0378,0x31);                           // increase the speed gradually to maximum

            Sleep(m_t);                                          // with entered rise time

            _outp(0x0378,0x32);

            Sleep(m_t);

            _outp(0x0378,0x34);

            Sleep(m_t);

            _outp(0x0378,0x38);

            c1 =4;

            MessageBox("motor has attained full speed");

            UpdateData(FALSE);

}

 

void CAutotimerDlg::OnStp()

{

            // TODO: Add your control notification handler code here

            UpdateData(TRUE);

            m_t = m_itime*500;

            if(f == 0)

            {

                        MessageBox("motor was running in forward direction");

                        _outp(0x0378,0x12);                           // gradually stops the motor      

                        Sleep(m_t);                                          // in two steps with entered       

                        _outp(0x0378,0x11);                           // delay

                        Sleep(m_t);

                        _outp(0x0378,0x00);

                        MessageBox("Motor is stopped");

            }

            else

            {

                        MessageBox("motor was running in reverse direction");

                        _outp(0x0378,0x32);

                        Sleep(m_t);

                        _outp(0x0378,0x31);

                        Sleep(m_t);

                        _outp(0x0378,0x00);

                        MessageBox("Motor is stopped");

            }

}

 

void CAutotimerDlg::OnInc()

{

            // TODO: Add your control notification handler code here

            if(c1 != 4) c1++;

                        else if (c1 = 4)

                        {

                                    c1=1;

                                    MessageBox("Maximum speed");

                        }

            if(f == 0)

            {

                        switch(c1)

                        {

                        case 1:

                                    _outp(0x0378,0x11);

                                    MessageBox("Speed is 1");

                                    break;

                        case 2:

                                    _outp(0x0378,0x12);

                                    MessageBox("Speed is 2");

                                    break;

                        case 3:

                                    _outp(0x0378,0x14);

                                    MessageBox("Speed is 3");

                                    break;

                        case 4:

                                    _outp(0x0378,0x18);

                                    MessageBox("Speed is 4");

                                    break;

                        }

            }

            else

            {

                        switch(c1)

                        {

                        case 1:

                                    _outp(0x0378,0x31);

                                    break;

                        case 2:

                                    _outp(0x0378,0x32);

                                    break;

                        case 3:

                                    _outp(0x0378,0x34);

                                    break;

                        case 4:

                                    _outp(0x0378,0x38);

                                    break;

                        }

            }

}

 

void CAutotimerDlg::OnDec()

{

            // TODO: Add your control notification handler code here

            if(c1 != 1) c1--;           

            if(f == 0)

            {

                        switch(c1)

                        {

                        case 1:

                                    _outp(0x0378,0x11);

                                    MessageBox("Speed is 1");

                                    break;

                        case 2:

                                    _outp(0x0378,0x12);

                                    MessageBox("Speed is 2");

                                    break;

                        case 3:

                                    _outp(0x0378,0x14);

                                    MessageBox("Speed is 3");

                                    break;

                        case 4:

                                    _outp(0x0378,0x18);

                                    MessageBox("Speed is 4");

                                    break;

                        }

            }

            else

            {

                        switch(c1)

                        {

                        case 1:

                                    _outp(0x0378,0x31);

                                    break;

                        case 2:

                                    _outp(0x0378,0x32);

                                    break;

                        case 3:

                                    _outp(0x0378,0x34);

                                    break;

                        case 4:

                                    _outp(0x0378,0x38);

                                    break;

                        }

            }

}

 

void CAutotimerDlg::OnXit()

{

            // TODO: Add your control notification handler code here

            OnOK();

            _outp(0x0378,0x00);

} 

All the projects are designed and developed by sight owner and they are thoroughly tested by him. ©Copyrights Ashutosh Bhatt 2010. All rights reserved.