06-07-2013 06:52 PM - edited 06-07-2013 06:56 PM
Hi! I need help with my program.
The code was programmed for an old DAQ. Its short and basic, but i need to change it since now i have to use a new DAQ(MyDAQ), which uses a new library "mydaqmx".
Could someone help me?
void sleep (clock_t wait);
int main(int argc, char **argv)
{
int i=0;
i16 device = 1; i16 port = 0;
i16 line; i16 state;
if (argc > 1) {
char *a = argv[1];
if (!strcmp(a, "lavadora"))
line = 0;
else if (!strcmp(a, "television"))
line = 1;
else if (!strcmp(a, "luz"))
line = 2;
else
printf("\nOnly args lavadora, television & luz are allowed!");
state = DIG_Prt_Config(device, port, 0, 1);
if (state != 0)
{
puts("ERROR"); return -1;
}
printf("%s: %d\n", a, line);
for (i = 0; i< 65536; i++) {
DIG_Out_Line(device, port, line, 1);
sleep((long)0.25);
}
DIG_Out_Line(device, port, line, 0);
} else {
printf("Usage: %s [lavadora|television|luz]\n", argv[0]);
exit(-1);
}
return 1;
}
void sleep(clock_t wait)
{
clock_t goal;
goal = wait + clock();
while(goal > clock());
}
06-16-2013 05:49 AM
Hey, I would like to learn how to program it with nidaqmx.I want to light some LEDs based on an argument that the C program receives.