Thorlabs rotation stage control using LabWindows

Hi there
I have been trying to program automated control of Thorlabs rotation stage PRM1Z8 based on TDC001 DC servo controller using Lab Windows Actives Controller Wizard.
The steps followed by me as follows:
1. Insert Activex control (thorlabs stage GUI) in the panel using .ocx file obtained with the stage. Edit the control properties to put in the controller serial number and then right click on the control to generate the activex control driver. 
The following code was written. Although I do not obtain any compiling error, I have not managed to communicate with the stage. 
#include "MG17Motor.h"
#include "AProt.h"
#include <cvirte.h>
#include <userint.h>
static HRESULT _tmp8;
static long _tmp9;
static HRESULT _tmp3;
static long _tmp4;
static int _tmp2;
static CAObjHandle _tmp1;
static int panelHandle;
int main (int argc, char *argv[])
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
if ((panelHandle = LoadPanel (0, "AProt.uir", PANEL)) < 0)
return -1;
DisplayPanel (panelHandle);
RunUserInterface ();
DiscardPanel (panelHandle);
return 0;
int CVICALLBACK imagepanel (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
switch(event)
case EVENT_COMMIT:
_tmp2 = GetObjHandleFromActiveXCtrl(panelHandle, 2, &_tmp1);
_tmp3 = MG17MotorLib__DMG17MotorStartCtrl (_tmp2, NULL, &_tmp4);
_tmp8 = MG17MotorLib__DMG17MotorIdentify (_tmp2, NULL, &_tmp9);
break;
return 0;
 Please could you help me sort out any programming error that I might have committed here. 
Thanks
Deepa

Hello Deepa,
I never used Thorlabs products, but as you can see in the online help for the command, GetObjHandleFromActiveXCtrl returns the obtained handle into the last parameter, in your case _tmp1; I suppose this is the variable you must pass to the following command(s) in the Thorlabs library. The return value _tmp2 is an error code which you should use to add some error checking to your code.
You should also check into Thorlabs documentation the exact meaning and usage of the command you are using: it is possible that the return values are error codes that may give you some guidance on how to clean up any error you may have in function calls.
Proud to use LW/CVI from 3.1 on.
My contributions to the Developer Zone Community
If I have helped you, why not giving me a kudos?

Similar Messages

  • How do I take a picture from usb camera using the Windows Image Acquisition Automation activex control in LabWindows?

    Hy!
    I have a faculty project in wich I
    have to acquire image from a webcam in Labwindows
    8.1 and to take a picture and save it in a file and to display it.I managed to acquire
    image from the webcam using the WIA automation activex controll but I
    haven't been able to take a picture and save it and display it .So i ask of you to
    post a tutorial or something that would help me to take a picture and save it and display it using the WIA automation activex controll in
    LabWindows.
    OS: Windows XP Professional X86
    Please help me!!

    Unfortunetly I do not have any experience with Activex.This is one of the codes I tried so far:#include "wiaaut.h"
    #include <cvirte.h>        
    #include <userint.h>
    #include "camm.h"
    static int panelHandle;
       int cid,eroare;
       CAObjHandle objh;
       WIAObj_IImageFile result;
       ERRORINFO eror;
    int main (int argc, char *argv[])
        if (InitCVIRTE (0, argv, 0) == 0)
            return -1;    /* out of memory */
        if ((panelHandle = LoadPanel (0, "camm.uir", PANEL)) < 0)
            return -1;
        DisplayPanel (panelHandle);
        RunUserInterface ();
        DiscardPanel (panelHandle);
        return 0;
    int CVICALLBACK OkCallback (int panel, int control, int event,
            void *callbackData, int eventData1, int eventData2)
        switch (event)
            case EVENT_COMMIT:
               WIA_NewIVideoPreview(panelHandle,"Video",45,45,&cid,&eroare);
               GetObjHandleFromActiveXCtrl(panelHandle,cid,&objh) ;
                break;
        return 0;
    int CVICALLBACK QuitCallback (int panel, int control, int event,
            void *callbackData, int eventData1, int eventData2)
        switch (event)
            case EVENT_COMMIT:
                QuitUserInterface (0);
                break;
        return 0;
    int CVICALLBACK pozaCallback (int panel, int control, int event,
            void *callbackData, int eventData1, int eventData2)
        switch (event)
            case EVENT_COMMIT:
               WIA_NewICommonDialog(panelHandle,"poza",45,400,&cid,&eroare);
               WIA_ICommonDialogShowAcquireImage(objh,&eror,2,1,131072,"{B96B3CAB-0728-11D3-9D7B-0000F81EF32E}",VTRUE,VTRUE,VTRUE,&result);
                break;
        return 0;

  • Labview examples for Newport rotation stage Model URS50BBC

    Hi there,
    I am currently wanting to control the motion of the motorised mount using Labview, but I dont have examples, Can you ,possibly, help me please?
    The mount Model is: Newport rotation stage Model URS50BBC.
    Thank you ,
    Maab

    Hi CasiL,
    Thank you for this.
    I doenloaded them, and it is Ok now, however , the example need COM adress ,when I put 1 , it says : failed in connection and somthing about VISA identification..
    I dont know how can I found VISA or code library,I will attach the error box.
    Thank you very much,
    Maab
    Attachments:
    error labview capture.JPG ‏256 KB

  • How to create customized controls in LabWindows CVI

    Hello,
    I would like to create more "user friendly" controls  in LabWindows. For example I would like to use a "Round command button" and add a picture on it.
    Do you know if there is a way to do it?

    It should be possible: In the classic-style controls, there is a round command button; you can set the button color to transparent and place it on top of a suitable picture...

  • Rotate Stage tool

    I'm wondering if there is a Rotate Stage tool in Flash like Photoshop's Rotate View tool? Some angles are difficult to draw and I could really get some use out of it. If there is a plugin, can someone post a link to it please. Thank you!

    Great point!
    I hope adobe guys could hear that. Unfortunately it had been almost 6 years since u had written that post and no sign of any stage rotation for flash. Flash is a great tool for an animator whereas adobe is not taking this into consideration

  • What is the maximum number of row for a table control in LabWindows/CVI ?

    I use LabWindows CVI 8.5.1 (MMI first developped in version 6.0).
    In one of our many MMI, a table control contains a list of aircraft parameters.
    We can add as many parameters (row) as we want but over 40 000 we observe a crash of the LabWindows CVI runtime.
    Our client want to inscrease the number of parameters (row) up to 200 000 !!!
    So my questions are:
    What is the real maximum number of row for the table control ?
    Is this maximum number of row different on LabWindows 2010 version ?
    Or is there an other solution ?
    Thanks

    Greetings,
    Can you clarify what you mean by "crash"? Is there an error message thrown? Is it possible that you've consumed all of the available memory?
    Please let me know.
    Thanks, James Duvall
    Product Support Engineer
    National Instruments

  • Ipad2 does not change orientation. I have not used the switch for lock rotation it is used for mute

    Ipad2 does not change orientation. I have not used the switch for lock rotation it is used for mute

    Is there a lock symbol at the top of the screen next to the battery indicator ? If so, and as you've got the switch set to notification mute, then have you checked the taskbar (the function that the switch isn't set to is controlled via the taskbar instead) : double-click the home button, slide the taskbar to the right, and it's the icon far left.
    If you havn't got the lock symbol at the top then try a reset : press and hold both the sleep and home buttons for about 10 to 15 seconds (ignore the red slider), after which the Apple logo should appear - you won't lose any content, it's the iPad equivalent of a reboot.

  • SMC100pp rotation stage

    Hello,
    I am trying to program a Newport SMC100PP controller to run a Newport TRA6PPD linear actuator to move a Newport 481 rotation stage.
    My goal with this program is to have the stage move at a slow velocity form designated point 1 to point 2 while reading out the absolute position.
    The program that i have written is having a problem. Every time i try and run the program i get an "Error on reset - Timeout" error and the light on the front panel of the SMC100pp controller reads solid green as if the system is ready to go.
    In the code below i have the top part which simply reads the motor position and time and saves that to a txt file. The top part is necessary because it is a reduced set of code for the rest of an instrument i want to incorporate this rotation stage into. The bottom code is my program where i am trying to 1st initialize the step motor, 2nd enter/modify controller velocity on command part way through a larger experiment once i see some preliminary data and 3rd execute the programed controller movement on command as the last part of a larger experiment to finish the experiment.
    Included below is my labview error message, picture of the program and the program vi.
    Attachments:
    error.PNG ‏36 KB
    SMC100 test code.vi ‏70 KB
    Vi program.PNG ‏178 KB

    Hello Shike,
    As you are using a library or VIs that are provdided or created by the Newport company it seems, you need to contact them and verify the conditions needed for Reset to be executed correctly.
    RIght now you are getting a timeout that may refer to a VI not given the sufficient time to execute or a similar condition.
    Please contact Newport support about this controller and the VI's.
    Regards,
    David M.
    National Instruments 

  • Using iPad 2 - if i use the slide switch to lock rotation, i cannot unlock rotation, unless i use it to mute sounds.  i can't therefore have unmuted sounds and unlocked rotation at the same time??

    using iPad 2 - if i use the slide switch to lock rotation, i cannot unlock rotation, unless i use it to mute sounds.  i can't therefore have unmuted sounds and unlocked rotation at the same time??

    Uh .... Yes you can. You just have to understand how the whole thing works.
    System sounds can be muted and controlled two different ways. The screen lock rotation can be controlled in the same manner as well.
    Settings>General>Use Side Switch to: Mute System sounds. If this option is selected, the switch on the side of the iPad above the volume rocker will mute system sounds.
    If you choose Lock Screen Rotation, then the switch locks the screen. If the screen is locked, you will see a lock icon in the upper right corner next to the battery indicator gauge.
    If you have the side switch set to lock screen rotation then the system sound control is in the task bar. Double tap the home button and in the task bar at the bottom, swipe all the way to the right. The speaker icon is all the way to the left. Tap on it and system sounds will return.
    If you have the side switch set to mute system sounds, then the screen lock rotation can be accessed via the task bar in the same manner as described above.
    This support article from Apple explains how the side switch works.
    http://support.apple.com/kb/HT4085

  • Retrieving values from table control using DYNP_VALUES_READ

    Hi all,
    I am trying to retrieve the values from the table control using the FM DYNP_VALUES_READ. I have a situation where user enter values in table control in T.code FB60 in Withholding tab for validation purpose. There i'll have to check based on some entries maintained in SET.
    I am unable to get the values when i scroll to the next page in the table control. FM raising an exception invalid_dynprofield.
    Expecting reply...

    You have to populate the dynpfields internal table before calling the function,
    data: repid like sy-repid.
    dynpfields-fieldname = 'PNAME'.
    append dynpfields.
    repid = sy-repid.
    call function 'DYNP_VALUES_READ'
    exporting
    dyname = repid
    dynumb = sy-dynnr
    tables
    dynpfields = dynpfields
    exceptions
    others.
    read table dynpfields index 1.
    pname = dynpfields-fieldvalue.
    Now you will have the field value in pname
    Hope this helps
    Vinodh Balakrishnan

  • How to measure the rotational speed by using rotary encoder and 1 counter?

    I want to measure the rotational speed of a shaft, and I have below hardware:
    1, a rotary encoder, with A,B,Z signals output;
    2, PCI-E6363 card.
    I do konw how to use such a  encoder to measure the rotational angle by using the function "DAQmxCreateCIAngEncoderChan", but this time I need to measure the speed(rpm), as well as the dirction of the speed, which means a negative speed represent a CCW rotate direction.
    More detail informations:
    for the encoder, the A,B signal is 600ppr, and Z signal is 1ppr
    the rotatinal speed is in range: -300 ~ 5000 rpm.
    some one suggested me that I can use the "DAQmxCreateCIAngEncoderChan" task to measure the angle firstly and then do the differential analysis with the angle. but I have to enable the Z index function, and it's hard to calculate when the shaft speed is fast then 2500rpm.
    Anyone can help me on this issue?
    Thanks in advance!

    RobertoBozzolo:
    Thansk for your reply. You are right that measure frequency to get the speed is the best way, but it's hard to get the dirction at the same time. You suggest me that "perform two angle measurements to get the sense of rotation", but I'm not sure I catched what you mean about this. I try to understand your opinion like this: distribute the signals to 2 counters, and start 2 tasks, one for frequency, the other for angle which used for deciding the dirction?
    And by the way, in my application, the counter is limited:
    I'm using PCI-E6363, which have 4 counters totally, and I have to measure 4 different speed sensors at the same time, so that means only 1 counter for me to measure the speed and the dirction.
    RobertoBozzolo 已写:
    To measure the speed from the encoder you can simply follow some of the frequency measurement examples that ship with DAQmx, considering that speed (rpm) is given by frequency (Hz) on one encoder output / 600 (ppr) * 60 (s->min)  = frequency / 10.
    Difficult is to add a sign to this measurement: frequency measurement gives you no information about sense of rotation, so I suppose you could perform two angle measurements to get the sense of rotation and then get the speed as above.

  • How do I send e-mail to a distribution list using LabWindows/CVI?

    I need to be able to send e-mail to a user-defined distribution list using LabWindows/CVI? Has anyone done this? Any ideas where I could look?

    I commented on something similar to this awhile back.  My issue was that I had the base version and didn't have the Internet classes.  So this external app worked like a charm
    It has a lot of command-line inputer options to use as well.
    http://forums.ni.com/t5/LabWindows-CVI/Need-Help-for-Sending-Email-with-LabWindows-8-5-or-9/m-p/1095...

  • How to implement line selectability for a table control using table Wizard?

    Hello SDN Community,
    I have created a table control using the Table Wizard.  I found my exact question in this forum, but unfortunately it had not been andsered.  While I cannot paste a screen-print into this plane-text area, here are the steps I followed...
    1) SE51
    2) Create new screen 0100
    3) Click Layout button
    4) Clidk Table Control (with Wizard) and draw box on canvas.
    5) Step is "Start" - click Continue
    6) Step is "Name of Table Control" - provided name
    7) Step is "Table Name" - provided name of dictionary table (AUFK)
    8) Step is "Definition of Columns" - selected order numver and order text
    9) Step is "Table Control Attributes" - Line Selectability is in display mode - cannot set it.
    I would like to have a selectability column for my table.  Would appreciate any insight into how to do this.
    Thank you,
    Dean Atteberry.

    This is a puzzling...
    For the table control wizard, in the Table Control Attributes step, I was able to get line selectability to open up by declaring a char01 data element at the beginning of my type.
    The puzzling is in regards to the "Selection col. fld" entry field.
    If I leave it blank and try to go to the next step, I get message "Enter the name of the selection column if you are using a program table"
    So it looked like it wanted to know the name of my selection column.  So I type in "CHAR1".  and got the message "The field "CHAR1" for the selection column is already contained in the table."
    Hmmmmm.... don't understand............
    Dean Atteberry.

  • How can I reference a winforms control using a variable in Powershell?

    I have a powershell winform that has a lot of text boxes, but for the sake of this post, lets say I have 5. I want to loop through the 5 text boxes to see if their text property is empty. If the textbox contains something, I want to add the text value to
    an array. Here's an example of what I'm trying to do.
    textbox1.text = "Red"
    textbox2.text = ""
    textbox3.text = "Blue"
    textbox4.text = ""
    textbox5.text = ""
    $MyArray = @()
    for ($i = 1; $i -le 5; $i++) {
    If ($textbox[$i].text -ne "") {
    $MyArray += $textbox[$i].text
    I realize the textbox object is not an array so this code will not work. I guess the simple question is, How can I reference a set of static controls using a variable without having to do something like this
    [object[]]$textboxes = New-Object System.Windows.Forms.TextBox
    For ($i = 1; $i -lt 5; $i++) {
    $textboxes += New-Object windows.forms.textbox
    $textboxes[$i].DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
    $textboxes[$i].Name = $textboxes[$i]
    $BoxItems.Controls.Add($textboxes[$i])

    Hi D-Dub,
    here are two ways to retrieve the text value of $Textbox1:
    $Textbox1.Text
    (Get-Variable "Textbox1").Value.Text
    Now what could you do with the second way, inside a loop, I wonder ... ;)
    Cheers,
    Fred
    There's no place like 127.0.0.1

  • How to create and use Webservice controls using WSDL in weblogic portal10.3

    Hi All,
    I have WSDL , How to create webservice controls using the WSDL in weblogic portal 10.3 and use those controls to invoke those webservice methods?
    please give me the documents links for this.
    Thanks
    Venkata Sarvabatla

    As far as I remember, Controls can be called only from Pageflows, BackingFiles, Another Control (Like control calling another control) etc. In pageflow we use annotation @Control and give control classname and a varialbe for that. I am pretty sure this annotation may not work from normal java class and in your case a JAVA JSR Class.
    If you installed the samples, refer the samples from WLS: C:\beawlp103\wlserver_10.3\samples\server\examples\src\examples\webservices. They have lot of fully ready to work samples with instructions. I used clientgen ant task. But you can use standard SUN JDK Command "wsimport" also to generate the java files from the WSDL. Open any command prompt. If java is in classpath, just run wsimport and that should give an idea.
    Goud

Maybe you are looking for

  • Lightroom 4.4 - Crash When Exporting

    Hello, I have been experiencing frequent crashing when using my Lightroom 4.4 on my iMac OS. At first it was just crashing when I was editing here and there - but then over the span of 1 hour it crashed up to 6 times. When I finished editing my portf

  • Auto clicker script constantly running cant close it help!!

    i tried to get auto clicker for my mac, to play minecraft and i set it on the script to click 10 times a second. now it wont let me click on the mouse or use the keyboard. i have tried turning it off and back on a few times and still nothing all i wa

  • Problem with Rebate agreement

    We have a problem with Rebate agreement settlement. Generally when the finall settlement of Rebate is completed ( with status D - D means final settlement ), the liability should be zero. However, after we made final settlement, still some amount is

  • 256 Colors on new 24 inch iMac

    Is it possible to get the ATI Radeon HD 2600 PRO in my new 24 inch intel iMac to be able to show 256 colors?

  • 10gR2 Incremental aggregation performance

    Hi, I've seen the Oracle presentation about 10gR2 where it shows that incremental data loads perform remarkably faster than they did in 10gR1, etc. However, I have not been able to repeat this performance on a small test cube. Could someone from Orac