Jump to content

alphaone

Members
  • Posts

    39
  • Joined

  • Last visited

    Never

Posts posted by alphaone

  1. The error comes because you must create the semaphore before using it. Call with NEW on the first call. When wrapping refnums in a functional global, I usually test for a valid refnum before returning it. It automatically takes care of initialyzing on first call. You can then get rid of the NEW case.

    post-447-1140442331.png?width=400

    So, the semaphore is stored in global and refered by its name, right? i only hold its name and "new" the semaphore when i need it.

  2. Well if you don't want to wait and do want to poll try using the "VISA Bytes at Serial Port" function to see when there are enough bytes waiting to be input to attempt a read.

    You could also setup another asynchronous process (or loop or state) whose job it would be to hang on the read until a complete response were available and then make that response (possibly with a timestamp) available (queue, global, LV2 global, ...) to the rest of your code before going back to wait again.

    Yes, this asynchronous process is quite necessary. The seperation of the WRITE and READ can clear and simlify the instruments controlling i think. Thank you for the inspiration. :)

  3. Set the timeout to a higher value. So your VISA-read will wait a longer time.

    To set the timeout go in the palette to Instrument I/O -> VISA -> VISA Advanced. There select VISA Set Timeout.

    Didier

    yes, that was the way i tried, but i think some poll mechanism will be better~.

    i don't find the SCPI command for this yet. Could you have some advice?

  4. Hi guys, I use VSA to measure the Channel Power, the average number is setting to 100. I write the ":READ:CHP?" and then execute the "VISA READ", but at this time, the measuring is not finished.

    so, the ERROR "Time out" will appear.

    How can i judge the measuring is done? I don't want to use "delay" :) .

    Thanks

  5. What a strange example...

    On my computer, when I start this vi, it never stops and raises the cpu load to 100%. In the meantime I read the whole Info-LV-digest, and now while I write this post the vi is still running and my cpu tells 100% load. Most strange is although the cpu load is at 100%, I don't seem to have any limitation in speed for the other apps.

    ... I think I'll have to kill this LV-session... :throwpc:

    ...Update: after 25(!!!) Minutes I finally also got your error. :thumbdown:

    Maybe, this is a solution that use "Type Case" to transfered.

    Download File:post-2988-1134030669.vi

    Download File:post-2988-1134030858.vi

    Download File:post-2988-1134030911.vi

    post-2988-1134030925.jpg?width=400

  6. alphaone,

    I'm sorry, but in Labview, the way you have diagramed it, is the "Basic" equivalent of:

    i = 0

    j = 0

    for k = 1 to 100

    next k

    input l

    if l = 1 then m = j

    else m = i

    no matter how you cut it, you still get zero, but no matter what you do you have wasted 100 loops getting nowhere...

    ;)

    However, if you want to branch and conditionally decide if you want to go nowhere FAST or nowhere slow, the folowing diagram will get you nowhere at your desired pace.

    post-2931-1133504899.png?width=400

    post-2931-1133504923.png?width=400

    Download File:post-2931-1133504940.vi

    Regards,

    -Pete Liiva

    Liiva,

    Well, the for loop is just a example as "doing some time-cosuming job", i don't care the result. I mean that I don't hope the useless operation on the useless branch. It's better that the "select node" judges the condition first, then select one branch to operate,just like "Select Structure".

    Thanks:)

    BR.

  7. Hi, the following figure shows that difference, when I flatten a constant (32-bit Integer),the type string is same as the document detailed. but, I change it to Control, the type string is also changed! I don't understand the othen data. I can not find help with NI document. What is meaning of this data?

    Thanks.

    post-2988-1132805391.jpg?width=400

  8. Hi, the following figure shows that difference, when I flatten a constant (32-bit Integer),the type string is same as the document detailed. but, I change it to Control, the type string is also changed! I don't understand the othen data. I can not find help with NI document. What is meaning of this data?

    Thanks.

  9. If you don't know what the datatype is at design time then you have a significant challenge ahead of you. I've done exactly what you describe using variants for a flexible test system I built, however I used the OpenG variant tools. The OpenG variant tools are really cool! :thumbup: You can do everything you describe. They were created by the one and only jpdrolet . The best part... you don't have to write a single line of code. :P

    Oh,it's a good news! i have already been despaired.Can i download only the Variant Tools of Goop? My comany's network blocks me and i can not user Commander to do it.

    Thanks.

  10. Download OpenG Commander and install the lvdata package. This has tools for variant introspection and manipulation.

    Thanks,i have read it. I can use the "typedescriptor" to judge what data type the variant contains. but , how about cluster?? we can see the types contained in a cluster,but we can't create a cluster by the types,at least i can't. because the parameter "type" of "Variant to Data" need a real cluster not a typedescriptor.

    Yes, it's easily done looking the descriptors. Time ago, I prepared an evolutioned version of the OpenG method, so if the variant is an array or a cluster, it says what kind of contents has (so the answer is "array of I32" instead just "array", or "array of clusters of string, boolean, refnum", etc).

    I hope you'll find it useful. Keep in mind is just a VI I did for a particular purpose in a project, it's not really hard-validated. Just works for usual tasks.

    Saludos,

    Aitor

    Thanks,your vi is nice.i can analyse the types contained by a variant. But how to use the type descriptor to create real controls??

  11. Hi,

    I wrote a sub VI whose parameter is variant. and i must convert this parameter to normal by "Variant to Data" function. How can i know which type this variant will be?? As the following figure shows,the variant may contain totally different types ,how to set the "type" of "Variant to Data" function as what i need??

    post-2988-1129515281.jpg?width=400

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.