VISA Wait on Event User Event

I have a Producer/Consumer program that uses an Event Structure to handle the UI button presses.  I want to be able to use the VISA wait on Event to read characters from the RS232 port.  So in my Event Structure I created a case for dynamic user events.
I also create a while loop that has the VISA Enable Event and VISA Wait on Event in it. I enabled the "Serial Character" event only.  When I get this event I use the Create User Event.VI and Register for Events to get a Event Refnum
How do I get the Event Refnum from this loop into my Producer loop?
Solved!
Go to Solution.

Paul_Knight_Lockheed_Martin wrote:
Here is the code
No, that is not the code. That is one subVI and a picture. Where are you waiting for the VISA events? Where are you generating your user event? Based on the picture you are calling the Initialize_Controller_Communication and remaing in that code until the Stop buuton is pressed. You will not start your event structure in the producer loop until this VI completes. So, if you are not hitting the stop button to complete your initializtion it is no wonder you are never seeing your event structure run.
Mark Yedinak
"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot

Similar Messages

  • VISA wait on Event crashes RT target

    After adding code that included a VISA wait on event (serial character), my cFP-2220 with LVRT 2012SP1 stopped answering when LabVIEW tries to halt the running code to do a build or deploy...(The code works otherwise works fine).
    The code on the controller seems to stop (all activity can be seen halting), but the VISA-part seems to still be hanging, or have crashed the controller (web and ftp interface goes down as well).  If I just reduce the given timeout from 100 ms to 50 ms, the problem disappears. 
    My own interpretation of this is that the rules that is supposed to enable the host PC to halt code on the RT-target is simply not abided by the VISA wait function, and if that function happens to be waiting while the command is issued, and this wait does not happen to time out relatively shortly after the command has arrived, it will cause a crash.
    Is this a bug, is there a workaround other than not using events (I changed the code from polling to events to be able to detect 5/10 ms silence time on serial ports without using all processing time on it...), or is it expected and not considered an issue?
    MTO

    James-K wrote:
    Artst,
    Can you post a screenshot of your code to further clarify?  
    It sounds like you are trying to stop the VIs by clearing the reference while it is still in use which will lead to a crash.  There is not a way to "unblock" a VI once it is running.  Can you specify a timeout instead?
    Well, I think this is not giving enough credit to the actual problem. One common VISA programming paradigme in the standard C API is to actually let a VISA Read (and of course a VISA Wait on Event) to terminate with an error by issuing the viTerminate() function, which I believe should be possible to get optionally be called by VISA Close too. Unfortunately there is no direct access to any VISA Terminate function in the LabVIEW palettes, but I have in the past created a small VI which calls the underlaying VISA API directly to abort any stuck operations on a session. Possibly this VI could solve the problem, making the VISA Wait On Event return before the VISA Close pulls its session under its feet.
    PS: Why can't I upload the VI directly to the board? Is it because it is in LabVIEW 7.1 format??
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions
    Attachments:
    VISA Close with Abort.zip ‏10 KB

  • VISA wait on event Error -107380731​3

    Hello, I am trying to zero and calibrate a pair of HP power meters.
    After sending the command to zero one of the meters, I use the VISA Wait for RQS.vi which throws this error:
    Error -1073807313 occurred at VISA Wait on Event in Wait for RQS.VI->HP 437B_visa.vi->PowerMeterSetup.vi
    Possible reason(s):
    VISA: (Hex 0xBFFF002F) You must be enabled for events of the specified type in order to receive them.
    I opened up the "Wait for RQS.vi" to examine the "Wait on Event.vi". The "Wait on Event.vi" has the hexidecimal constant 3FFF200B (Service Request) attached to the event type input, and there is a VISA event class controller set to "Generic Event" attached to the event resource class input.
    So, why the error?
    Thanks,
    Victor

    On NI's web site there is a tutorial, app note, and examples on using VISA for handling service requests. Below are links to each.
    Tutorial: http://www.ni.com/swf/presentation/us/visa/
    Application Note: http://zone.ni.com/devzone/conceptd.nsf/webmain/1A​760883EEF23D7E86256DBA006C9C00?opendocument
    Examples: http://sine.ni.com/apps/we/niepd_web_display.DISPL​AY_EPD4?p_guid=C99424CC48EC1273E034080020E74861&p_​...

  • VISA Wait On Event Crashes LabVIEW

    While "VISA Wait On Event" is pending on an event, and in another thread the "VISA resource name" input to "VISA Wait On Event" is closed using "VISA Close" vi LabVIEW crashes.
    I had a need to programmatically cause "VISA Wait On Event" to unblock so the LabVIEW program it is running in can be closed, or the "VISA resource name" originally input to "VISA Wait On Event" can be changed. I expected that executing "VISA Close" in another thread would cause "VISA Wait On Event" to unblock with an error. Instead LabVIEW crashes.

    James-K wrote:
    Artst,
    Can you post a screenshot of your code to further clarify?  
    It sounds like you are trying to stop the VIs by clearing the reference while it is still in use which will lead to a crash.  There is not a way to "unblock" a VI once it is running.  Can you specify a timeout instead?
    Well, I think this is not giving enough credit to the actual problem. One common VISA programming paradigme in the standard C API is to actually let a VISA Read (and of course a VISA Wait on Event) to terminate with an error by issuing the viTerminate() function, which I believe should be possible to get optionally be called by VISA Close too. Unfortunately there is no direct access to any VISA Terminate function in the LabVIEW palettes, but I have in the past created a small VI which calls the underlaying VISA API directly to abort any stuck operations on a session. Possibly this VI could solve the problem, making the VISA Wait On Event return before the VISA Close pulls its session under its feet.
    PS: Why can't I upload the VI directly to the board? Is it because it is in LabVIEW 7.1 format??
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions
    Attachments:
    VISA Close with Abort.zip ‏10 KB

  • HP 34401A - wait on event in Wait on RQS

    Hello,
    i'm in a desperate situation. I want to measure resistance with LabView 7.1 over GPIB. The equipment i use is the HP 34401A multimeter. For many times it was no problem. The single read example worked without failures and returned the measured values.
    Then a short time later, nothing worked as before. I always receive this error: "VISA Wait on Event in Wait for RQS.VI->HP34401A Read Meas.vi->HP34401A Single Read Example.vi"
    I know this question is not asked for the first time. But the answers given in the other threads don't help.
    The timeout time i changed from 10000 to 60000 ms. The failure is in the wait for RQS.vi .
    Please help me, that would be very kind!
    Thanks a lot
    Greg

    I have one of those multimeters as well, and use it from time to time in a program to verify the voltage from a power supply...
    I always use the method in the vi attached, since I've always found it easier (again, easier for me anyways), since you can control everything. You may want to vary the wait in between the read and the write, since my meter is an Agilent (newer than if it says HP...they had to branch it off for some reason), and it might be different, but I doubt it.
    All the commands are in the manual... Hope this helps,
    Geoff
    Attachments:
    GPIB Write-Read.vi ‏22 KB

  • Windows 7 very slow logon, Waiting for the User Profile Service, winlogon event 6006

    Hello,
    Every so often one of our Windows 7 clients which is not normally having any delay at logon will take a very long time to login. This may be 10 or 20 minutes or up to an hour in some cases.
    Typically the event log will contain entries like
    The winlogon notification subscriber <Profiles> took 572 second(s) to handle the notification event (Logon).
    There is no further information available from Event Log Online Help, nor any additional detail as to why the logon event was so slow. During the delay the user will just see "Waiting for the User Profile Service" on their screen.
    We first started seeing this problem with Windows Vista and if anything the situation has not improved since then. It has never happened with any of our Windows XP users.
    We are currently planning a migration of computers to Windows 7 but stuff like this which has not been resolved in Windows over a 2 year period will stall that migration. The least improvement is to increase the event notification to give a lot more
    information on why the user profile processing has stalled.

    Hi,
    When did the issue begin to occur? Did it occur after installing certain application or applying certain policy?
    To troubleshoot the issue, please perform the following step.
    1. Restart the machine in Safe Mode with Networking to check whether the system can login quicker.
    2. Type “gpedit.msc” in Search box and press Enter. Navigate to the following location:
    Computer Configuration->Administrative Templates->System->Logon
    Please double click “Always wait for the network at computer startup and logon” policy and disable it.
    3. Perform a
    Clean Boot to check the result.
    Thanks,
    Novak

  • Query on Using fork with wait for event

    Hi All,
    I have a scenario in which a fork has two branches and one branch has the multiple steps along the line and also calls a subworkflow in one of the steps.
    The second branch has a single wait for event to complete the workflow in case of a cancel event.
    My understanding is that when the branch one executes and is on a single step decision or have gone inside a subworkflow and wating for user decision on the workitem created
    Whenever the wait event is triggered on the main workflow the second branch gets executed completing the workflow and all the branch one steps and the subworkflow gets logically deleted removing all the workitem from the inbox.
    Do I have to do any specific process control in main workflow to make sure that the subworkflow is deleted .
    Please clarify on this.
    Thanks,
    Charan.

    It should be taken care by itself. No additional steps required.
    Regards, IA

  • Error in Workflow wait for event node

    Hello Experts,
    I am working on one QM notification. I shall explain the scenario first:
    1) User will take the usage decision on inspection lot in QA11. When user will take decision and save inspection lot BUS2045 event USAGEDECISIONMADE will be triggered and initiate my workflow here.
    2) After workflow initiation system will create notification and send to approver, but here i have wait step in my workflow for BUS2078 - Created (Notification).
    wait for Event step
    BO: BUS2078
    EV: CREATED
    I am posting error below:
    Error when starting work item 000000294361
    Error when processing node '0000000060' (ParForEach index 000000)
    Error when creating a component of type 'Wait Step'
    Error when creating an event item
    Error within method CL_SWF_RUN_WIM_EVENT->_CREATE_WORKITEM_CONTAINER
    Error within method CL_SWF_RUN_WIM_EVENT->_GET_INIT_WORKITEM_CONTAINER
    Workflow 000000294361 wait step 0000000060: No valid object ID in container element 'Notification
    Node 60 - wait for event step.
    Re.,
    Guri

    Hi,
    Based on your description what I felt is you are making use  of a wait step in which you have choose to wait till BUS2078 event CREATED is occured ... right.. Now can you please clear me that where and how this event will triggered.
    or is it some thign like you are making use of event creator step and in this case, When ever you are making use of the eventcreator  step and a BOR object inside it make sure that specific BOR object is already instatitaed in the workflow container , if it is instantiated then only it will try to identify the instance  or the BOR and it will try to rasie the event.
    Regards
    Pavan

  • NiDCPower Wait For Event

    Hello,
    I am using the PXIe-4139 SMU to source a current sequence that starts when a trigger is received and takes about 40 seconds to complete.
    After the niDCPower Initiate VI I have inserted the niDCPower Wait For Event VI with a timeout set to 300 seconds to allow for enough time to receive the trigger and complete the sequence. This VI waits for the Sequence Engine Done Event.
    Now this works fine, however, when the user wishes to stop the programm for whatever reasons, they have to wait the full 300 seconds until the Wait For Event VI produces a timeout error and stops the programm. This is rather inconvenient. How can I change the programm so that the user can stop it even when the Wait For Event VI hasn't reached its timeout?
    I tried this:
    But this doesn't work. For some reason, I get a timeout error with code -200474 but the boolean operator returns FALSE.
    Any other ideas?

    If there an output on the wait for event VI that flags a timeout? If so, set the timeout short (like 100 msec) and wait for 3000 timeouts before continuing on.
    Oh, and use an event structure. Timeout event (timeout=0) checks the wait for event, value change event for button breaks out of loop.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Wait for event step..

    hi all,
    I have a wait for event step in my owrkflow and it is working fine. My problem us i am not able to trigger this event using program can anyone please let me know what i am doing wrong. following is the code i am using to trigger the event
    DATA: key TYPE SWEINSTCOU-OBJKEY,
            object  TYPE  SWETYPECOU-OBJTYPE,
            event TYPE SWETYPECOU-EVENT.
      DATA: event_id LIKE swr_struct-event_id,
            return_code LIKE sy-subrc,
            input_container TYPE swr_cont OCCURS 0 WITH HEADER LINE,
            message_lines TYPE swr_messag OCCURS 0 WITH HEADER LINE,
            message_struct TYPE swr_mstruc OCCURS 0 WITH HEADER LINE.
    *  CONCATENATE pernr reinr INTO key.
    key = reinr.
      object = 'BUS2089'.
      IF action = 'APPROVED'.
        event = 'APPROVED'.
      ELSEIF action = 'REJECTED'.
        event = 'CANCELLED'.
      ENDIF.
    *  swc_create_object object 'BUS2089' key.
      CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'
        EXPORTING
          object_type             = 'BUS2089'
          object_key              =  key
          event                   = event
         commit_work             = 'X'
         event_language          = sy-langu
         language                = sy-langu
         user                    = sy-uname
    *    IFS_XML_CONTAINER       =
       IMPORTING
         return_code             = return_code
         event_id                = event_id
       TABLES
         input_container         = input_container
         message_lines           = message_lines
         message_struct          = message_struct
    commit WORK.
    however if i execute the FM SAP_WAPI_CREATE_EVENT by passing the values it works fine.
    Thanks
    Saurabh

    Hi
    however if i execute the
    FM SAP_WAPI_CREATE_EVENT by passing
    the values it works fine.
    It will trigger only when you execute the above function module or
    SWE_EVENT_CREATE because 
    You have a BO and an event associated with it now when you want to trigger this this event through program then you have to make a kind of mapping between BO and your program so thta's what this Fm does, when ever you execute the program as you are passing all the values to the Function the Evnt associated with the BO is triggered.
    In order to trigger use SWE_EVENT_CREATE aand after calling this fucntion use COMMIT WORK statement
    Could you let  me know what condidtion did you write for the WAIT step to continue.
    Regards
    Pavan

  • Wait for Event not being picked up by workflow

    Hi,
    We have a purchase order workflow that has a parallel branch with a wait for event of 'Released' on it. The theory is that if a PO is released the workflow will finish. We have a situation where POs are created then released straight away by an idoc. In the event log we can see the release step created event and it correctly starts the workflow however the released event follows at exactly the same time and the workflow does not seem to notice this so it sends a released PO to a user to be released. I hope this makes sense. Can anyone think of a reason why this might be happening? Does it need a slight delay between the two events?  In SWEINST the linkage is active and when I look at the entry for one of these POs it tales me to the correct workflow.
    Thanks
    Rob

    Hi,
    You could possibly create a check function module for the event. In the check function module you check some specific variable (if there is something you can use) - for example if the event was created by a certain user or if the PO is a certain type(?). Then if your condition is fulfilled, you raise an exception and no event will be triggered => no workflow.
    This is just one possible solution.
    Regards,
    Karri

  • Wait for Event FIPP - Completed Logically Deleted

    Hi WF Experts,
    We have a WF for Release of payments.
    It has 1 Fork with 2 parallel branches (both necessary).
    1 Branch has the approval process for Amount release and the other branch calling the Account assignment approval Subworkflow.
    The approval process branch has the until loop with increment counter and it picks the agents within the loop until a loop condition is reached and thereby till no more approvals required.
    The other branch, before calling the subworkflow, it checks a WAIT FOR EVENT FIPP->COMPLETED with container element FIPPID.
    Both these branches needs to be completed so that the forks gets ended and the wf comes out of the fork.
    The approval process branch is working perfectly. But in the other branch the WAIT FOR EVENT FIPP->COMPLETED  gets logically deleted and thereby, this branch does not go firther to start the Account assignment approval Subworkflow. This way the Fork with the 2 necessary branches does not end, and thereby, the WF stops here and could not go further to set release indicators (Which is a backgorund task).This will confirm the end of WF process.
    When I pass the WI ID for this Wait event in the SWIA, it shows the status as CANCELLED.
    The WF User log as a whole shows the status as COMPLETED as all the approvers has approved the release.
    Why is the Wait for Event gets logically deleted ?Please advice.
    Edited by: Sameer Anwar on Jun 12, 2011 9:17 AM
    Edited by: Sameer Anwar on Jun 12, 2011 9:21 AM

    Dear Experts,
    Any update on this . I am unable to sort this out why the Workflow is getting stopped.
    -Anwar

  • Wait for event step without callback

    Hi All,
    In 4.6C I have the following problem:
    We have a workflow that has a fork with 2 branches, with 1 necessary for continuing the fork.
    One of the branches has a dynamic parallel processing step on a multiline container element, where each parallel process is a wait for event step. For example if the multiline element has 5 records, than there will be 5 parallel wait for event steps on this branch, and if all 5 are completed, then the workflow continues after the fork and the other branch should be logically deleted (normal behaviour).
    The other branch has a single wait for event step, if this event is received, the other branch's parallel wait for event steps should be deleted to continue.
    The problem is that when the event for the latter single wait step is received, the step gets completed, but sometimes the parallel wait for event steps on the other branch are not deleted and the wokflow does not continue. The completed wait for event step shows that the callback is not completed yet.
    I tried to fix these steps in SWPC, but in 4.6C it does not work for wait for event steps w/o callback. There's an OSS note for higher releases where this is fixed to enable SWPC for wait for events, so I copied it to a custom program and use that right now.
    First question is why does the system not continue these workflow's when the event is received? My guess is that the tRFC calls get stuck and when the tRFC job reprocesses the entries, it does not do it correctly. For example lately we had a tablespace problem that caused some tRFC calls to go into error. The waiting steps in the instances were completed w/o callback. I reprocessed the tRFC entries, which created new entries in the Workflow logs showing that the events are received, but the workflows still hang.
    Second question, it takes a lot of time to logically delete those parallel wait for event steps. When the event for the single wait for event is received and the workflow continues w/o problem, it may take tens of minutes from the receipt of the event until the parallel wait for event steps get deleted and the WF continues. Why does it take so long?
    Thanks,
    KK

    Hi,
    Regarding the delay and the hundreds of thousand SWW_CONT updates... the main workflow on one branch does a dynamic parallel processing of a subworkflow using a multiline container element that can have 50 or even 100 elements. So we can have 50 or even 100 subworkflows waiting for their event to be triggered.
    The main workflow container contains many elements, some multiline with long structures, so in one instance the main flow had 8000 entries in SWW_CONT (each field of a structure is a separate record in SWW_CONT).
    Now if I do the math, when this workflow loads all the container elements of the main flow into the 100 waiting subflows before deleting them and continuing along the other branch, it creates 100 times 8000 entries in SWW_CONT, that is 800.000 inserts!
    And this was ONE single workflow.. Imagine when we have just a few hundred and they all want to continue at the same time...
    Anyway, the beauty comes now....
    I created a simple main flow with a single multiline import parameter USERS of object USER. It has a fork with 2 branches, 1 enough to continue. One branch is a user decision with 1 option: Continue. The other branch has a subworkflow and it does dynamic parallel processing with the multiline element USERS.
    The subworkflow has one single import element USER of object USER. It has only one step, a wait for event, waiting for the DELETED event of the USER object.
    That's the scenario.
    When I start the main flow, filling the USERS parameter with two user objects, on the first branch it starts the two parallel waiting subflows with one user each, and I get the decision step on the other branch. If I check the subflow containers this time, they only have one USER object each.
    Now if I complete the user decision, the workflow continues, logically deletes the subflows and completes. If I check the subflow containers after this, they all include the USERS multile container element with all the USERS I started the main flow with!
    So this time it was a different main flow, different subflow, different events. I guess there can't be any custom code doing this, unless there's some generic workflow user exit somewhere.
    Feel free to test this yourselves if you have 4.6C, quite easy scenario. Guess I'll try in ECC 6.0 too just to see...
    And I'll report to SAP for sure.
    Regards,
    Krisztian Klausz

  • Wait for Event Step (Urgent).

    Hi, all!
    I m unable to successfully execute my WAIT FOR EVENT step in my Workflow.
    Scenario:
    Have my own customised screen for HR approval process. In the second step after displaying to the approver when he actually presses on the <b>APPROVE</b> button my <b>APPROVED</b> event for the <b>same object</b> is triggered. Now I m waiting for this event im my workflow. Done the <b>WAIT FOR EVENT</b> in the WF .ie. from WF container selected the BOR and assigned the <b>APPROVED</b> event in the <b>WAIT FOR EVENT</b> step.
    Problem:
    My WF is unable to catch the event .ie. even in SWEL, "<b>NO RECEIVER FOUND</b>".
    Thanks and Regards,
    Sudipto

    Hi!
    Thanks.
    Actually I m facing a peculiar porblem...
    Scenario: My WF has  3 steps.
    1)The user fills in the initial screen.
    2)Then it goes to the second person who adds comments    and approves it.
    3)This triggers the <b>APPROVE</b> event for the same OBJECT.
    For which my WF has the <b>WAIT FOR EVENT</b>. After which there is just this SEND MAIL task
    Problem:
    My WF when executed by itself actually performs perfectly and the SEND MAIL is actually executed.
    But when it is initiated from my ABAP prog...It goes to the next level user in line, where he adds his comments n then it goes to my <b>WAIT FOR EVENT</b> but my SEND MAIL is not executed.
    As the 2nd step of display is done with the object key hence there shud not be any value passing prob from my prog.
    I cannot understand the prob.....
    Regards,
    Sudipto
    Message was edited by: Sudipto Barman

  • Error while completing Wait for event step

    Hi Gurus,
    I have a Workflow developed which has a "Wait for Event" step.
    In that step,I am facing a problem .It seems the step is not getting completed properly.
    When I check in SWEL it shows the Event is triggered.But the next which is a 'Send Mail' step is not getting executed.
    The Event shows action status as "Receiver started correctly".
    When i executed "Complete Manually " in SWIA,it executed correctly and also the further steps got executed.
    What could be the issue ?
    Many Thanks in advance !
    Regards,
    Ameya Kulkarni

    Hello Ameya !
                     To one of my replies to this thread you have stated that no container elements are configured to wait for event step.
                     Without business object,event and container element with object reference, wait for event will not fire.
                     When the user changes the status in KO02, event fires and is seen in SWEL.But, if it should reflect in workflow, afore- mentioned details needs to be configured in wait for event step.
                    Have you configured this wait for event step with event 2 ?
    Regards,
    S.Suresh

Maybe you are looking for