430 likes | 636 Views
Motorized stages, Piezo stages. Presented by Sun-Uk Hwang 2009-03-30. Motorized Stage (MCAPI). www.thorlabs.com. Reference: Motion Control Application Programming Interface MCAPI Reference Manual Revision 3.4. Specifications. Sample Specimen Control. Sample specimen control:
E N D
Motorized stages, Piezo stages Presented by Sun-Uk Hwang 2009-03-30
Motorized Stage (MCAPI) www.thorlabs.com • Reference: Motion Control Application Programming Interface MCAPI Reference Manual Revision 3.4
Sample Specimen Control Sample specimen control: Focusing, translation 4.45um bead Focused by moving stage
Motorized Stage API PC mcapi.h mcapi32.lib API Motorized Stage PCI Interface
Motorized Stage Basic Function List • Functions • MCOpen() • MCGetConfiguration() • MCGetPositionEx() • MCMoveRelative() • MCIsAtTarget() • MCClose() MCOpen() MCGetConfiguration() MCMoveRelative() MCGetPositionEx() N MCIsAtTarget() Y MCClose()
Motorized Stage (APT) Motorized Actuators MT3/M-Z8 www.thorlabs.com • Reference: APT System Software Developer Support Motor control Programming
Motorized Stage Active X control PC mgmotorctrl1.h mgmotorctrl1.cpp Motorized Stage Active X control USB communication MT3/M-Z8
Controller for Motorized Stage • Ideal Controller for Z8 Series Actuators • Control via Overlay or Computer • Compact Footprint • The TDC001 is the DC Motor Controller of our T-Cube Family. This single channel controller features a control panel on top, which offers Move/Jog buttons to move the actuator's leadscrew in discrete steps and a Velocity Potentiometer to move the leadscrew at various velocities. The TDC001 can be connected to a computer using USB 2.0 and controlled via Thorlabs' APT software.
Motorized Stage Basic Function List StartCtrl() SetVelParams() SetJogStepSize() MoveJog() N Find Target? Y StopCtrl() • Functions • StartCtrl() • SetVelParams() • SetJogStepSize() • MoveJog() • StopCtrl()
Example code • Active X control using MFC application (Reference : VC++(2003) APT Tutorial) • Select the MFC Application item
Example code (cont’d) Insert the ActiveX Control in the dialog box
Example code (cont’d) Add variable m_Motor1 that will be used to access the Motor Control
Example code (cont’d) Set the serial number and call the StartCtrl() function
Example code (cont’d) • Motion control of the motorized stage (1) • Call the Move home of the motor at Button1
Example code (cont’d) • Motion control of the motorized stage (2) • Call the absolute move of the motor at Button1
NI DAQ, Nanopositioner • Reference: NATIONAL INSTRUMENT, “NI-DAQ 7, DAQmx C Reference Help ”, 2004 NATIONAL INSTRUMENT, “DAQ, 6534X User Manual”, 2001 nPoint, “C-300 Series Controller Manual”, Version 1.2, 2005
NI DAQ ? • NI DAQ (National Instrument Data Acquisition) : Collecting and measuring the same kinds of electrical signals with analog-to-digital and/or digital devices plugged into a PC, and possibly generating control signals with digital-to-analog and/or digital devices in the same PC. PC-BASED DATA ACQUISITION Figure referred to www.ni.com • Two libraries for NI DAQ • - Traditional NI DAQ, difficult to understand and implement • - NIDAQmx: new library, easy to understand and implement
PCI-6534 DAQ Device • 32 (5 V TTL/CMOS) digital input/output lines • 20MHz (80 Mbytes/s) maximum transfer rate 8, 16, or 32-bit transfers • Start and stop triggering, pattern and change detection • 32 MB onboard memory per data path (group) (NI 6534 only) • NI-DAQ driver simplifies configuration and measurements www.ni.com PCI - 6534 • Operating Systems • •Windows 2000/NT/XP/Me/9x • • Mac OS 9* • Recommended Software • • LabVIEW • • Measurement Studio for Visual • Other Compatible Software • • Visual Basic • • C/C++ • Driver Software (included) • • NI-DAQ
NI-DAQmx Key Concepts • Task: A task is a collection of one or more channels, timing, triggering, and other properties that apply to the task itself. Conceptually, a task represents a measurement or generation you want to perform. • Channel: Virtual channels are software entities that encapsulate the physical channel. Thephysical channel can be configured as data output channel or data input channel. • Timing, Triggering: The timing section explains clocks. The triggering section goes over the triggers such as a Start Trigger and a Reference Trigger, Analog Edge Trigger, Digital Edge Trigger. • Buffer: A buffer is a temporary storagein computer memory for acquired or to-be-generated samples.
Basic NI DAQmx Functions for PCI-6534 Device • Task Configuration/Control: DAQmxCreateTask (), DAQmxStartTask(), DAQmxStopTask(), DAQmxClearTask, DAQmxIsTaskDone (), etc. • Channel Creation: DAQmxCreateDOChan(), DAQmxCreateDIChan() • Timing: DAQmxCfgSampClkTiming() • Write: DAQmxWriteDigitalU8(), DAQmxWriteDigitalU16(),DAQmxWriteDigitalU32() • Read: DAQmxReadDigitalU8(), DAQmxReadDigitalU16(), DAQmxReadDigitalU32()
DAQ Flowcharts Finite Sample Writing to DAQ device Finite Sample reading from DAQ device DAQmxCreateTask DAQmxCreateTask DAQmxCreateDOChan DAQmxCreateDIChan DAQmxCfgSampClkTiming DAQmxCfgSampClkTiming DAQmxWriteDigitalU16 DAQmxStartTask DAQmxStartTask DAQmxReadDigitalU16 DAQmxStopTask DAQmxStopTask DAQmxClearTask DAQmxClearTask
Example code (data output) Include “nidaqmx.lib” in the project setting
Example code (data input) Include “nidaqmx.lib” in the project setting
Nanopositioner Control by NI-DAQ www.nPoint.com,
Data Flow for Nanopositioner Control PCI-6534 Digital controller 3D laser focal point control
Timing diagram of digital controller PCI-6534 card has 2 external clock ports and 2 trigger portsfor synchronization of data transfer with external devices. According to the timing diagram of the external device, clock and trigger signals of PCI card should be set well using DAQmxCfgSampClkTiming() and DAQmxCfgDigEdgeStartTrig() functionsfor proper operation of external devices. Output: Data is outputted on falling edge of REQ1 and rising edge of STARTTRIG1 from PCI card to the nPoint interface Input: Data is inputted on falling edge of REQ2 and rising edge of STARTTRIG2 from the nPoint interface to PCI card Output Input Timing diagram of nPoint digital controller
Time Delay of DAQ Device It takes long time to update new control data to DAQ device if a number of sample points are used. 41667 points/sec 2083 points/sec In real time applications where the control data changes with time by user input, this makes undesirable (discontinuous) motion.
Detailed Analysis of NI-DAQ Time Delay • CPU-RAM-PROGRAM-OS (1): Elapsed time to generate control data in RAM • RAM-TO-PCI-BOARD (2): Elapsed time to transfer control data to PCI board • PCI-BOARD-TO-AMP (3): Elapsed time to transfer control data from PCI board to the controller • AMP-PCI BOARD-RAM (4): Elapsed time to retrieve feedback data • The sample points are sent in 24us interval. • Elapsed times are increasing with increased number of points. • Elapsed time (3) is not a delay. This is the time nanopositioner move. • Total time delay = (1)+(2)+(4) • Elapsed time (4) is very small • Elapsed times (2),(1) is critical parameters in total time delay.
Number of sample points with minimum time delay minimum time delay • 1~4 sample points give minimum time delay. • Therefore, control data composed of a number of sample points can be transferredby4 samples at a time to minimize time delay in real time applications. (0.6ms/4 points 6666 points/sec)
Example code Include “nidaqmx.lib” in the project setting
Control data is being transferredby4 samples at a time Save input data in the feedback data memory
Clock and trigger signal setting for data output Clock and trigger signal setting for data input
MCL piezo stage Basic Function List MCL_InitHandle() • Functions • MCL_InitHandle() • MCL_GetProductInfo() • MCL_GetCalibration() • MCL_SingleWriteN() • MCL_SingleReadN() • MCL_ReleaseHandle() MCL_GetProductInfo() MCL_GetCalibration() MCL_SingleWriteN () MCL_SingleReadN() N Satisfied? Y MCL_ReleaseHandle()
Example code (Connect/disconnect) Include “MADLib.lib” in th project setting bool MCLControl::Connect() { unsigned long axis; /* Prior to calling any other device function MCL_InitHandle() should be called */ handle = MCL_InitHandle(); if(handle == 0) { //Cannot get a handle to the device\n"; return false; } /* Fills a structure with information about the NanoDrive */ MCL_GetProductInfo(&pi, handle); /*Loop 3 times. Check if X is valid. Check if Y is valid. Check if Z is valid. */ for(int i = 0; i < 3; i++) { /*Checks if an axis is valid*/ if((pi.axis_bitmap & (0x01 << i)) == 0) continue; /*Move a valid axis to 50% of its range of motion*/ axis = i+1; cal[i] = MCL_GetCalibration(axis, handle); } connectionFlag = true; return true; } void MCLControl::Disconnect(){ /* MCL_ReleaseHandle() should be called before the program exits */ MCL_ReleaseHandle(handle); }
Example code (write/read) Include “MADLib.lib” in th project setting void MCLControl::SetPos(int axis, double position){ //position values are should be in the range of 0 to 200 um if(connectionFlag == true){ if(axis > 0 && axis < 4){ if(position >= 0 && position <= cal[axis-1]){ MCL_SingleWriteN(position, axis, handle); pos[axis-1] = position; } } } } double MCLControl::GetPos(int axis){ return MCL_SingleReadN(axis, handle); }
Example code (function write) Include “MADLib.lib” in th project setting void CMCLRampWaveform::ramp_waveform_generator(int acquisition) { /*Simple example of synchronous waveform acquisition. -MCL_Setup_LoadWaveFormN loads the position control waveform to the axis -MCL_Setup_ReadWaveFormN sets some internal values in the NanoDrive -MCL_TriggerWaveformAcquisition triggers both waveforms simultaneously -MCL_Trigger_LoadWaveFormN */ … error = MCL_Setup_LoadWaveFormN(axis_index+1, datapoints, milliseconds, waveform, handle); if(error != MCL_SUCCESS) goto FAIL; … if( acquisition == true ) { error = MCL_Setup_ReadWaveFormN(axis_index+1, datapoints, milliseconds, handle); } …
if( acquisition != true ) error = MCL_Trigger_LoadWaveFormN(axis_index+1, handle); else error = MCL_TriggerWaveformAcquisition(axis_index+1, datapoints, waveform, handle); printf("Waveform Functionality Tested Successfully\n"); /*Print the waveform data points.*/ if( acquisition == true ) { FILE* file_ptr; file_ptr = fopen("babo.txt","w"); for(i = 0; i < datapoints; i++) fprintf(file_ptr, "%d:\t%f\t%f\t%f\n", i, waveform_command[i], waveform[i], waveform_command[i]-waveform[i]); fclose(file_ptr); } }