Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Nidaq code to Nidaqmx (mydaqmx)

Hi! I need help with my program.Smiley Sad

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?Cat Happy

 

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());
}

 

0 Kudos
Message 1 of 2
(3,032 Views)

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.

0 Kudos
Message 2 of 2
(2,964 Views)