Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with DAQ_Op in Traditional NIDAQ

This system should be fixed so that you do not have to enter the same information in before and after you log on!!!!

I am getting unusual results from the attached code in Labwindows cvi 7.1 using Traditional NI-DAQ with an AT-MIO-16E card. If I read the voltages one at a time using AI_Read (1, 0, 1, &bpoint); the results are as expected. However, if I read into an array using DAQ_Op (1, 0, 1, bdata, 100, 100.0); The values are much larger and go negative and positive. A program that ran fine under CVI 4.1, NIDAQ 6.8, and win 95 on the same machine ran fine, now it reads the wrong values.

John Bernard




#include
#include
#include
#include "DAQtest.h"
int mainhandle,i;
double vdata[1000],volt;
short bdata[1000], boardcode, bpoint;

/*======================== MAIN PROGRAM ======================================================*/
main()
{
mainhandle = LoadPanel (0, "DAQtest.uir", PANEL);
Init_DA_Brds (1, &boardcode);
DisplayPanel(mainhandle);
RunUserInterface();
}



int CVICALLBACK QuitCallback (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event) {
case EVENT_COMMIT:
QuitUserInterface (0);
break;
case EVENT_RIGHT_CLICK:

break;
}
return 0;
}

int CVICALLBACK Start (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
short bpoint;
switch (event) {
case EVENT_COMMIT:
for(i=0;i100;i++){
AI_Read (1, 0, 1, &bpoint);
AI_VScale (1, 0, 1, 1.0, 0.0, bpoint, &volt);
// AI_VRead (1, 0, 1, &volt);
vdata[i]=volt;
bdata[i]=bpoint;
Delay(0.01);
}


// DAQ_Op (1, 0, 1, bdata, 100, 100.0);
// DAQ_VScale (1, 0, 10, 1.0, 0.0, 100, bdata, vdata);
// YGraphPopup ("Input Voltage", vdata, 100, VAL_DOUBLE);
YGraphPopup ("Input Voltage", bdata, 100, VAL_SHORT_INTEGER);

break;
case EVENT_RIGHT_CLICK:

break;
}
return 0;
}
0 Kudos
Message 1 of 3
(2,810 Views)
John,
Couple quick tests:

1. Can you run this example? It basically uses the same functions:
http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B45EACE3D9B156A4E034080020E74861&p_node=DZ52306&p_source=External

2. Which NI-DAQ driver are you using?

Also, have you thought about programming in DAQmx instead of Traditional DAQ? I can guarantee from personal experience that it is far easier and more efficient to program in NI-DAQmx.

Regards,
Anuj
0 Kudos
Message 2 of 3
(2,785 Views)
Also, what do you mean by
"This system should be fixed so that you do not have to enter the same information in before and after you log on!!!!"

Anuj D.
0 Kudos
Message 3 of 3
(2,784 Views)