problems of queue/waiting

Guys,

I adapt a code LV to the next iteration of our PEAK program that sends data much more quickly.  So that the code LV to stand, I decided that I needed a producer/consumer structure so that the treatment of the data read from the serial port can be processed at their own pace (see attached code).  The 'read' lights up only when a notifier of a loop of "Write" told him to.

The question I have, is I want an entire line of text to be queued up to the '\n' and for this to be line out queued in the loop of the consumer.  It sounds simple, but the devil seems to be in the details.  At present, only partial lines seem to be in queue and removed.  I tried adding a property node indicating the VISA to read up to the '\n', but I don't know if this helped.  Also, I think that the loop of consumption is always subservient to the producer in terms of speed loop, it iterates.  Is it possible for a whole text in line waiting at a time line and the queue in the same way at their own pace?  The number of bytes in a line varies, so I can't use this method.

A few problems with your code.

1. your VISA reads enum TermChar set to enter the number of bytes to read.  That makes no sense.  He's looking for a number not an enum.  This is why there is a point of constraint.  The value of TermChar is actually 2, then read you 2 bytes.  You have a knot of property There you say the number of bytes in the port, but you do not use.

2. your boss while loop will never stop because you have a False constant that is connected to a Terminal loop.  The only way to stop this program is to give it up.

3 never let go. you the declarant 'GO', that you created in the upper loop and the central loop.

4. Why do you have the word "Inopérable" on your stop buttons?  In addition, it is more desirable to have a single Stop button that stops the whole program, rather than having to hit several stop for each individual loop buttons.

JK1,

Wouldn't be easier (since the stop character is activated and is the default value of \n) to just read a sufficiently large number of bytes, larger than any number of bytes that you would ever expect in a message. ?

A read VISA ends in one of 3 ways.

1. when the required number of bytes have been read.

2. the stop (if enabled) character is received.

3. the time-out occurred before the get #1 or #2.

Tags: NI Software

