LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

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

       

0 Kudos
Message 1 of 13
(5,187 Views)

Sorry for answering in English...

 

If you want the two timers run in parallel, why don't you use just one? (UI timer callbacks in CVI are called sequentially)

0 Kudos
Message 2 of 13
(5,176 Views)

parce que les données à dessiner varient au cours de temps j'aimerais que l'affichage ne soit pas interrompu et au fur et à mesure on fait la mise à jour

0 Kudos
Message 3 of 13
(5,172 Views)

You can synchronize all UI timers running on a panel (with the same interval) using ResetTimer ( panel_handle, 0 );

0 Kudos
Message 4 of 13
(5,162 Views)

la mise a jour de la structure se fait chaque Heure et l'affichage se fait tout le temps

0 Kudos
Message 5 of 13
(5,159 Views)

@FENM wrote:

la mise a jour de la structure se fait chaque Heure et l'affichage se fait tout le temps


I am afraid I did not understand your comment - this is what you want to have or what you have now?

0 Kudos
Message 6 of 13
(5,127 Views)

...if you would prefer answers in french you might want to try in the francophone forum here

0 Kudos
Message 7 of 13
(5,125 Views)

Right Now i have two UI timers, each one have a different interval but i want to run the both  in parallel 

0 Kudos
Message 8 of 13
(5,123 Views)

If by parallel you mean in two separate threads then you can use asynchronous timers or multithreading and start reading, e.g., here, here or here

0 Kudos
Message 9 of 13
(5,112 Views)

Thx  ,

 

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" ???

 

0 Kudos
Message 10 of 13
(4,987 Views)