Timers in CVI

How i can excess menubar and command buttons while timer function running?

Vishnu,
What you are describing is the User Interface becoming unresponsive because a callback is executing for a long time (if I understand you correctly).
What you need to do is change the design of your software slightly. You need to use multi-threading. This means you execute different parts of your code in separate threads and Windows will switch between them every few 10's of milliseconds. So, you put your call to RunUserInterface() in the main thread, and your timer callback executes in a different thread.
If your application is simple you can replace your current callback timer with an asynchronous timer (see the multithreading libraries in the utilities section). This works much the same as a standard callback timer, with the difference being that the callback function does not execute in the main thread.
Hope this is enough to get you started.
Jamie Fraser

Similar Messages

  • Timers Multithread sous CVI

    Bonjour,
    J'ai plusieurs questions concernant mon programme avec LabWindows CVI 9.0 et 4 cartes NI PCI 6229, sous Windows XP et dual core Intel 3GHz.
    Je souhaite réaliser un programme qui réalise une boucle d’asservissement et également un contrôle et affichage sur des acquisitions. Je n’ai malheureusement pas le choix sur l’OS et je ne peux pas m’orienter sur une solution temps réel.
    Pour cela, je souhaite réaliser
    -          une boucle qui gère l’asservissement (acquisition sur 20 entrées, calcul sur ces acquisitions, et génération sur 10 sorties, tout ceci en 10ms, c’est la BOUCLE CRITIQUE)
    -          une boucle pour le contrôle (simple contrôle sur ces acquisitions: comparaison à une valeur seuil, 10ms)
    -          une boucle pour l’affichage (affichage des résultats sur la face avant des contrôles OK ou non OK, toutes les 200ms)
    Je souhaitais à la base utiliser 3 timers asynchrones de CVI, mais je me suis aperçu qu’on ne pouvait utiliser qu’un seul Timer asynchrone à la fois.
    J’ai donc vu qu’il y avait une autre solution, le multithread en utilisant les thread pool. Cette solution m’intéresse, car je souhaiterai mettre la boucle critique dans 1 thread sur le 1er coeur, la boucle de contrôle dans un 2ème thread sur le 2ème coeur, et la boucle d’affichage dans un 3ème thread sur le 2ème coeur.
    La boucle d’asservissement est la boucle critique et doit être de 10ms à +/- 2ms.
    Les autres bouclent ne sont pas critiques et peuvent avoir un décalage de +/- 10ms, le but est de ne pas perdre de données et de contrôler toutes les acquisitions. Un affichage toute les 200ms suffit.
    Voilà j’ai alors 2 questions :
    -          est-ce que mon approche (timers en multithread et diviser sur les 2 cœurs) convient pour mon application ?
    -          et comment mettre un timer classique dans un thread spécifique ? J’ai vu qu’il fallait utiliser «CmtScheduleThreadPoolFunction (int Pool_Handle, ThreadFunctionPtr Thread_Function, void *Thread_Function_Data, int *Thread_Function_ID)” Mais cette fonction appelle une fonction de type “CVICALLBACK FonctionThread(void *functionData)” et mon timer classique est de type “CVICALLBACK Timer_Classique (int panel, int control, int event, void *callbackData, int eventData1, int eventData2)” Comment donc appeler un timer classique avec une fonction CmtScheduleThreadPoolFunction ? Faut-il procéder d’une autre manière ?
    Je vous remercie de votre aide.
    Cordialement,
    Hédi.

    Bonjour,
    L'approche multi-thread est en effet la bonne, dès qu'il faut séparer plusieurs tâches. Je vous invite à consulter cet article du Rebel Site, qui traite du multithread et constitue une référence en la matière. Attention, le multithread n'implique pas obligatoirement une gestion multicoeur. Il faut pour le mettre en oeuvre passer par l'API de Windows.
    Est-il bien nécessaire de faire de du contrôle 10ms? (deuxième boucle) Au quel cas, je ne suis pas absolument sûr qu'il faille créer un thread séparé. Si cette tâche peut supporter un cadencement plus lent, il serait plus malin de venir la traiter dans le troisième thread.
    Il serait intéressant d'utiliser une Thread Safe Queue pour faire circuler les données d'un thread à l'autre. Ce mécanisme permettra de ne pas perdre de données. D'autre part, vous pouvez alors installer une callback sur un nombre d'éléments dans la TSQ (Thread Safe Queue) et venir déclencher la callback associée à cette TSQ dès que 20 éléments sont présents pour piloter le troisième thread depuis le premier.
    Dans cette configuration, il n'y a plus besoin que d'un timer, pour la partie temps critique - bien que sous Windows, on ne puisse pas garantir le déterminisme d'une boucle à 10ms - les autres thread étant 'esclave' du premier.
    Cordialement,
    .mrLeft{float:left} .mrInfo{border-left:solid 1px #989898;font-size:x-small;color:#989898}
    Mathieu R.  
      CTD - Certified TestStand Developer / Développeur TestStand Certifié  
      CLAD - Certified LabVIEW Associate Developer  

  • Can anyone explain the odd behaviour of the CVI Operator Interface?

    This is probably really related to CVI in general, but I think people should be aware of this behaviour. If tracing is enabled and a program executing, moving the mouse cursor over the Menu bar area of the Operator Interface program increases the execution of the test program dramatically. Anywhere else slows it down! Could this have any effect during critical test runs? Is there a way to force the fast execution. (i.e. to disable whatever message processing is going on when the mouse cursor is over the rest of the window?)

    Brian,
    You did not mention what is the CVI operator interface that you are using. In the Simple CVI OI, which is located at \Examples\OperatorInterfaces, the behavior you mentioned may occur.
    It is mainly because it uses a CVI timer to poll UIMessages, and the Timer Control runs in the same thread as the User Interface (CVI Panels). Because they both run in the same thread, when you move your mouse Windows handles the mouse move and repaint any window if necessary. While doing this, it stops all the other tasks that is running in the same thread, which means, the timer stops to tick and UIMessages are not handled for some time. In addition, the TestStand Engine executes synchronously with UIMessage handling, so if msg
    s are not handled the Engine pauses the execution.
    Finally, there is an example that ships with CVI under
    \Samples\Toolbox\AsyncDem.prj that shows how to use asynchronous timers. In other words, a timer that runs in a different thread different than User Interface. I also modified the Simple CVI OI to use this asynchronous timer, check the attached zip file.
    Regards,
    Roberto P.
    Applications Engineer
    National Instruments
    www.ni.com/support
    Attachments:
    Simple_CVIAsync.zip ‏176 KB

  • Timer( ) resolution in CVI 2009 SP1

    In the CVI 2009 SP1 Contents Help for Timer() function I find
    The resolution is normally 1 microsecond. However, if you set the useDefaultTimer configuration option to True, the resolution is 55 milliseconds.
    But if you click on the useDefaultTimer hyperlink, a new page is opened, where you can read that the resolution is 1 millisecond if you set useDefaultTimer to False.
    Which is the right resolution?
    I wrote my application considering 1 microsecond, but I found strange problems, and I think it is 1 ms.
    Vix
    In claris non fit interpretatio
    Using LV 2013 SP1 on Win 7 64bit
    Using LV 8.2.1 on WinXP SP3
    Using CVI 2012 SP1 on Win 7 64bit, WinXP and WinXP Embedded
    Using CVI 6.0 on Win2k, WinXP and WinXP Embedded

    Hi vix,
    Thanks for bringing those documentation problems to our attention.
    1. There does seem to be a problem with a lot of the function prototypes in the .chm help in the CVI 2009 SP1 and 2010 versions, where an extra asterisk seems to have been added to a number of output parameters. We'll fix this and post a corrected version of the affected .chm files as soon as possible. In all these cases, the parameter data type as it appears in the Parameters section of the help topic is correct, as is the prototype in the corresponding function panel.
    2. Concerning the timer resolution issues, the async timer resolution is in fact 1 millisecond, as confirmed by the GetAsyncTimerResolution function. But note that asynchronous timers are a library in and of themselves, and are not covered by what is discussed in the documentation of the Timer() function or the useDefaultTimer option.
    The resolution of the Timer() function should be 1 microsecond, as of CVI 9.0 and later. The function documentation is correct. When that change was made, however, the documentation of the useDefaultTimer option was incorrectly not updated. It should say that "the performance counter timer provides a resolution of 1 microsecond".
    You mentioned that you didn't think that the resolution of the Timer() function was 1 microsecond. If you run the following code, what do you see?
    int     i;
    double  time[10];
    for (i = 0; i < 10; i++)
        time[i] = Timer();
    for (i = 0; i < 10; i++)
        DebugPrintf ("timer = %f\n", time[i]);

  • Deux UI Timers s'exécutent en parallèle

    Bonjour,
    Je suis débutante en Labwindows CVI et j'ai trouvé des difficultés ,
    Dans mon application j'ai trois volets :
    1er volet: remplissage d'une structure
    typedef struct
    int id;
    int x[10];
    int y[10];
    }Data;
    2eme volet : Affichage du contenu de la structure
    int CVICALLBACK timerAffichage (int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
    switch (event)
            case EVENT_TIMER_TICK:
           /*Code
           plotXY (Courbe à travers le contenu de la structure Data)
            break;
        return 0;
    3eme volet :Mise a jour du contenu de la structure Data
    int CVICALLBACK MiseAjourDonnees (int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
    switch (event)
            case EVENT_TIMER_TICK:
           /*Code
            break;
        return 0;
    J'ai utilisé deux timers (UI timers) l'un pour la mise à jour et l'autre  pour l'affichage , je veux que ces deux timers s'exécutent en parallèle.
    NB: Environnement materiel: PC DELL  intel(R) Core(TM) 2DUO CPU
            Enviroment Logiciel: Labwindows CVI  2010

    Thx  Wolfgang,
    I appreciate your help  but i have a question ,
    I use multithreading to deal with my problem but i have to protect a variable from not being used by the two threads in the same time.
    By searching i found the solution of Thread Safe Var
    the question is : In my case the type of variable is structure ??
    Means:
    typedef struct
    int id;
    int x[10];
    int y[10];
    }Data;
    Data line;
    Can i use the solution of Thread Safe Var  to protect "line" ???

  • Timers In Multitreading

    Hi,
    Am working ona  application which receives data from four COM ports simentaniously,i have implemnted four threads to receive each of the channel.
    i have a timing requirement for each channel, means i should read each channel at a diffrent interval 10,15,10,25 msec respectively.
    what would be the best way to implement the timer for each of the tread independently to make it continuiosly receive in the above mentioned time frame until user stops the application.
    Thanks in Advance

    As far as I can understand, all callbacks will be executed in the same thread. This implies that under some circumstances some timer callback can never be executed: callback lenght is crucial here (see D_Biel post and code here in the thread I posted earlier: experiment with the code as is and by running timer2 before timer1).
    I can think of a more complex architecture that may be able to sustain your requirements: it won't be trivial to trim it at best but on modern multicore PCs I suppose is the best you can have:
    At program start launch four different threads, one for each COM port to handle; threads mus be sitting in a loop that processes events, possibly with some small delay in it. Save thread IDs for use in the timer callbacks
    Launc your 4 async timers with required intervals
    Timer callbacks will simply PostDeferredCallToThread the required function, using the appropriate thread ID saved before. Make sure that launched callbacks do not last more that the corresponding timer interval
    Provide a mean to stop all threads at program end
    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?

  • Timers do and communication not working on RT system on PXI chassis

    I am having problems with my application when I "Install it to a real-time target". When I run the program in debug mode everything works fine.
    I have two programs. One runs on a real-time OS on a PXI chassis Controller (Client). The other runs on my Windows 7 PC (host).
    When I run the Client application in debug mode (Run->Debug Project) everything works fine. When I run the Client application in the release mode (Run->Install Program to Real-time execution target) things do not work.
    It appears that the timers do do start. The Client application does receive communication sent from the Host application but is not able to send communication from the Client to the Host.
    I have been fighting this for a while and have tried to get help through emailing the support but have not had much luck that way. I think I need a phone call with an application engineer.

    It is not LabView. I am developing software with LabWindows\CVI. I've seemed to narrow things down a bit. When I send a message to my application on the PXI Controller it is  calling a function PostDeferredCall(...). The deferred function is never called. Not sure why it works when I am running the code in Debug Mode but not when I install it on the target. In my while loop in my RTmain() function it looks like this:
     while (!RTIsShuttingDown () && !gDone)
      /* Your code. */
      /* Sleep for some amount of time to give the desired loop rate */
      /* and to allow lower priority threads to run.                 */
      SleepUS (1000);
      ProcessSystemEvents ();
    I thought the deferred function was supposed to be called in the Main thread? Not sure where it is hanging up yet.

  • Timers help needed

    Hi all,
    I am using two timer controls in my application. One having the interval set to 50 ms and other having
    interval set to 60 ms. When i try to run both timers the callback function of only 50 ms
    timer runs perfectly. The callback of other timer doesn't run.  Even if i set interval to 10 ms then
    the callback function of that timer partially executes not complete. It only executes on the
    occuring of any event for e.g holding the mouse key on a command button.
    I want to execute both the timer callbacks simultaneously. My application is a single threaded application
    and i am using processsystemevents( ) in the end of my code.
    Any help will be greatly appreciated.

    Do you know how much time every callback lasts? you may have problems if the elapsed time of one of the timer callbacks is too long, since the callback could be fired immediately after it has finished not leaving room for the other. Try running one timer only at a time tracing the elapsed time with something like that:
    int timercallback (.......) {
    double tini = Timer ();
    if (event != EVENT_TIMER_TICK) return 0;
    // your code here
    DebugPrintf ("Elapsed time: %.0f msec\n", (Timer () - tini) * 1000.0);
    return 0;
    If the timer callback is too long you need to simply it at the maximum level in order to reduce it. Maybe you can transfer some task to the main thread with PostDeferredCall or try using an asynchronous timer for at least one of your timers (be warned that in this case you are moving to a multithreaded environment so you need to take the appropriate precautions to avoid concurrent access to shared resources / variables).
    The following step could be to move to a full multithreaded application.
    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?

  • Cannot display square root symbol in cvi

    I don't understand why this would be an issue, but if I'm writing in the source window (with the default font of NIEditor), I cannot display a square root symbol "√" - every time I type alt+251, I get "v". Ok, not a huge deal in the source window, but it is a big deal if THAT is what's being stored in a string variable I'm writing out to a file. Additionally, if I use the following to format a string:
    "Fmt(setpointUOM, "%s<W%cT/P3", 251);", then setpointUOM = "WüT/P3". If I display this variable in a string control, it displays as "W√T/P3", which is correct, but if I use it in a Text Box or save it to a sql database, it displays "WüT/P3" which is unacceptable.
    I've tried changing the fonts but nothing works or I get even stranger results. I've been dealing with/ignoring this since CVI7 and I'm currently at CVI10. Thanks for any help.
    Solved!
    Go to Solution.

    The difference in the display between W√T/P3 and WüT/P3 has to do with the character set that you select for the UI control. From what I can tell, only the OEM code pages map the √ symbol to character 251, so if you want to see √ for that character, you should pick the OEM character set, in that control.
    Entering √ with the keyboard in a CVI window seems like a much more problematic task. When you type Alt+251 on a CVI window, the keyboard driver is converting the 251 to 118 (the letter v). I don't know why it does that, but I noticed that the code that it converts 251 to varies, depending on your input language (which you can change in Control Panel>>Region and Language>>Change keyboards or other input methods). When english is selected in the language bar, it converts it to 118. With other languages, it converts it to other codes. I tried entering the unicode value for √ directly, which is Alt+221A (to enter unicode characters using the keypad, you have to follow the steps described here). But it didn't work. It still converted it to 118. I suspect the keyboard driver is doing this because it tries to map 221A to some symbol that is valid in the code page that corresponds to the input language, isn't able to, and picks what it thinks is the closest match.
    In lots of other applications (but not all) you can type Alt+251 or Alt+221A and it works just fine. This is because those applications accept unicode characters directly. Unfortunately, CVI isn't one of them. It uses code pages (a.k.a. character sets, or multibyte sequences) instead of unicode, and symbols don't have a universal meaning; they depend on the code page.
    Even if all this were not an impediment, you'd still run into the problem that in CVI 2010 you cannot change the font of the CVI source window to use an OEM character set. So, you'd still see it displayed as a v or a ü. In CVI 2012 you can change the change it, and so if you were using CVI 2012 you could conceivably use the clipboard to paste the √, but there is a bug in CVI that is preventing OEM characters from being pasted correctly (I realize the description says that it affects tree tooltips, but it's also generally affecting clipboard operations of some less commonly used character sets).
    So, to make a long story short, I think you should continue entering the code directly with the Fmt function, at least until this bug is fixed. And make sure that all UI controls that need to display this string are using the OEM character set.
    Luis

  • Using Excel with Visual C++ 6.0 (need a graph control that behaves as much like the one in CVI as possible)

    I hate to beat this to death but I was unable to find a
    clear answer to this question.  Does NI provide Excel control from within
    Visual C++ 6.0? 
    I read that NI supports the ANSI-C library only for Visual C++ 6.0 users:
    Thread : "Re: Benifits of using measurment
    studio for VC++ 6.0?"
    NI REP : drohacek
    Quote  : "we made the decision to support Visual
    C++ 6.0 users only through the ANSI-C interface and not through the Measurement
    Studio MFC-based class libraries."
    If there is a suggested way of controlling Excel from within Measurement Studio
    for Visual C++ 6.0 then I’d love to know it. 
    If not, can a plain statement be made basically stating that if you want
    to control Excel you can’t use a Visual C++ 6.0 environment even with Measurement
    Studio support?
    With .NET of course you can just decide to have Excel support added during
    project creation.  CVI can act as an ActiveX server and easily control
    Excel just by building off the examples shipped with CVI.  I see that
    there is support, using the Measurement Studio for Visual C++ 6.0 Project Wizard,
    for taking existing CVI projects and converting them to Visual C++ 6.0 projects
    or for calling CVI libraries from a .dll from within Visual C++ 6.0.  I suppose I could do the work
    in CVI and then convert the project but I'm so deeply tied into all my MFC calls that I don't see
    how I can cleanly include the CVI libraries into my existing VC++ 6.0 projects.
    What I'm really after here is a visual graph control like the one in CVI that I
    can use from Visual C++ 6.0.  I purchased a 3rd party graph control for use
    in VC++ 6.0 that works well but isn't really visual.  I mean you can't
    enter any values in it until you run the program and fill it out programmatically. 
    Then you can see which columns are two narrow, quit the program, adjust the
    column width of your now empty control, and repeat, until you get the thing
    looking the way you want.  If I could call into Excel from within Visual
    C++ 6.0  the way I do from within .NET
    then I could use Excel to hold the table and just read in the values into my table
    control at run time.  Basically I'd use Excel as a visual development tool
    for all my tables.
    I do all my coding from within CVI and Measurement Studio for Visual C++
    6.0.  I'd use CVI for everything if I didn't depend so heavily on certain
    outside controlled C++ .dll's.  Could you please suggest then what I can
    do to get Excel support for Visual C++ 6.0?
    Last question :
    Is there any plan to ever have a NI table control like the CVI table control for
    use in Visual Studio?  One that you can
    completely set up before you do any compiling? 
    I imagine that the way Microsoft sets up their environment makes this idea impossible.  Otherwise someone would
    have come up with a truly “visual” table control before now.
    Thanks,
    Grant
    Grant M. Johnson
    Project Engineer
    LECO Corporation

    Hello Grant
    You can most certainly use Excel with VC++ 6.0. Measurement Studio won't provided you with any classes to talk to Excel in VC++ 6.0. This is because Excel allows control via Automation and you can use its automation API to do anything you need with Excel. This is what CVI uses as well.
    You can see this MSDN article on how to set this up. This mentions VC.NET, but it should work the same way.
    Here is one that talks about VC 6.0 and Excel.
    Here is a code project article about this.
    Even with .NET, you have to do thru the Excel Automation support. Excel started shipping with Primary Interop Assemblies (PIA) which are .NET wrappers about the Excel Automation object model. C++ Automation is definetely not as nice as .NET, BTW
    See this document for more information about the Excel object model.
    I would not recommend using the CVI Excel libraries if all you want to use them for is Excel automation. You will end up creating un-necessary dependencies and go through extra layers that way. You can make calls straight to Excel from VC++ without requiring CVI.
    One quick observation about your excel approach. If you decide to use Excel as your table, you might be requiring everyone who uses your application to have Excel installed on their machines. Just wanted to make sure this was acceptable to you.
    Have you looked at the Datagrid Activex control, which is one of the common controls that ships with Visual Studio? You can add it to Visual Studio by right-clicking and picking it from the list of installed activex control. If you have not already, you should check it out.
    Microsoft has made significant improvements in the number of controls they provide with .NET. They have a Datagrid control that seems to be what you need.
    Measurement Studio did add some high level classes for Excel and Word Automation that simplify some common tasks, but these exists for VS 2003 C++ and VS 2005 C++, not for VC 6.0. Underneath, we end up using the same Excel automation classes, so you can easily setup something similar for VC 6.0. Plus you can find alot of references online on how to use the Excel Automation object model with C++.
    We currently have no plans in Measurement Studio to create a table control unfortunately. I am assuming when you said graph, you actually meant table, since Measurement Studio already  provides a ActiveX graph controls for VC++ 6.0 that is very similar to the CVI graph.
    On a side note, VC++ 6.0 is really really old. Have you considered upgrading?
    To summarize
    - Yes, you can use Excel with Vc++ 6.0 without mstudio.
    - Try using the Datagrid Activex control if you just need a table.
    - Measurement Studio provides high-level excel and word classes for VC++ 6.0
    - Measurement Studio provides a graph control for VC++ 6.0 which is very similar to the CVI graph.
    - Measuremnt Studio does not have a table control.
    - VC++ 6.0 is really really old. Have you considered upgrading?
    Bilal Durrani
    NI

  • Visual Studio or LabWindows/CVI?

    I have a bit of a dilemma.
    I currently own Visual Studio 2010, IMAQ Vision Development Module 2013, and Measurement Studio (not sure of version). I currently do all of my programming in VB.net. Because IMAQ VDM is stuck in .Net framework 3.5 and there will be no further .net development by NI, I need to plan for the future. My applications need run on Win 8, 9, 43, or whatever my company decides to migrate to from Win 7.
    My understanding is that the NI modules I currently own will work with LabWindows/CVI. Correct? I also believe I can use them with C++ using the VS IDE. Is this also correct?
    Within my applications I do a lot of interfacing with Excel, writing text files, and interfacing to non-NI devices (cameras, DAQs, scanners, etc). I am able to do these things pretty easily using VB.net using vendor-provided SDK's.
    Therefore, my question is this...given the investment I have in software already, do I gain anything by migrating to LabWindows/CVI? What do I lose?
    I should point out that regardless of the path I choose I will need to bone up on my programming skills in the corresponding language.
    Thanks for all your help!

    Hello Steverino!
    Here are some advantages when using LabWindows/CVI over Visual Studio, which make the product more suitable for various industry-related applications:
    You are correct, LabWindows/CVI integrates with the NI platform: NI hardware and software, like TestStand or LabVIEW (e.g. debugging source code from one software to another, seamlessly).
    NI hardware and third-party hardware connectivity.
    OpenMP support.
    CVI integrates with intrument control.
    CVI Run-Time benefits from User Protection.
    Run-Time checking (e.g. for uninitialized variables).
    Scientific User Interface Controls and GUI Editor.
    Advanced debugging capabilities:
    Remote debugging support from ADE.
    Real-Time debugging support from ADE.
    Memory leak detection using the LabWindows/CVI Resource Tracking Window.
    Just-In-Time debugging.
    Deployment: build custom installers and patches that you can ship as stand-alone easy-to-use installers.
    LabWindows/CVI libraries: Advanced Analysis, Toolbox, Connectivity (Network Variables, Network Streams, DataSocket), etc.
    Support for LabWindows/CVI Toolkits: SQL Toolkit, Vision, PID, RT.
    Regards,
    - Johannes.

  • Problem with timers in a udp state pattern

    Hi.
    As a project on my school, i have created a bomberman game, that supports up to 4 players on a network. And it works fine, when there is no network timers involved, that means no packet loss handling.
    The network part of the game, is build up by UDP, to make the application support multicast. The game session flow, is build up by states which are designed like an extended 2 phase commit pattern.
    That means, the server sends Gameinfo to the clients. Then all the cliens replies with an ACK.
    The server then sends ExecuteGameinfo. Then the clients replies with an ACK.
    The server sends/requests playerinfo, and the clients reply with player info. (the server uses the player info to create gameinfo).
    These 3 states, continues to go on, as long as the game is running. And without timers, it is working great.
    But what if a packet is lost? (on a LAN, packetloss is very rare, but for the sake of my project�s issue, custom made reliability in UDP, I have to face the problem). Then the server would just hang, and wait for the client reply.
    To avoid that, i want to use a timer. If the server havent got any reply for like a 100 ms., the server should resend the package.
    And now to the actual problem :)
    Ive tried using java.util.Timer, and javax.swing.Timer. But both timers does not work in my case. Its like:
    Server starts timer.
    Server sends Gameinfo.
    100 ms passes.
    Server resends Gameinfo.
    Server restarts timer.
    100 ms passes.
    (this goes on for 5 times, and then the client is kicked)
    Server receives ACK.
    Server receives ACK.
    Server receives ACK.
    Server receives ACK.
    Server receives ACK.
    On the client side it looks like this:
    Recieves Gameinfo, replies with ACK
    Recieves Gameinfo, replies with ACK
    x 5
    So its like the server is to concentrated on that timer (even though it runs as a thread), so i doesent notice the incoming packets, that eventually stacks up, and is handled after the timer tasks are done.
    And this is exactly the problem that is described in the Timer api: " Timer tasks should complete quickly. If a timer task takes excessive time to complete, it "hogs" the timer's task execution thread. This can, in turn, delay the execution of subsequent tasks, which may "bunch up" and execute in rapid succession when (and if) the offending task finally completes."
    Ive tried using a homemade timer, with a Thread.sleep(), it is a bit better, but the problem is the same. 1 out of 20 incoming packets, is "ignored" by the server.
    I really hope any of you can help.
    I havent included any code, it would be to much code. But if you are interested in looking at something i can easily paste it.
    Thank you very much for your time :)
    Regards.

    Don't use a Timer, use DatagramSocket.setSoTimeout(). Then your receives will only block for that amount of time, throwing SocketTimeoutException if no datagram arrives.

  • How can I create an application in MSVC 6.0 to access my FieldPoint modules with CVI 5.0 libraries?

    I have an application in CVI 5.0 that works. I am trying to export that so I can develop in MSVC. I need none of the UI provided in CVI, all I need are the simple FieldPoint commands provided in FieldPoint.obj. I have been stumped on this for weeks. I would write my own OPC client but the interface isn't even documented on what commands I would send if I did have an interface. I would prefer just to use the CVI libraries in MSVC 6.0. When I call the FP_Open function the program crashes with an RtlSizeHeap error.
    Thanks,
    Chad

    In theory, creating a dll that encapsulates the FieldPoint functions should work in MSVC. However, National Instruments has not tested MSVC interface, nor have we publicized that this type of setup will work, therefore making support unavailable. The other reason for why we do not offer support of FieldPoint in MSVC is that we have not seen a demand for such an interface. Therefore, I recommend that you create an OPC Client that communicates with the FieldPoint OPC Server. One example of such an OPC Client in MSVC is to use Datasockets, found in ComponentWorks++. You can find this example at the following web site:
    http://zone.ni.com/devzone/devzoneweb.nsf/opendoc?openagent&8FEAB5F73CFB68278625683A000B06ED&cat=7CDA3E51FEFC4AA2862568B80071A1E2
    If you are using the
    serial network module (FP-1000/1001), you can communicate with the FieldPoint modules using the Optomux protocol. For a complete listing of the Optomux commands refer to the FP-1000/1001 Programer Reference Manual located at the following web site:
    http://digital.ni.com/manuals.nsf/caba5d53e9b015a186256793004eebb7/bf97516ca18eee728625665e0063594e?OpenDocument
    Best Regards,
    JohnM

  • Software Development Engineer positions at Hysitron, Inc. in Minneapolis (LabWindows CVI exp preferred)

    Software Development Engineer
    Hysitron, Inc. is a premier scientific instrument manufacturer. Founded in 1992 with headquarters located in Eden Prairie, MN we are committed to promoting nanotechnology by developing advanced transducer and control technology. This leadership has made Hysitron the world leader in nanomechanical test instruments. The TriboIndenter®, TriboScope®, Ubi, and other Hysitron innovations have opened new horizons for scientists interested in investigating and understanding mechanical properties of materials at nano-scale. Hysitron fosters an environment and culture where innovation flourishes, teamwork is encouraged, and superior performance is rewarded.
    Hysitron invites applications for multiple software development engineer positions from those aspiring to explore and succeed in the nano world. Hysitron, Inc. is an Equal Opportunity Employer M/F/D/V
    Job responsibilities
    The software development engineers would be responsible for developing test and measurement software applications for nano-mechanical testing instrumentation. Job deliverables would include:
    -          Develop software applications in C based Labwindows CVI for Hysitron Instrumentation
    -          Support the development of applications to address challenges in instrument automation and control
    -          Test software applications using debugging and simulation tools
    -          Perform software releases and software quality assurance activities
    -          Participate in the design of new software products
    -          Perform maintenance activities for existing products
    -          Adapt and deliver on quality software development practices
    Minimum qualifications
    -          BS in Computer Science/ Computer Engineering/ Equivalent Scientific or engineering discipline
    -          Min of 3 yrs experience in Instrumentation software development in an industrial or R&D environment
    -          Expert at programming language C, knowledge of C++
    -          Working knowledge of various communication protocols, e.g. USB, RS232, IEEE, RS485, TCP/IP, Modbus
    -          Knowledge of general software design/documentation processes in test and measurement systems
    -          Proficient problem solving skills
    -          Strong analytical and technical skills
    -          Excellent communication and interpersonal skills
    Preferred Qualifications
    -          Proficient with LabWindows CVI and XML
    -          Working experience with DSP(Code Composer Studio) and/or FPGA level programming
    -          Exposure to digital electronics and instrumentation
    -          Working experience in Robotics interface programming
    -          Experience with Controls/Automation engineering
    Application and Information
    Qualified candidates should send a letter of application and their resumes to (please include ‘SW Engineer’ in subject line):
    Hysitron, Inc.
    10025 Valley View Rd
    Eden Prairie, MN 55344 USA
    Phone: (952) 835-6366
    Fax: (952) 835-6166
    E-MAIL: [email protected]
    Web: www.hysitron.com

    This position is still accepting resumes/CVs.

  • 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...

Maybe you are looking for

  • Using Bank Statement in Excel format for Electronic Bank Statement

    Hello Gurus, I have asked my bank for bank statement in the following formats MT940, SWIFT MT942, Multicash, BAI and BAI2 but they seem not to understand me and have not been able to provide that. I have been able to get the bank statement in Excel f

  • Bootcamp Installation Questions

    Hey everyone! Yesterday i just purchased a retina display macbook pro, im wanting to install windows but there are two things im unsure of. What copy of windows do i need to get? the full? upgrade? would this be it? http://www.microsoftstore.com/stor

  • Static fields in serialized Vector objects

    just a curious question: If I have a Vector filled with Objects of all the same type, and the Object contains a static field, and I then Serialize the Vector, will it still give better performance than if the field wasn't static? Thanks, Max

  • Where is the frame counter in iMovie 10?

    I cannot find the frame counter in the newest version of imovie. My froend who has version 9 has a frame counter. How can I find it in imovie 10? Thank you

  • Access Denied when saving file - CS5 & Win7

    Using Dreamweaver CS5 and Win7...  Sporatically, I will try to save my .html file and will get an error saying "access denied" to the .tmp file.  So I do a "Save As" to another file name and then the original file literally disappears (is deleted / e