Salut à tous,
alors voilà, je cherche à reprendre les valeurs en Volts qui sortent de plusieurs sorties comme par exemple Dev1/ai0 et Dev1/ai5.
J'ai fait un programme qui affiche correctement sur graphique ces différentes tensions mais je voudrais aussi les récupérer dans un tableau.
Le souci c'est que, lors de l'appel de la fonction DAQmxReadAnalogF64, il n'enregistre que les valeurs du Dev1/ai0 et pas ceux de Dev1/ai5 quand je fais un printf.
Voici mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include <cvirte.h>
#include <userint.h>
#include "TroisiemeProjet.h"
#include <ansi_c.h>
#include <NIDAQmx.h>

#define DAQmxErrChk(functionCall) {DAQmxError = (functionCall); {if (DAQmxError < 0){goto Error;}}}

static int panelHandle;
static int gRunning;

int main (int argc, char *argv[])
{
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
if ((panelHandle = LoadPanel (0, "TroisiemeProjet.uir", PANEL)) < 0)
return -1;
DisplayPanel (panelHandle);
RunUserInterface ();
DiscardPanel (panelHandle);
return 0;
}

int CVICALLBACK AcquirePROG (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:

int32 DAQmxError = DAQmxSuccess;
TaskHandle taskOut;
int32 numRead;
float64 *data=NULL;

DAQmxErrChk(DAQmxCreateTask("", &taskOut));

DAQmxErrChk(DAQmxCreateAIVoltageChan(taskOut, "Dev1/ai0", "Tension",DAQmx_Val_RSE, -5, 5, DAQmx_Val_Volts, ""));

DAQmxErrChk(DAQmxCreateAIVoltageChan(taskOut, "Dev1/ai5", "Tension0",DAQmx_Val_RSE, -5, 5, DAQmx_Val_Volts, "")); //

DAQmxErrChk(DAQmxCreateAIVoltageChan(taskOut, "Dev1/ai1", "Tension1",DAQmx_Val_RSE, -5, 5, DAQmx_Val_Volts, ""));

DAQmxErrChk(DAQmxCfgSampClkTiming (taskOut, "", 10, DAQmx_Val_Rising, DAQmx_Val_ContSamps, 1000));

SetCtrlAttribute(panel,PANEL_STRIPCHART,ATTR_NUM_TRACES,3);

DAQmxErrChk (DAQmxStartTask(taskOut));

data=malloc(60*sizeof(float64));
gRunning = 1;

while( gRunning ) {
ProcessSystemEvents();
DAQmxErrChk (DAQmxReadAnalogF64 (taskOut, 20, 10.0, DAQmx_Val_GroupByScanNumber, data, 60,
&numRead, NULL));
if( numRead>0 ) PlotStripChart(panel,PANEL_STRIPCHART,data,20,0,0,VAL_DOUBLE);
printf("val : %lf", *data); // ICI quand je fais le printf il ne reprend que les données du Dev1/ai0.

}

Error:
return 0;


break;
}
return 0;
}
int CVICALLBACK StopProg(int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
{
if( event==EVENT_COMMIT )
gRunning = 0;
return 0;
}

int CVICALLBACK QuitPROG (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
QuitUserInterface (0);
break;
}
return 0;
}
Si vous pouviez m'aider ce serait super, et si par hasard vous avez une idée pour mettre ces valeures dans un tableau avec une colonne par channel ce serait encore mieux.

Merci beaucoup à tous

Sausage