07-03-2012 04:17 AM
Hello,
I need to create a small driver for DIO96 card that turn on or turn off one line every time.
For example:
--------------------------------------------------------------------------------
int USB_DIO96_SetSwitch1(int Port, int Line, int State)
{
TaskHandle NI_6509_Handle;
unsigned char Value[2];
char sLines [100];
Value[0] = State;
sprintf(sLines,"%s/port%d/Line%d","Dev1",Port,Line);
DAQmxCreateTask ("",&NI_6509_Handle);
DAQmxCreateDOChan (NI_6509_Handle, sLines, "", DAQmx_Val_ChanPerLine);
DAQmxWriteDigitalLines (NI_6509_Handle, 1, 1, 10.0, DAQmx_Val_GroupByChannel, Value, NULL, NULL);
DAQmxClearTask (NI_6509_Handle);
return 1;
}
Every time when i call this function with different port and line, the card reset previous line state.
How can I solve this problem and to support my old projects.
07-06-2012 06:23 PM
Hello 568,
What do you have in the sLines variable?
07-07-2012 01:54 PM
Hello,
When i call USB_DIO96_SetSwitch1(0, 1, 1) rhe sLine = "Dev1/port0/line1";
I think is not a problem.
The problem is: For example :
First call> USB_DIO96_SetSwitch1(0, 1, 1) - The line 1 in port 0 rise to 5v.
Now I call this function with different parameters USB_DIO96_SetSwitch1(0, 2, 1) - The line 2 in port 0 rise to 5v and line 1 in port 0 go down to 0.
By the way, If i call (first call > USB_DIO96_SetSwitch1(0, 1, 1)) again, the chenges on line 1 in port 0 douse not affect to on line 2 in port 0. He still 5v. It's heppend only first time.
I think the right way is to configure all the lines at start and then change the values. In my old application, i can not use this sequence. I must configure each line and set his value only at runtime.
Best Regard
Boris