VirtualBench

cancel
Showing results for 
Search instead for 
Did you mean: 

VB-8012 niVB_Dig_Initialize function usage

Solved!
Go to solution

Does using the below function configure digital line 6 as output or input ?

niVB_Dig_Initialize(niVB_LibraryHandle libraryHandle, "VB8012-3104586/dig/6", true, instrumentHandle);

 

Is my understanding correct that, the channel becomes available as input by default?

And if niVB_Dig_Write(..) is used to drive it, it gets configured as output?

 

 

0 Kudos
Message 1 of 6
(4,518 Views)

FYI: There is also a VirtualBench forum.

 

niVB_Dig_Initialize(...) with reset=true will configure lines as inputs (the default state). (With reset=false, the line direction will not be changed.)

niVB_Dig_Write(...) will configure the line as an output.

——
Brandon Streiff
ni.com/compactdaq · ni.com/daq
0 Kudos
Message 2 of 6
(4,503 Views)

Considering the below function call,

niVB_Dig_Initialize(niVB_LibraryHandle libraryHandle, "VB8012-3104586/dig/6", true, instrumentHandle); 

when reset is true, is only line 6 direction reconfigured as input or all the digital lines (0 through 7) get  reconfigured as input?

 

Also, what is expected to happen in the attached niVB_Dig_Example.c, where niVB_Dig_Initialize(..) function is used to initialize only the channels to be written with a true. 

niVB_ErrorCheck(niVB_Dig_Initialize(libHandle, channelsToWrite, /* reset: */ true, &digHandle));

0 Kudos
Message 3 of 6
(4,467 Views)

Considering the below function call,

niVB_Dig_Initialize(niVB_LibraryHandle libraryHandle, "VB8012-3104586/dig/6", true, instrumentHandle); 

when reset is true, is only line 6 direction reconfigured as input or all the digital lines (0 through 7) get  reconfigured as input?

 

Also, what is expected to happen in the attached niVB_Dig_Example.c, where niVB_Dig_Initialize(..) function is used to initialize only the channels to be written with a true. 

niVB_ErrorCheck(niVB_Dig_Initialize(libHandle, channelsToWrite, /* reset: */ true, &digHandle));

0 Kudos
Message 4 of 6
(4,466 Views)

Thank you Brandon. Considering the below function call,
niVB_Dig_Initialize(niVB_LibraryHandle libraryHandle, "VB8012-3104586/dig/6", true, instrumentHandle);
when reset is true, is only line 6 direction reconfigured as input or all the digital lines (0 through 7) get reconfigured as input?

 

Also, what is expected to happen in the attached niVB_Dig_Example.c, where niVB_Dig_Initialize(..) function is used to initialize only the channels to be written with a true.
niVB_ErrorCheck(niVB_Dig_Initialize(libHandle, channelsToWrite, /* reset: */ true, &digHandle));

0 Kudos
Message 5 of 6
(4,476 Views)
Solution
Accepted by topic author rushi_NaluMed

Only line 6 will be reconfigured. The other lines will be unchanged.

 

In the example you posted, niVB_Dig_Initialize will create a session to the instrument (saved in "digHandle"), and it will initialize the channels indicated by "channelsToWrite" to their default state (because the "reset" parameter is true), which will cause them to tristate (and be inputs). The return value of niVB_Dig_Initialize is then passed into niVB_ErrorCheck, which is just a helper macro that jumps to "Cleanup" on a fatal error.

——
Brandon Streiff
ni.com/compactdaq · ni.com/daq
0 Kudos
Message 6 of 6
(4,468 Views)