Ejemplo n.º 1
0
int CPI_E761_XYStage::Initialize() {
	if (initialized_)
		return DEVICE_OK;

	g_pXYStage = this;

	MMThreadGuard guard(g_PI_ThreadLock);

	if (g_DeviceId < 0) {
		// Connect the device
		int id = E7XX_ConnectPciBoard(1);
		if (id == -1)
			return id;
		g_DeviceId = id;
	}

	// Get axis names
	int ret = E7XX_qSAI(g_DeviceId, g_AxisNames, 63);
	if (!ret)
		return processErr();
	for (int i = 0; i < 2; i++) {
		axisName_[i] = g_AxisNames[currentAxis_[i] - 1];
	}
	xaxisName_[0] = axisName_[0];
	yaxisName_[0] = axisName_[1];

	// Switch to servo mode
	BOOL svoVals[] = { true, true };
	ret = E7XX_SVO(g_DeviceId, axisName_, svoVals);
	if (!ret)
		return processErr();

	// StepSize
	CPropertyAction* pAct = new CPropertyAction(this,
			&CPI_E761_XYStage::OnStepSizeUm);
	CreateProperty("StepSizeUm", "0.001", MM::Float, false, pAct);

	// Axis name
	pAct = new CPropertyAction(this, &CPI_E761_XYStage::OnAxisName);
	CreateProperty("Axis name", "12", MM::String, false, pAct);

	// Positions
	pAct = new CPropertyAction(this, &CPI_E761_XYStage::OnXPosition);
	CreateProperty(CPI_E761_XYStage::PropXPos, "0.0", MM::Float, false, pAct);
	pAct = new CPropertyAction(this, &CPI_E761_XYStage::OnYPosition);
	CreateProperty(CPI_E761_XYStage::PropYPos, "0.0", MM::Float, false, pAct);

	// Travel range
	pAct = new CPropertyAction(this, &CPI_E761_XYStage::OnTravelRange);
	CreateProperty("Travel range", "", MM::String, true, pAct);

	return DEVICE_OK;
}
Ejemplo n.º 2
0
void mexFunction(int nlhs, mxArray *plhs[],
                 int nrhs, const mxArray *prhs[])
{
	// usage
	if (nrhs != 1)
    {
		mexPrintf("\nUsage: nmssPSYAxisLowEnd(<controller_handle>), where <controller_handle> must be a valid controller handle.");
        return;
    }
    
	int iControllerHandle = mxGetScalar(prhs[0]);
	double dRet[1];

	try
	{
		// switch on servo
		int bServoState[1];
		bServoState[0] = true;
		if(!E7XX_SVO(iControllerHandle, "2", bServoState)) throw true;

		// high limit of the moving range
		double dRet[1];
		if (!E7XX_qTMN (iControllerHandle, "2", dRet)) throw true;
		
		double* pdRet;
		plhs[0] = mxCreateString(sOK);
		plhs[1] = mxCreateDoubleMatrix(1, 1, mxREAL);
		pdRet = mxGetPr(plhs[1]);
		*pdRet = dRet[0];
	}
	catch(bool bError) 
	{
		// something went wrong, oh my god!
		nmssPSError(iControllerHandle, nlhs, plhs);
	}

	return;
}
Ejemplo n.º 3
0
int CPI_E761_ZStage::Initialize() {
	LogMessage("Is initialized? (Zephyre)");
	if (initialized_)
		return DEVICE_OK;
	LogMessage("Start init (Zephyre)");

	g_pZStage = this;

	MMThreadGuard guard(g_PI_ThreadLock);

	if (g_DeviceId < 0 || !E7XX_IsConnected(g_DeviceId)) {
		// Connect the device
		int id = E7XX_ConnectPciBoard(1);
		if (id == -1)
			return id;
		g_DeviceId = id;
	}

	// Get axis names
	int ret = E7XX_qSAI(g_DeviceId, g_AxisNames, 63);
	if (!ret)
		return processErr();
	axisName_[0] = g_AxisNames[currentAxis_ - 1];

	// Switch to servo mode
	BOOL svoVal = true;
	ret = E7XX_SVO(g_DeviceId, axisName_, &svoVal);
	if (!ret)
		return processErr();

	// StepSize
	CPropertyAction* pAct = new CPropertyAction(this,
			&CPI_E761_ZStage::OnStepSizeUm);
	CreateProperty("StepSizeUm", "0.001", MM::Float, false, pAct);

	// Axis name
	pAct = new CPropertyAction(this, &CPI_E761_ZStage::OnAxisName);
	CreateProperty("Axis name", "3", MM::String, false, pAct);

	// Positions
	pAct = new CPropertyAction(this, &CPI_E761_ZStage::OnPosition);
	CreateProperty(MM::g_Keyword_Position, "0.0", MM::Float, false, pAct);
	//SetPropertyLimits(MM::g_Keyword_Position, 0, axisLimitUm_);

	// Axis index
	pAct = new CPropertyAction(this, &CPI_E761_ZStage::OnCurrentAxis);
	CreateProperty("Axis index", "3", MM::Integer, false, pAct);
	SetPropertyLimits("Axis index", 1, 3);

	// Axis Information
	pAct = new CPropertyAction(this, &CPI_E761_ZStage::OnAxisInfo);
	CreateProperty("Axis info", "", MM::String, true, pAct);

	// Lower limits
	pAct = new CPropertyAction(this, &CPI_E761_ZStage::OnSoftLowerLimit);
	CreateProperty("Soft lower limit", "0", MM::Float, false, pAct);

	// Higher limits
	pAct = new CPropertyAction(this, &CPI_E761_ZStage::OnSoftHigherLimit);
	CreateProperty("Soft higher limit", "0", MM::Float, false, pAct);

	// Travel range
	pAct = new CPropertyAction(this, &CPI_E761_ZStage::OnTravelHighEnd);
	CreateProperty("Travel range (high end)", "100", MM::Float, true, pAct);
	pAct = new CPropertyAction(this, &CPI_E761_ZStage::OnTravelLowEnd);
	CreateProperty("Travel range (low end)", "0", MM::Float, true, pAct);

	// Velocity control
	pAct = new CPropertyAction(this, &CPI_E761_ZStage::OnVelControl);
	CreateProperty("Velocity control", "", MM::Float, false, pAct);

	// Firmware version
	pAct = new CPropertyAction(this, &CPI_E761_ZStage::OnVersion);
	CreateProperty("Firmware version", "", MM::String, true, pAct);

	ret = UpdateStatus();
	if (ret != DEVICE_OK)
		return ret;

	initialized_ = true;
	return DEVICE_OK;
}