Visa buffer read in event case

Hello everybody.
I'm realizing a VI to control 3 motorized stages by RS232 Standa driver. I'm able to control the 3 stepper motors and i can correctly send the commands to the driver. I've problems when i attempt reading Visa buffer answers from my driver.
I attach two image from my work. In 1.jpg there's the case structure, opened on one of SUBVi; in 2.jpg there is a SUBVi example codex.  
I'd like help to read VISA and show the red string on front panel.
Thank you very much for the answers
Attachments:
1.jpg ‏131 KB
2.jpg ‏52 KB

I agree with zenthoef,
the trick is to have a shift register that contains the entire strings that are read with each iteration of the loop.  That means placing a Concatenate String after the VISA read.  The output goes to the shift register.  You can wire at the same output a Match Pattern (or equivalent) and check that the Offset Past Match is greater or equal to zero.
Minor comment:  your command constant...  you don't need to concatenate the carriage return.  You can simply add it to the top string.  You can view string as '\' code display.

Similar Messages

  • Error by AI Buffer Read.vi

    Hello!
    I have problem with the PCI-Card(Modell CB-68LP) PCI-MIO-16XE-50 .
    I think the settings for the card are right, because it can get the
    datas by the AI Sample Channels.vi with AI Read one Scan.vi. But I need
    at least 1000 times
    to measure in one second, so I use the Data Reader.vi to do it. For
    test I set:
    buffer size:2000
    # of Scans to Write at a time :5000
    Max # of cans to write to file:4000
    scan rate: 2000
    and the Channels are same as they by AI Samle Channels.
    I could not get any datas but the date and actuell time, so I checked
    the
    sub-VIs and found the error is " AI Buffer Read" and the code is 10800.
    By this sub-VI it showed the same error too even when I input 1 to the
    control number to read.
    I don't understand it and
    I can not see any more
    details by the sub-VI either. I have tried what I know, but there is
    still the same
    problem, could someone give me some help? And where can I find some
    LabView
    samples for the PCI Card?
    Thanks a lot!
    Le

    Le Wang;
    The better approach for you is to open one of the Labview examples named "Continuous Acquisition and Chart Buffered.vi" to see if your board is doing buffered operation properly.
    You can find that example at: Search Examples->I/O Interfaces->Data Acquisition->Analog Input->Continuous Analog Input.
    If you are interested in reading one channel only, just set the Scan Rate to 1000 Scans/sec; in case you have more than one channel, your Scan Rate must be 1000 x Number of channels.
    That should take care of you.
    Hope this helps.
    Filipe

  • Destructive and non-destructive buffer reads on branch wires

    I was asked this morning what are "Destructive and non-destructive buffer reads on branched wires" are.
    I was at a loss at first and the I thought some and read a posting by Jim that inspried me.
    My first thought was the case of an array wired to a replace array element and an index array function. I that case the the index has to execute before the replace array element because the replace re-uses its input buffer. Not really detructive but seemed close.
    There is also the case of a buffer (like a string) being wired into a CIN and the same buffer being re-used be the CIN to return the result. The CIN "destroys" the original values.
    Jim mentioned the concatenate string having to destroy the buffer
    s hold the strings that are concantenated and moved to another buffer.
    Also when I do a AI read the buffer I read from is destroyed after I read it. Similarly with reading from VISA and the like.
    What does the above phrase really mean and are there other examples that I have missed?
    Trying to learn something here,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

    That phrase may have been describing a combination of factors. Documentation from NI points out that if a wire branches, LabVIEW will try to avoid making a copy of the data, including scheduling (as in your example) read operations on branch A before write operations on branch B if possible. Since branch A doesn't tamper with the data, no copy is necessary.
    The author of a CIN or DLL could indeed choose to create his function in such a manner that it uses the same physical buffer in memory for input and output. This is by no means the only way to return values from a function, but it's quite common for efficiency reasons. LabVIEW might even assume that a CIN or DLL always overwrites any buffer passed into it (and may therefore make a copy if a wire branche
    s both to a CIN and somewhere else).
    So to me, the phrase you cited connotes the G compiler's decision of whether or not a wire branch modifies the data (e.g., string concatenation, removing elements from arrays) or just reads it (e.g., an index or input to a calculation).

  • Event case

    Can we link an event case in one VI to a control on another VI or to a global variable in the same project?
    I have a top level VI which has quit and abort buttons in it.  Rather than copy these buttons to all the other, popup VIs it would be much neater if the popup VIs could respond to events on the top level front panel. However, in LV 2010 this doesn't seem to be possible using event cases, so I re-wrote it using select case in while loops.  This is what we used to do in the 'old days'  of LV 6 but not as neat.
    Solved!
    Go to Solution.

    Thanks Dan_u,
        I read up on registering events with interest,  and will try it out in future.  It does, however, seem to me to be a slightly '
    busy' way of doing it.  Howcome we can't just select a control on another VI from within the normal event case menu?  So long as the VI is in the same project this seems reasonable to me.  Likewise having an event for change of value on global variables.    Regards, Barnsey

  • Can I have multiple event structures with the same event cases?

    Hello, 
    I'm doing an application that reproduces the front panel of the HP6675A power supply. To achieve this, I have done a state machine with different states
    (initialize, measures, voltage, current, ocp, ov, store, recall, etc). In each state, should have an event structure that catches the events of the buttons, like for example: if the current state is the Voltage mode and the user press the current button the next state will be the Current mode. For this in each state of the state machine should be the same event structure with the same events.
    My problem is that the Vi doesn't work properly when I have multiple event structures with the same event cases. There are some possibily to do this, and how? Or is impossible to have multiple events? I have been reading some posts, but I don't find solutions. 
    Any help is appreciated.
    Thank you very much.
    Solved!
    Go to Solution.

    natasftw wrote:
    Or as others mentioned, make two parallel loops.  In one loop, have your state machine.  In the other, have just the Event Handler.  Pass the events from the handler to the state machine by way of queues.
    A proper state machine will not need the second loop.  The "Wait For Event" or "Idle" state (whatever you want to call it) is all you really need in order to catch the user button presses.  The setup is almost there.  Maybe add a shift register to keep track of which state to go to in the case of a timeout on the Event Structure.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • How to use only one event case at a time??

    Using LabVIEW, using the event structure is it possible to have only one event case execute at a time. For example, having event case controlled by keyboard, and the other event case controlled by mouse (clicking buttons) and only one being able to execute, not simultaneously. I was considering using a switch of some sort, but each case does not have a "stop if true/false" so I am open to a new method or work around. I attached code. I do not want output to be able to be sent from the keyboard case and mouse case at the same time.
    Thanks,
    Andrew
    Attachments:
    WiFi Motor Control & Cam Stripped.vi ‏29 KB

    Ah, OK. all you need is to keep state in a shift register that ensures that all "key down/mouse down" events are discarded after each key down/mounse down event until a key up or mouse up (resp.) has occured.
    Overall, you code is still way to complicated for this simple task. For example, you could eliminate all these "select" primitives and place the approriate diagram constant inside the respective case. On the other hand it is too simplistic, because you would think that certain key combinations should be allowed concurrently (e.g. up and left).
    What does the receiver actually do with the codes? Do you have any documentation for this device?
    LabVIEW Champion . Do more with less code and in less time .

  • How can I reduce the number of event cases in the main VI?

    I would like to reduce the number of event case of the event structure in my main VI. E.g. I would like to have pop up window with a table when the user double click a table row. Nothing more simple than this: add a case to the event structure trigger by double clicking the table, read the table row ... But in my main VI I would have lots of them and the event structure gets crowded with minor tasks. One solution is using XControls. But is there any other recomended way to handle selected events separatly from the event structure in the main VI?
    to clarify: I don't want to distribute the whole event structure. (In this case the code would not be maintainable) But I would like to handle certain context specific events in a differnt place. If I have them all in the main VI the drop down list of the events in the event structure exceeds the windows size and the program becomes difficult to maintain because one looses the overview.

    "Strictly forbidden" is not true. But highly not recommended. The reason is simple:
    1. Code can react unpredictable. Dennis already stated some things about that in your linked thread. 
    2. Code is not readable and therefore not maintainable. Each event source should have only one event structure for its events. Since the UI is a single source, events from there should be captured in a single event structure. It is recommended to use this event structure as producer in a producer/consumer design pattern in order not to block the events.
    3. You will most propably need timeouts in your event structure which completly negates the advantage of event driven programming. Either use event driven programming or stay at polling. Do not mix (most of all because of maintenance).
    Regarding your "advantages" you listed:
    - Clustering  reduces readability in therefore should never be done. Additionally, it requires timeout cases in most places which is not recommended.
    - If you have such many events and interactions in your "sequence", it is a clear indication that you chose the wrong architecture for your application.
    Please see attached example. Since i am not used to program with more than one event structure (except if i have different dedicated event sources), the example is "constructed" and therefore may lack of "realism". Nevertheless, it shows some issues which might occur:
    - Blocking calls within the events lead to the fact that the UI is not responsive for the event time (FuncA). Nevertheless, interaction is still enqueued and if the blocking call is over, all those interaction are executed. In the example, please press FuncA and then press FuncC immediatly. You will see that nothing happens and after the 5s blocking call, the FuncC dialog appears. You also can switch tabs, but the visual display will update only after the 5s blocking call.
    - In order to keep the UI responsive, FuncB is configured not to block the UI. But this is no solution: Press FuncB (on page 2) and the change to page 1 and press FuncA. Additionally, press FuncC. What happens? Just to mess things up, press Stop as well......do this combination several times. It is possible that only the lower loop is finished and the VI is still running even if Stop has been pressed.
    Please note everyone that the attached example shoudl strictly be seen as "NEVER DO IT LIKE THIS". This is a negative example and shows the approach which is not recommended by any means!
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.
    Attachments:
    Never EVER86.vi ‏10 KB

  • User Event Case getting tied up for long duration in LV 2009 (with SP1)?

    Quick question here...is there any decent reason the user event case is getting tied up for long durations in LV 2009.SP1?  In 8.5 I never had an issue with my code doing this, though when converting to 2009.SP1 I am running into huge lock-up issues with the user event case.

    I have not seen aby issues...
    You are saying that the code from LV8.5 (unmodified) behaves differently in LV2009 SP1?
    Can you post your code?

  • Creating an Event Case on a Right-Click

    Hello All,
    Is it possible to set up an event case to occur on a right-click down when the cursor is over an image?  If so, please post details.
    Thanks!

    Yes, I think the event case for Mouse Down has a property (I think it is actually called the data node, but it is the drop down that appears on the left side of the event case) called Button which tells you which button was pressed.  Also, you can get the mouse coordinates from the event case data node and calculate whether or not the mouse was within the picture frame.  Hope this helps.  I don't have Labview, right now, so I can't create an example.

  • Multiple event cases ?

    I hear people saying do not use multiple event cases.
    is this in reference to multiple event cases in the same loop?
    is it ok to use 1 event structure per parallel loop?
    what happens if you have two parallel loops reacting to the same event?
    - James
    Using LV 2012 on Windows 7 64 bit

    James R wrote:
    I hear people saying do not use multiple event cases.
    Who are these people??! There is nothing wrong with an event structure containing multiple event cases.
    James R wrote:
    is this in reference to multiple event cases in the same loop?
    Yes, you should only have one event structure per loop, but that event structure can have multiple cases.
    James R wrote:
    is it ok to use 1 event structure per parallel loop?
    Yes. What makes you think otherwise?
    James R wrote:
    what happens if you have two parallel loops reacting to the same event?
    Nothing unusual. They will both fire whenever that associated event occurs. No problem!
    LabVIEW Champion . Do more with less code and in less time .

  • Reading ActiveX Event Messages

    Hi
    I have been reading activeX event messages for sometime now
    using a combination of EventLastMatch and GetSpriteProperty.
    Within a text entry activex which I have recently imported
    into Authorware it contains within the Events Tab the following
    parameter:
    KeyDown returns nothing
    Parameter 1: KeyCode is an integer
    Parameter 2: Shift is an integer
    Silly question but if 'KeyDown' returns nothing then why is
    the Parameter 1 and 2 stated ? Does this KeyDown event actually
    return values.
    I have tried reading the KeyDown event using
    MessageValue:=CallSprite(@"ActiveX Text Entry",#KeyDown)
    and
    MessageValue:=EventLastMatched@"ActiveX Text Entry"[#KeyDown]
    But with no success. Anyone have any other methods I could
    try ?
    Thanks

    I think the AX that's been discussed is the web browser
    control...
    "Mike Baker **Adobe Community Expert**"
    <[email protected]> wrote in
    message news:[email protected]...
    >I ran a quick test with the MS Forms 2.0 text box control
    and tab events
    >are
    > getting through to the control - I can see the tab in
    the control. They
    > are
    > not returned as key events though so they're not
    completely making the
    > round
    > trip. I do get a #change event though. Not very useful
    in this case.
    > Mike - What about a Win Control?
    >
    > Mike
    > ====================
    > Mike Baker
    > Adobe Community Expert
    > [email protected]
    >
    > "Amy Blankenship *AdobeCommunityExpert*"
    > <[email protected]>
    > wrote in message
    news:[email protected]...
    >> I'm fairly sure tab events don't get passed either.
    There have been
    > several
    >> conversations about that on the Aware list.
    >>
    >> "Mike Baker **Adobe Community Expert**"
    <[email protected]> wrote in
    >> message news:[email protected]...
    >> > Hi Mike,
    >> >
    >> > Catch an event from an ActiveX with an Event
    response attached to an
    >> > interaction. EventLastMatched@"icon" refers to
    the response and not to
    > the
    >> > activex control. Unfortunately not all actions
    in Authorware wind up
    > being
    >> > events in the ActiveX. If I remember right,
    ShiftDown is a key modifier
    >> > that
    >> > doesn't even get passed to the ActiveX control
    so no event can be
    >> > returned.
    >> > Authorware waits for the actual key and it
    passes the key and the
    > modifier
    >> > to the control together.
    >> >
    >> > Mike
    >> > ====================
    >> > Mike Baker
    >> > Adobe Community Expert
    >> > [email protected]
    >> >
    >> >
    >> > "Mike P" <[email protected]>
    wrote in message
    >> > news:[email protected]...
    >> >> Hi
    >> >>
    >> >> I have been reading activeX event messages
    for sometime now using a
    >> >> combination of EventLastMatch and
    GetSpriteProperty.
    >> >>
    >> >> Within a text entry activex which I have
    recently imported into
    >> > Authorware it
    >> >> contains within the Events Tab the
    following parameter:
    >> >>
    >> >> KeyDown returns nothing
    >> >> Parameter 1: KeyCode is an integer
    >> >> Parameter 2: Shift is an integer
    >> >>
    >> >> Silly question but if 'KeyDown' returns
    nothing then why is the
    >> >> Parameter
    >> > 1
    >> >> and 2 stated ? Does this KeyDown event
    actually return values.
    >> >>
    >> >> I have tried reading the KeyDown event
    using
    >> >>
    >> >> MessageValue:=CallSprite(@"ActiveX Text
    Entry",#KeyPress)
    >> >> and
    >> >> MessageValue:=EventLastMatched@"ActiveX
    Text Entry"[#KeyDown]
    >> >>
    >> >> But with no success. Anyone have any other
    methods I could try ?
    >> >>
    >> >> Thanks
    >> >>
    >> >>
    >> >
    >> >
    >>
    >>
    >
    >

  • Value Signalling Event Case

    Hi Guys,
    I am trying to trigger an event using "Value Signalling" and i hit a little bit of snag.
    I am reading logic inputs continuously and i wanted to trigger an event if there is a change on logic signals.
    What i did is i read the logic signals initially so to get the default state and re-read again the logic signals inside the timed loop in the event case waiting for the signals to change. 
    However, the event keep triggering even there is no change in signal.
    Any advice?
    Regards
    Ray
    Solved!
    Go to Solution.
    Attachments:
    untitled.PNG ‏85 KB

    Of course you did not show any actual code (just an image) so we can only guess the overall program architecture and what's in the other cases and events.
    Still, you might be over-thinking all this. Since the loop is already spinning it seems overkill to trigger things using signaling events. All you probably need is a small case structure that executes additional code whenever things change. Events are primarily used to handle user interaction from the front panel. You just need to branch depending on the "changed/not_changed" case, which is trivial.
    LabVIEW Champion . Do more with less code and in less time .

  • Chain up event case

    Hi,
    Is it possible to chain up several event case which are in an event structure? Without changing this structure by a sequence structure.
    For example: you have one button per event and there is one button "do it all" which chain up all the buttons   
    I appreciate your support, tks in advance.
    Dido

    Or have a look at the "producer-consumer-design pattern" with events http://zone.ni.com/devzone/cda/tut/p/id/3023
    This is a powerful tool to do what you want...you can define the reactions to your events in the consumer loop and fire these reaction as you like...
     Greetings
    Christian
    THINK G!! ;-)
    Using LabView 2010 and 2011 on Mac and Win
    Programming in Microsoft Visual C++ (Win), XCode (Mac)

  • Event Case stuck unless timeout wired

    Hello,
    Why do event cases get stuck if there is no value wired to the "timeout" case?  In the vi I've attached, if there's a "-1" wired to timeout, or if I remove the timeout, the vi gets stuck, but if I put a value on the timeout, it wroks fine, but get's stuck for the amount of time in the timeout value... if I put in 5000 it get's stuck... I don't understand why the timeout is required sometimes, even if there's nothing in the timeout case....
    much thanks!
    Attachments:
    EventCased.vi ‏10 KB

    What you see is normal (and intended) behaviour.
    Due to data-flow all the code inside the while loop will run at the same pace.
    If no event happens, the event structure will wait until the timeout passes (forever if disconnected of -1) and then the while loop can 'spin' once more.
    You can see this by enabling execution highlighting and using a long (10000) timeout.
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • How can I use the same event case for different controls dynamically

    OS: Linux 2.6.24-1-686 #1 SMP Sat Apr 19 00:37:55 UTC 2008 i686 GNU/Linux
    LabVIEW: Version 8.2
    I have a lot of (about 50) controls (numeric, boolean) on my front panel. If a "Value Change" event will be fired by any of them the same event case shall be executed. As I do not want to add all 50 controls to the same event case manually I am looking for a way to do it at run time. Additionally the VI is still under contruction, i.e. controls will be added and removed.
    Thanks for any help here.
    Regards,
    Johannes
    Solved!
    Go to Solution.

    Hi Johannes,
    collect all your control references (you can use the FP property for it) and create a user event. Connect this user event to your event structure. Now you have one event case for all your controls. See the attached picture.
    Mike
    Attachments:
    Unbenannt1.PNG ‏11 KB

Maybe you are looking for

  • Windows 8.1 with Bing ISO

    Hi, I need to replace Windows 8.1 with Bing x64 for the x86 version in order to use some old apps. I tried to use mediacreationtool to download the setup, but it does not have the "with Bing" edition. Where can I download the x86 ISO for this edition

  • How to resolve ORA-06564 "Directory" does not exist

    Error when attempting to select from external table: SQL> select * from acore.owb_nielsen_dma_load; select * from acore.owb_nielsen_dma_load ERROR at line 1: ORA-06564: object XTRAND_ACORE_LOC_FF_MODULE_LOC does not exist Directory does exist: SQL> s

  • Date From and Date To Restriction

    Hi, I am loading data from R/3 into BW. I am bringing in Time Dependent Data. I want to write routine to bring the data only ones which are valid. I've written code as form compute_time_dependent_dates   changing p_datefrom type d            p_dateto

  • Error when opening Windows IDCS2 file on Mac

    Hi all, When I try to open an IDCS2/Windows file on my Mac, I get the following message... "Cannot open "filename.indd". Please upgrade your plug-ins to their latest versions, or upgrade to the latest version of Adobe InDesign." ...in a dialog box li

  • Make a DSC Script resource execute with elevated privileges

    Hello Everyone, Is there a built-in way into DSC to make it execute certain resources as administrator with elevated privileges on Windows 8.1? What's i'm trying to achieve for example is install SQL Express 2012 in a Script DSC resource, but it keep