Similar Questions

  • Heating problems Strain Gage; Wait for the function measurement of delay

    Hello

    I am able (using four 350 ohm gauges) of the strain using a NI 9237 module with a cDAQ in connection Full deck Type 3. My test is to measure the strain over long periods of time (~ 10 days). The NI 9237 measure strain at a rate of 2000 Hz (this is the slowest rate). The wheatstone bridge is currently powerd with the NI 9237 of 2.5 V. When I get my data permanently, I see the strain increases with time (which it shouldn't do my test), and I suspect it's because of free heating strain gauges. So, to overcome this problem, I think using "Wait (ms)" and ask the program to obtain data once every 5 min. Five minutes should be more than enough to dissipate any overheating of the gauge.

    My question is: if I use the function 'wait (ms)', is my sensor (extensometer) are constantly under tension during the time-out of 5 minutes? I think that the functions "queue" are used inside a loop to allow a VI to sleep during the prescribed period (correct me if I'm wrong). So, it means that the sensor is not powered during this time?

    Thank you

    SID

    I wouldn't use "wait" function for your timing... software you can use the time elapsed or other timing functions

  • Unable to print... tail blocked, problem of queue I think help?

    Hello
    I hope someone can help. I am unable to cancil a print job in the print queue, so I'm not able to print anything!  I am operating Windows 7 note: Troubleshooting does not resolve the problem, but a flag indicates that it has been repaired.

    Hi, Glenell,

    What version of Windows are you using?

    Start > type services.msc

    Press enter

    Scroll down to print spooler

    Click with the right button on spooler and select stop

    Wait for Windows to stop the spooler

    Close the window

    Open the print queue and cancel the document

    Narrow queue

    Restart the computer

    Back to services.msc

    Right-click on print spooler and select start

    Wait for Windows to start the spooler

  • I can not print from Firefox, but can all the other browsers and applications (such as MS Word, notepad, etc.). I get a misprint on the print monitor as if it was a problem of queue.

    This is a recent development, but I can not print anything in Firefox. Printing open normally, it's going to the right printer that works... I can print other browsers and applications. It acts like it is in queue and then a printing error occurs and it will not be printed. I closed and reopened Firefox, open in safe mode, cleaned cache/history/cookies and restarted twice. Nothing makes no difference. Also tried printing from the preview before print that had the same result. I can print all other browsers and applications without problem, so it must be within Firefox.

    See this:

    http://KB.mozillazine.org/Problems_printing_web_pages

  • Problems with queues

    Hello

    I'm still very new with Labview, and I'm doing something that seems quite complicated for me.  I've already implemented a code that collects data from an acquisition of data and plots.  Another thing this does is backup data out of data acquisition.  I am now trying to add features to give the user the possibility to run a saved file or data acquisition, and I'm having a lot of trouble.  My queue still works when I want to execute an acquisition, but it does not work when I try to open the saved file.  I have attached the original code that I'm doing.

    I am not attached to the method that I took to choose between learning and reading of data, so if there's a better way (and I am sure that it is) please let me know.

    Thank you

    Anthony

    Thanks for the explanation of your data types.  I always recommend that you try to be consistent on your data types; If you never use a floating point values, then change your declarations of constants, and to eliminate the son orange.  Also, I still think that your problem is somewhere in the way you read your data.  Correct me if I'm wrong, but it seems that when you read data from the DAQ card it's an I32, but when you read it in your file, it's a U8 (implicitly converted an I32).  Then you divide that value by 256, which works very well for the I32 of data acquisition card, but produced only 0s for the U8 values read from the file (the maximum value of a U8 is 255, so divide produces a value less than 1, which is cut to 0 when you convert U8 before you subtract 32 and send it to the queue).

    EDIT: also, be careful when using the functions of text file for binary data, even if you think it's all ASCII.  You have the opportunity to "Convert EOL" checked, which means that LabVIEW can modify, insert, or remove values that correspond to the ASCII code of a character to end of line.  Consider using binary functions.

  • problems of queue printer with HP officejet 5510 all-in-one

    I recently updated from Windows XP to Windows 8.  When I try to print, the print jobs get stuck in the queue. I try to cancel or remove them, & they won't. He can say it's "impression". I discovered that if I restart my computer, it will display everything that has been hung up. I hate to take the restart. Computer technology which upgraded me said that my printer is compatible with Windows 8, but also many other problems.  Right now, I just want to take care of the issue of the spooler.

    I also have Office 2010 starter who pulls up with my documents.

    Hi, take a look at this link for help from HP.

  • "evaluations thread jdi" has encountered a problem. Queue of the async thread exception handling.

    I'm trying to debug a java application on the Blackberry Pearl, using Eclipse v3.4.1. After the break on a line of code, I chose a variable in the 'Variables' tab and the following message appeared:

    "evaluations thread jdi" has encountered a problem.

    Queue of the async thread exception handling. java.lang.NullPointerException.

    java.lang.NullPointerException

    What kind of message is this, she comes from - and knowledge where I even begin to determine why this is happening. Perhaps can someone point me in the right direction.

    Thank you

    Steve

    Object that you are trying in this instance is Null.

  • Problem of queue,

    I have to implement a queue. In labview queue entry must define the type of data item, what I have in the queue is a string, how to set the data type for this?

    String is like 'HA1', "HA2" something similar to this. Could you please helop me to do this?

    Thank you

    Best regards

    Paheerathan

    Just wire an empty string in data type constant

  • 64-bit worth it? Problems I should wait?

    I put my computer upgraded and looking to upgrade to Windows 7 - here is the specs:
    ATI Radeon 4870 1 GB
    AMD Phenom II 955 (image 3.2 mhz)
    3 (1066) 4 GB DDR RAM (2x2gig sticks) (was cheaper for me to get that 3 1gig sticks)
    320 GB hard drive - old, not updated for another month or two...

    I have a few questions:
    (1.) I'm a gamer - I play a lot of old adventure games, a lot of news (Wallace and Gromit, Tales of Monkey Island) and a lot of new action games (Crysis, Prototype, Arkham Asylum and some older like Half Life 2, Counter Strike). If I switch to Windows 7 64-bit, what types of problems I encounter? I know I need to update the drivers, what kind of problems with software compatibility?
    2.) I know that the restrictions with 32-bit ram (3.2 or about), so if I go with 32-bit, Windows will use as much as possible, even if it only uses half a wand - or it will use only a stick?

    I love the game, so I wouldn't go 64-bit and limit the availability of my game, or stick to 32 bit and limit my ability of material. What are your ideas/advice?
    Thank you!

    Hey, man, we have similar systems (of course, you are a smart man with taste), I have same Proc, asus 3AM79T Deluxe MB with 5870 but he had the 4870 1 previous.  I have 8 GB of DDR2 ram.

    I ran XP32 with 4 GB of ram and Vistax64 and Win7 x 64 with 8 GB of ram.

    I'm a player, Vista x 64 run all my games more Rapids then XP32.  Then, I've played NWN2, Vanguard, EQ1 and EQ2 and Civilization IV.  Some other games, but those who were and are still the most important until the Dragon Age.  Windows 7 x 64 runs all the games that I had in vista better then Vista, with the exception of Civ IV, I can not play mulitplayer, I get an error Out of constant Sync, and I alone out of sync, so it is a matter of Win 7. I hope that Firaxis patches it.

    I can't say with problem that all games work, how ever up here almost all the games I tried this worked under XP running Windows 7 x 64 Vista x 64.  Those who are very old, maybe dual boot with new drive keeping XP32 around old games?  New release games will work of course, and DX11 will soon be a common API used.  Drivers for win 7 are easy, if there are Vista drivers work (make sure you use the right x 32 or x 64 according to installs Windows 7).  Model 1.0 used Vista driver Windows 7 is 1.0 and 1.1, allowing you to use the Vista drivers until win7 are released.  The latest ATI drivers have so far been flawless for me on the 5870.

    32 bit OS can address all the 4 GB of ram, but due to restrictions will allow only 2 GB for applications and all about .5GB will be left unused by the operating system.  X 64 operating systems may use much more, how ever you must understand that, in a BONE, each space of memory 64-bit is sent 64-bit long, but a 32-bit application can only write to a 32-bit address, which means that your losing half of the addressed memory space.  Easy way to think about it is that, if your use of a 64-bit OS running a 32-bit application you have half your memory to a maximum of 3.5 GB essentially made available to them (well 2 GB for the application it self unless your running specially coded and updated software, but it is the workstation and the server arena) no games).  So for example I have 8 GB and 4 GB is available to the forefront, including only 2 GB can be used.

    If your really worried or want to keep compatibility, buy a new drive with windows 7 and leave your old intact XP32, I install XP32 back on my Saturday for CivIV system I play multiplayer with friends one or two times a week.  It will be double started on a former player.

    Good luck!
    Scott

  • problem of waiting-task

    I have a script that updates the hba firmware. I wan't first to put the server in maintenance mode.

    $task1 = get-vmhost esx1.example.com | State game-vmhost-interview

    waiting-task-task $task1

    I get a:

    Waiting-Task: cannot bind parameter 'task '. Cannot conver esx1.example.com to 'Vmware.VimAutomation.Types.Task '.

    How to properly use Wait-task

    There are a few problems reported with waiting-task in the past.

    You can try the EnterMaintenanceMode_Task method.

    $esx = Get-VMHost  | Get-View
    
    $taskMoRef = $esx.EnterMaintenanceMode_Task(0, $true)
    
    $task = Get-View $taskMoRef
    while ($task.Info.State -eq "running" -or $task.Info.State -eq "queued") {
      sleep 2
      $task = Get-View $taskMoRef
    }
    
  • Problem stopping very simple messages in queue manager

    Hello

    I am trying to get my head around the managers of messages queued waiting. I wrote a super simple program just to send a message and pass some Boolean flags. The program works, but it will not be closed properly. Can someone explain how this should be stopped?

    Two while loops get them a real stop icon but the gray before panal stays without the lines on the graph.

    Thank you
    Ross


  • queue problems

    Buy printer - 8610 - yesterday.  It prints a document, but will not take this document into the queue once it prints.  So whenever I need to print something else, I need to go into the printer setting and manually remove the prior document so that the following will be printed.  I tried the "doctor" who goes through its process and said that there are problems of queue, but it has been corrected.  But this only works for the very next document I print.  I tried to uninstall and reinstall three times now and it still does not work.  Suggestions?

    Hello

    I think you need to delete the queue. For Windows, try it please:

    • Hold down the Windows key and press R.
    • from the run window, type services.msc and press to enter.
    • If the computer asks you to Admin, you have to accept that,
    • regarder watch down to the print spooler service, right-click and select Properties
    • Click the Stop button,
    • Go to C:\Windows\System32\Spool\printers
    • delete the job inside this folder
    • restart the machine.

    Kind regards.

  • How labview processes images of queue queue?

    LabVIEW makes a copy of a picture every time that it enqueues (quid dequeue) it? In other words, if I just create a single image on the acquisition, the emptiness of this original will cause the lost images in the queue?

    I think I have a loop (Subvi) to make the image acquisition and the other loop to process the image.  The acquisition will take 30 images (for LEDS of different) in bread, send this image Board to a queue and then continue to acquire. The other loop will remove it when he has the time. At this queue/waiting to treat slowly down the acquisition (for example wait for the copy of the image of the entire table)? How to make a higher priority acquisition Subvi.

    It depends on what you are queue.

    In the messages I've seen where people had problems, they were the queue a reference.  No, I don't know exactly what kind of reference it was.  Maybe it was a reference IMAQ.

    If you are replacing the real data for the image table, I think you'll be fine and will not need to do anything special.

    Best thing to do is to try and after back if you have problems with a sample of your code.

  • Components are not queued

    I have a state machine in relatively simple queue with enum as my type of queue data.   All goes well for several days, but I made a few minor changes yesterday (I tried undo, I've covered everything that thought) and now I have a problem with queue and queue States.  My QMD runs through the first three States automatically.  Then, it enters another State to the user input, then returns to the three State.  This all happens correctly.  When I try to get into State "initialize interview", however, the queue seems to break.  Although an element seems to be added correctly (by the preview function), the loop of consumer returns to the default state.  In addition, this default state is the first State, grounded, waiting for an element and advanced to the next start-up state.  Initially, all references to the queue were of local variable for the queue, as shown on the right.  As a troubleshooting, I tried to get some of them by name.  It seems to help a little, but there are still a few erratic results.

    Another note: if I restart labview, the BAU makes beyond the interview 'initialize' error, but crashes the next time the loop of producer is activated, even if nothing is more enqueed.  As with the above scenario, the queue cannot be changed after the loop of consumer returns to the default state, even if it seems to continue a loop.  I enclose a photo to get and enqueue source of the problem.

    Hi Intaris,

    A little more information - the preview was just a troubleshooting measure to ensure that the issue was to be properly queued.  My dequeue is attached below and is inside a while loop connected to a box structure.  I have also included a screenshot of the type of queue that is used inside the loop of consumer for advance automatically if needed.

    Thank you

    Brendan

  • which will cause 'notify() and wait()' mechanism no longer works?

    Hi all

    My application has worked for a few years, unless the user recently upgraded to OS7.1 and to try out my new device, all of a sudden, he is part works not properly.

    Appplcaition will download data from the server, long story Short,

    When there is no queue of download, application will wait until asked to download real.

    my code something like the follow up:

            InvokeContainer c = new InvokeContainer(r);
            synchronized (c.syncObj) {
                // push to queue
                synchronized (_queue) { _queue.addElement(c); }
                LogManager.getInstance().add("Notify queue Thread _queue size " + _queue.size());
                synchronized (_queueSyncObj) { _queueSyncObj.notifyAll(); }
                // wait for release
               // LogManager.getInstance().add("Invoke data wait to release");
                //synchronized(c.syncObj){
                    try { c.syncObj.wait(); } catch (Exception ex) {}
                //}
                LogManager.getInstance().add("Invoke data released");
            }
    
            while (!_stop) {
                InvokeContainer c = null;
    
                // wait for invoke
                c = getNextInvoke();
                if (c == null) {
                    LogManager.getInstance().add("Wait For next queue");
                    synchronized (_queueSyncObj) {
                        try {
                            _queueSyncObj.wait();
                            LogManager.getInstance().add("Invoked");
                        } catch (Exception ex) {
                            LogManager.getInstance().add("Exception happened: " + ex.toString());
                        }
                    }
                    c = getNextInvoke();
                    LogManager.getInstance().add("Get a new queue ");
                }
    

    My question is:

    my request always stop at the:

     LogManager.getInstance().add("Notify queue Thread _queue size " + _queue.size());
    

    and I saw there's a queue, waiting, however, the line after wait() never called.

    which will cause notify() citing not wait()?

    For me, in places, your code seems too complicated for what he seeks to achieve.  I'll try to simplify.

    First you have loads of protection around your creating a Singleton RuntimeStore object.  This seems pointless.  Take a look at this:

    http://supportforums.BlackBerry.com/T5/Java-development/create-a-singleton-using-the-RuntimeStore/TA...

    Go through your code, I wonder what follows:

    (1) public static synchronized IPCThread getServerInstance() {}

    Why is this it is synchronized?  Iron several people getting to this offers no additional protection.

    (2) synchronized (GlobalSync.getSyncObj (GUID))...

    This synchronized block offers no additional protection either.  Either the

    IPCThread will be there or it won't, there is no possibility of a race condition causes you a problem here.

    (3) public static synchronized IPCThread initServerInstance() {}
    synchronized (GlobalSync.getSyncObj (GUID)) {}

    Here, there might be some value to have only one person to create it at the same time.  But if it's a question, then the second person through should check if it has been created, this code is not.  Thus, each invocation of

    initServerInstance()

    will create and start a new IPCThread.  The synchronized are totally redundant and you have a potential hole in your treatment.

    (4) public synchronized static getInstance() {} IPCThread

    you have another way to get an IPCThread, which in fact is not identical to the above and, will be different if you start another instance of your Application, for example an alternative entry or a variant of starting.

    I recommend that you replace it with the unique getInstance() method based on article.  Do start the IPCThread if it creates.

    OK, I understand that you don't think that this is related to your problem, but with the code you have, there may be several IPCThreads and would not help.

    Now on your invocation code.

    Can you please remove static from the following:

    private static class InvokeContainer...

    As far as I KNOW, he does not buy you anything in this circumstance, and it confuses me.

    The idea here seems to be that you can provide an executable in this process, which it runs and then inform the task (if necessary) awaiting.  You pack the floor area in an InvokeContainer.

    The first thing to look at, it's how you entered extracting from the queue.  Here you protect with this line:

    synchronized (inasmuch)

    So what you're saying to me here, it's that you will protect this treatment in protecting access to the inasmuch.  Something we will add it to the queue. or something is going to take off it the queue, both may not occur at the same time.  That's ok.

    So how do add you to the queue?

    Ignoring the code that will process if the process id is the same, we get this:

    InvokeContainer c = new InvokeContainer (r);
    synchronized (c.syncObj) {}
    Push the queue
    synchronized (inasmuch) {_queue.addElement (c) ;}
    synchronized (_queueSyncObj) {_queueSyncObj.notifyAll () ;}
    wait for the release
    try {c.syncObj.wait () ;} catch (Exception ex) {}}
    }

    Now, we have already seen the queue is protected using "synchronized (inasmuch).  But this code will not prevent the entry we just added picked up before that we treat the notify - in other words, the notification cannot be taken into account.  But that's OK.  The reverse is not.  If the Thread that processes the code IPCThread is at this point:

    If (c == null) {}

    and the Thread that the addition of the transformation executes these two instructions:

    synchronized (inasmuch) {_queue.addElement (c) ;}
    synchronized (_queueSyncObj) {_queueSyncObj.notifyAll () ;}

    then the IPCThread will miss warn him.

    To fix this, I'll do what I suggested earlier.

    The way, this seems very strange:

    InvokeContainer c = new InvokeContainer (r);
    synchronized (c.syncObj) {...}

    but in fact, this means that the code will never fail of the treated IPCThread this practicable, since the notification

    synchronized (c.syncObj) {c.syncObj.notify () ;}

    Cannot run until this thread is waiting.  It's a good thing.

    So that leaves only one thing to discuss - the.invokeAsync.  This code looks good, if the

    synchronized (c.syncObj) {...}

    is completely redundant.

    Summary - 2 recommendations:

    (a) change your Singleton IPCThread to use the RuntimeStore method suggested in the KB article

    (b) check the inside of the protection of

    synchronized (_queueSyncObj) {}

    which

    c = getNextInvoke();

    is always set to null.

    Finally, have you thought about putting a delay time in your expectations, while without worrying about the activity or not, the Thread will pick up every now and again work?  For example:

    _queueSyncObj.wait (1000);

    Edit: Minor typo and readability...

Maybe you are looking for