Exemplo n.º 1
0
        public void SetChannelVoltage(uint channelIndex, uint V_0_150)
        {
            // minimum step size=100, otherwise will mResult in error,
            // step=0-4095  SA_StepMove_S
            //mResult = CCoarseController.SA_GotoGripperOpeningRelative_S((uint)(uint)mSystemIndex, (uint)(uint)channelIndex, V_0_4095, 1);
            if (V_0_150 > 150)
            {
                V_0_150 = 150;
            }
            V_0_150 *= (uint)(4095.0 / 150.0);

            mResult = CCoarseController.SA_ScanMoveAbsolute_S((uint)mSystemIndex, (uint)(uint)channelIndex, V_0_150, 100000);


            if (mResult != CCoarseController.SA_OK)
            {
                //Initialize();
                MY_DEBUG("SetChannelVoltage error!\n");
                Initialize();

                MY_DEBUG("redo initialize=" + redo_count.ToString());
                if (redo_count++ < 10)
                {
                    SetChannelVoltage(channelIndex, V_0_150);
                }
            }
            redo_count = 0;
        }
Exemplo n.º 2
0
 void  SetSensorMode(uint mode)
 {
     mResult = CCoarseController.SA_SetSensorEnabled_S((uint)mSystemIndex, mode);
     if (mResult != CCoarseController.SA_OK)
     {
         //Initialize();
         MY_DEBUG("SetSensorMode error!\n");
     }
 }
Exemplo n.º 3
0
        // void  MoveDistance(uint channelIndex, int  stepsize)
        // {
        //  // close loop inside the controller, open loop for this function
        //  SetSpeedCloseLoop((uint)channelIndex,0);
        //   mResult = CCoarseController.SA_GotoPositionRelative_S((uint)mSystemIndex, (uint)channelIndex, stepsize, 1000);
        //  if (mResult != CCoarseController.SA_OK)
        //  {
        //      //Initialize();
        //      MY_DEBUG("MoveWait GetStatus error!\n");
        //  }
        // }
        //
        // void  MoveDistance(uint channelIndex, int  stepsize,int speed)
        // {	// close loop
        //  //SetSpeedCloseLoop((uint)channelIndex,abs(stepsize)*100);
        //  SetSpeedCloseLoop((uint)channelIndex,abs(speed));
        //  mResult =	CCoarseController.SA_GotoPositionRelative_S((uint)mSystemIndex, (uint)channelIndex, stepsize, 1000);
        //  if (mResult != CCoarseController.SA_OK)
        //  {
        //      //Initialize();
        //      MY_DEBUG("MoveWait GetStatus error!\n");
        //  }
        //  //SetSpeedCloseLoop((uint)channelIndex,0);
        // }


        void  SetPosition(uint channelIndex, int position)
        {
            mResult = CCoarseController.SA_SetPosition_S((uint)mSystemIndex, (uint)channelIndex, position);
            if (mResult != CCoarseController.SA_OK)
            {
                //Initialize();
                MY_DEBUG("SetPosition error!\n");
            }
        }
Exemplo n.º 4
0
        void  MoveFineDistance(int channel, int distance, uint speed)
        {
            //CCoarseController.SA_Stop_S((uint)mSystemIndex,(uint)channel);
            mResult = CCoarseController.SA_ScanMoveRelative_S((uint)mSystemIndex, (uint)channel, distance, speed);

            if (mResult != CCoarseController.SA_OK)
            {
                //Initialize();
                MY_DEBUG("MoveFineDistance error!\n");
            }
        }
Exemplo n.º 5
0
        int  GetPosition(uint channelIndex)
        {
            int position = 0;

            mResult = CCoarseController.SA_GetPosition_S((uint)mSystemIndex, (uint)channelIndex, ref position);
            if (mResult != CCoarseController.SA_OK)
            {
                //Initialize();
                MY_DEBUG("GetPosition error!\n");
            }
            return(position);
        }
Exemplo n.º 6
0
        uint  GetFinePosition(uint channelIndex)
        {
            uint level = 0;

            mResult = CCoarseController.SA_GetVoltageLevel_S((uint)mSystemIndex, (uint)channelIndex, ref level);
            if (mResult != CCoarseController.SA_OK)
            {
                //Initialize();
                MY_DEBUG("GetFinePosition error!\n");
            }
            return(level);
        }
