Пример #1
0
        public bool JobMove(short Axis, double dAcc, double dDec, double dVel)
        {
            if (Axis < 8 && Axis > -1)
            {
                lock (lockObj)
                {
                    ushort iDir = 0;

                    LTDMC.dmc_set_profile(usCardNo, (ushort)Axis, 0.0, Math.Abs(dVel), dAcc, dDec, 0);
                    if (dVel < 0)
                    {
                        iDir = 0;
                    }
                    else
                    {
                        iDir = 1;
                    }
                    LTDMC.dmc_vmove(usCardNo, (ushort)Axis, iDir);
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
        public bool IsMoveDone(short Axis)
        {
            bool bResult;

            if (bAxisMoving[Axis])
            {
                bResult = false;
            }
            else
            {
                lock (lockObj)
                {
                    dTargetPos[Axis] = LTDMC.dmc_get_target_position(usCardNo, (ushort)Axis);
                }
                if (dCurrentPos[Axis] == dTargetPos[Axis] && (!bAlarm[Axis]) && (!bAxisMoving[Axis]))
                {
                    bResult = true;
                }
                else
                {
                    bResult = false;
                }
            }
            return(bResult);
        }
Пример #3
0
 public bool SetLimtDisable(short axis)
 {
     lock (lockObj)
     {
         LTDMC.dmc_set_el_mode(usCardNo, (ushort)axis, 0, 1, 0);
         return(true);
     }
 }
Пример #4
0
 public bool SetAlarmOff(short axis)
 {
     lock (lockObj)
     {
         LTDMC.dmc_set_alm_mode(usCardNo, (ushort)axis, 1, (ushort)1, (ushort)0);
     }
     return(true);
 }
Пример #5
0
 public bool SetHomeOff(short axis)
 {
     lock (lockObj)
     {
         LTDMC.dmc_set_home_pin_logic(usCardNo, (ushort)axis, 1, 0);
         return(true);
     }
 }
Пример #6
0
 public double GetVel(short Axis)
 {
     if (Axis < 8 && Axis > -1)
     {
         lock (lockObj)
         {
             return(LTDMC.dmc_read_current_speed(usCardNo, (ushort)Axis));
         }
     }
     else
     {
         return(0.0);
     }
 }
Пример #7
0
        public void GetAllIOStatus()
        {
            lock (lockObj)
            {
                uint uiInput  = 0;
                uint uiOutput = 0;
                try
                {
                    uiInput  = LTDMC.dmc_read_inport(usCardNo, 0);
                    uiOutput = LTDMC.dmc_read_outport(usCardNo, 0);
                }
                catch
                {
                }
                bBitInputStatus[0]  = ((uiInput & 0x1) == 0) ? true : false;
                bBitInputStatus[1]  = ((uiInput & 0x2) == 0) ? true : false;
                bBitInputStatus[2]  = ((uiInput & 0x4) == 0) ? true : false;
                bBitInputStatus[3]  = ((uiInput & 0x8) == 0) ? true : false;
                bBitInputStatus[4]  = ((uiInput & 0x10) == 0) ? true : false;
                bBitInputStatus[5]  = ((uiInput & 0x20) == 0) ? true : false;
                bBitInputStatus[6]  = ((uiInput & 0x40) == 0) ? true : false;
                bBitInputStatus[7]  = ((uiInput & 0x80) == 0) ? true : false;
                bBitInputStatus[8]  = ((uiInput & 0x100) == 0) ? true : false;
                bBitInputStatus[9]  = ((uiInput & 0x200) == 0) ? true : false;
                bBitInputStatus[10] = ((uiInput & 0x400) == 0) ? true : false;
                bBitInputStatus[11] = ((uiInput & 0x800) == 0) ? true : false;
                bBitInputStatus[12] = ((uiInput & 0x1000) == 0) ? true : false;
                bBitInputStatus[13] = ((uiInput & 0x2000) == 0) ? true : false;
                bBitInputStatus[14] = ((uiInput & 0x4000) == 0) ? true : false;
                bBitInputStatus[15] = ((uiInput & 0x8000) == 0) ? true : false;

                bBitOutputStatus[0]  = ((uiOutput & 0x1) == 0) ? true : false;
                bBitOutputStatus[1]  = ((uiOutput & 0x2) == 0) ? true : false;
                bBitOutputStatus[2]  = ((uiOutput & 0x4) == 0) ? true : false;
                bBitOutputStatus[3]  = ((uiOutput & 0x8) == 0) ? true : false;
                bBitOutputStatus[4]  = ((uiOutput & 0x10) == 0) ? true : false;
                bBitOutputStatus[5]  = ((uiOutput & 0x20) == 0) ? true : false;
                bBitOutputStatus[6]  = ((uiOutput & 0x40) == 0) ? true : false;
                bBitOutputStatus[7]  = ((uiOutput & 0x80) == 0) ? true : false;
                bBitOutputStatus[8]  = ((uiOutput & 0x100) == 0) ? true : false;
                bBitOutputStatus[9]  = ((uiOutput & 0x200) == 0) ? true : false;
                bBitOutputStatus[10] = ((uiOutput & 0x400) == 0) ? true : false;
                bBitOutputStatus[11] = ((uiOutput & 0x800) == 0) ? true : false;
                bBitOutputStatus[12] = ((uiOutput & 0x1000) == 0) ? true : false;
                bBitOutputStatus[13] = ((uiOutput & 0x2000) == 0) ? true : false;
                bBitOutputStatus[14] = ((uiOutput & 0x4000) == 0) ? true : false;
                bBitOutputStatus[15] = ((uiOutput & 0x8000) == 0) ? true : false;
            }
        }
Пример #8
0
 public bool SetVel(short Axis, double dVel)
 {
     lock (lockObj)
     {
         if (Axis < 8 && Axis > -1)
         {
             LTDMC.dmc_change_speed(usCardNo, (ushort)Axis, dVel, 0.0);
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
Пример #9
0
 public bool SetPulseMode(short axis, PulseMode plm)
 {
     lock (lockObj)
     {
         if (plm == PulseMode.PLDI)
         {
             LTDMC.dmc_set_pulse_outmode(usCardNo, (ushort)axis, 0);
         }
         else
         {
             LTDMC.dmc_set_pulse_outmode(usCardNo, (ushort)axis, 4);
         }
     }
     return(true);
 }
Пример #10
0
 public bool ServoOff(short axis)
 {
     if (axis < 8 && axis > -1)
     {
         lock (lockObj)
         {
             LTDMC.dmc_write_sevon_pin(usCardNo, (ushort)axis, 1);
             return(true);
         }
     }
     else
     {
         return(false);
     }
 }
Пример #11
0
 public bool ZeroAxisPos(short axis)
 {
     if (axis < 8 && axis > -1)
     {
         lock (lockObj)
         {
             LTDMC.dmc_set_position(usCardNo, (ushort)axis, 0);
             return(true);
         }
     }
     else
     {
         return(false);
     }
 }
Пример #12
0
 public bool SetAxisPos(short axis, double dPos)
 {
     if (axis < 8 && axis > -1)
     {
         lock (lockObj)
         {
             LTDMC.dmc_set_position(usCardNo, (ushort)axis, (int)dPos);
             return(true);
         }
     }
     else
     {
         return(false);
     }
 }
Пример #13
0
 public bool StopMove(short Axis)
 {
     if (Axis < 8 && Axis > -1)
     {
         lock (lockObj)
         {
             LTDMC.dmc_stop(usCardNo, (ushort)Axis, 0);
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
Пример #14
0
 public bool SetOutBit(int iBit, bool bOn)
 {
     if (iBit < 128 && iBit > -1)
     {
         lock (lockObj)
         {
             ushort uValue = bOn ? (ushort)0 : (ushort)1;
             short  sValue = LTDMC.dmc_write_outbit(usCardNo, (ushort)iBit, uValue);
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
Пример #15
0
 public bool ReferPosMove(short axis, double dAcc, double dDec, double dSpeed, double pos)
 {
     if (axis < 8 && axis > -1)
     {
         lock (lockObj)
         {
             LTDMC.dmc_set_profile(usCardNo, (ushort)axis, 0.0, dSpeed, dAcc, dDec, 0);
             LTDMC.dmc_pmove(usCardNo, (ushort)axis, (int)pos, 0);
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
Пример #16
0
 public bool StartSearchLimit(short axis, double dAcc, double dDec, double dCatchSpeed)
 {
     lock (lockObj)
     {
         ushort iDir = 0;
         double dVel = Math.Abs(dCatchSpeed);
         LTDMC.dmc_set_profile(usCardNo, (ushort)axis, 0.0, dVel, dAcc, dDec, 0);
         if (dCatchSpeed < 0)
         {
             iDir = 0;
         }
         else
         {
             iDir = 1;
         }
         LTDMC.dmc_vmove(usCardNo, (ushort)axis, iDir);
     }
     return(true);
 }
Пример #17
0
 public bool StartSearchHome(short axis, double dAcc, double dDec, double dHomeSpd)
 {
     lock (lockObj)
     {
         ushort iDir = 0;
         double dVel = Math.Abs(dHomeSpd);
         LTDMC.dmc_set_profile(usCardNo, (ushort)axis, 0.0, dVel, dAcc, dDec, 0);
         if (dHomeSpd < 0)
         {
             iDir = 0;
         }
         else
         {
             iDir = 1;
         }
         LTDMC.dmc_set_homemode(usCardNo, (ushort)axis, iDir, dVel, 2, 0);
         LTDMC.dmc_home_move(usCardNo, (ushort)axis);
     }
     return(true);
 }
Пример #18
0
        override public bool Init(HardWareInfoBase infoHardWare)
        {
            LEISAIMCInfo tempInfo = (LEISAIMCInfo)infoHardWare;

            if (nCardTotal > 0)
            {
                if (nCardTotal >= tempInfo.iCardNo)
                {
                    bInitOK = true;
                }
                else
                {
                    bInitOK = false;
                }
            }
            else
            {
                nCardTotal = LTDMC.dmc_board_init();
                if (nCardTotal <= 0)//控制卡初始化
                {
                    bInitOK = false;
                    return(false);
                }
                if (nCardTotal >= tempInfo.iCardNo)
                {
                    bInitOK = true;
                }
                else
                {
                    bInitOK = false;
                }
            }
            usCardNo = (ushort)tempInfo.iCardNo;
            System.Threading.Thread threadScan = new System.Threading.Thread(ScanThreadFunction);
            threadScan.IsBackground = true;
            threadScan.Start();
            return(true);
        }
Пример #19
0
        public void GetAllMotionStatus()
        {
            lock (lockObj)
            {
                for (ushort iAxis = 0; iAxis < 8; iAxis++)
                {
                    uint uiCurrent = 0;
                    try
                    {
                        dTargetPos[iAxis]  = LTDMC.dmc_get_target_position(usCardNo, iAxis);
                        dCurrentPos[iAxis] = LTDMC.dmc_get_position(usCardNo, iAxis);

                        if (LTDMC.dmc_check_done(usCardNo, iAxis) == 1)
                        {
                            bAxisMoving[iAxis] = false;
                        }
                        else
                        {
                            bAxisMoving[iAxis] = true;
                        }
                        uiCurrent = LTDMC.dmc_axis_io_status(usCardNo, iAxis);
                    }
                    catch
                    {
                    }

                    if ((uiCurrent & 0x1) == 0)
                    {
                        bAlarm[iAxis] = false;
                    }
                    else
                    {
                        bAlarm[iAxis] = true;
                    }
                    if ((uiCurrent & 0x2) == 0)
                    {
                        bCWL[iAxis] = false;
                    }
                    else
                    {
                        bCWL[iAxis] = true;
                    }
                    if ((uiCurrent & 0x4) == 0)
                    {
                        bCCWL[iAxis] = false;
                    }
                    else
                    {
                        bCCWL[iAxis] = true;
                    }
                    if ((uiCurrent & 0x10) == 0)
                    {
                        bHome[iAxis] = false;
                    }
                    else
                    {
                        bHome[iAxis] = true;
                    }
                }
            }
        }