Exemplo n.º 7
0
        void  MoveFineSteps(uint channelIndex, int steps, uint amplitude, uint frequency)
        {
            // minimum step size=100, otherwise will mResult in error,
            // step=0-4095
            mResult = CCoarseController.SA_StepMove_S((uint)(uint)mSystemIndex, (uint)(uint)channelIndex, steps, amplitude, frequency);

            if (mResult != CCoarseController.SA_OK)
            {
                //Initialize();
                MY_DEBUG("MoveFineSteps error!\n");
            }
        }
Exemplo n.º 8
0
        public int  Initialize()
        {
            //(uint)mSystemIndex = 0;

            Stop(X_CP_AXIS);
            Stop(Y_CP_AXIS);
            Stop(Z_CP_AXIS);

            for (int k = 0; k < 10; k++)
            {
                try
                {
                    CCoarseController.SA_ReleaseSystems();
                    Thread.Sleep(5 * k + 5);
                    mResult = CCoarseController.SA_InitSystems(CCoarseController.SA_SYNCHRONOUS_COMMUNICATION);                  // init systems
                    if (mResult == CCoarseController.SA_OK)
                    {
                        break;
                    }
                    Thread.Sleep(5);
                }
                catch (Exception ex)
                {
                    MY_DEBUG("Nanopositioner rescure error!");
                }
            }
            if (mResult != CCoarseController.SA_OK)
            {
                MY_DEBUG("Nanopositioner initial error!");
                return(1);
            }

            CCoarseController.SA_SetAccumulateRelativePositions_S((uint)mSystemIndex, Z_CP_AXIS, CCoarseController.SA_NO_ACCUMULATE_RELATIVE_POSITIONS);
            Stop(X_CP_AXIS);
            Stop(Y_CP_AXIS);
            Stop(Z_CP_AXIS);

            mOpenLoopFrequency = 300;

            SetSpeedCloseLoop(X_CP_AXIS, 0);
            SetSpeedCloseLoop(Y_CP_AXIS, 0);
            SetSpeedCloseLoop(Z_CP_AXIS, 0);
            SetSensorModeDisable();

            SetChannelVoltage(X_CP_AXIS, 0);
            SetChannelVoltage(Y_CP_AXIS, 0);
            SetChannelVoltage(Z_CP_AXIS, 0);
            return(0);
        }
Exemplo n.º 9
0
        void  WaitForIdle(uint channelIndex)
        {
            mResult = 0;

            do
            {
                //pin_ptr<uint *> pinnedPtr =  (uint * )&mStatus;
                uint pR = 0;
                mResult = CCoarseController.SA_GetStatus_S((uint)mSystemIndex, (uint)channelIndex, ref pR);       // get mStatus
                if (mResult != CCoarseController.SA_OK & pR != CCoarseController.SA_OK)
                {
                    //Initialize();
                    MY_DEBUG("MoveWait GetStatus error!\n");
                }
                Thread.Sleep(3);
            }while (mStatus == CCoarseController.SA_TARGET_STATUS);        // until target reach.
        }
Exemplo n.º 10
0
        //////////////////////////////////////

        void  MoveToFinePosition(uint channel, uint position, uint speed)
        {
            if (position > 4095 || position < 0)
            {
                MY_DEBUG("MoveToFinePosition input exceeding error!\n");
            }
            if (position > 4095)
            {
                position = 4095;
            }
            if (position < 0)
            {
                position = 0;
            }

            CCoarseController.SA_ScanMoveAbsolute_S((uint)mSystemIndex, (uint)channel, position, speed);
        }
Exemplo n.º 11
0
        void SetSpeedCloseLoop(uint channel, uint speed)
        {
            CCoarseController.SA_SetClosedLoopMoveSpeed_S(mSystemIndex, channel, speed);
            if (speed > 18500)
            {
                speed = 18500;
            }
            if (speed < 50)
            {
                speed = 50;
            }

            mResult = CCoarseController.SA_SetClosedLoopMaxFrequency_S(mSystemIndex, channel, speed);
            if (mResult != CCoarseController.SA_OK)
            {
                //Initialize();
                MY_DEBUG("Setfrequency error!\n");
            }
        }
Exemplo n.º 12
0
 void  MoveWait(uint channelIndex, int stepsize)
 {
     // close loop inside the controller, close loop for this function
     CCoarseController.SA_GotoPositionRelative_S((uint)mSystemIndex, (uint)channelIndex, stepsize, 1000);
     WaitForIdle(mSystemIndex);
 }
Exemplo n.º 13
0
 void  Stop(uint axis)
 {
     CCoarseController.SA_Stop_S((uint)mSystemIndex, axis);
 }