LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Counter in tristate

Solved!
Go to solution

Hello,

I am using a counter on NI-6351 namely PFI13 which outputs a certain frequency. It works fine as I am able to start and stop the task.

 

My question is how to bring this channel in high impedence state (hochohmig). I try to do it by calling the function DAQmxTristateOutputTerm("Dev1\ctr1"), but it returns me an error code: -89129 and "Terminal for the device is invalid" as respective error message.

 

Any clue why I can not perform this function?

 

Regards

RB

0 Kudos
Message 1 of 11
(4,689 Views)

Hi RB,

 

I found a similar thread on the forum. the solution discussed there could maybe help you:

 

http://forums.ni.com/t5/Digital-I-O/PCIe-6537-signal-routing/m-p/575621?requireLogin=False

 

Regards 

______________
Florian Abry
Inside Sales Engineer, NI Germany
0 Kudos
Message 2 of 11
(4,687 Views)

Alternatively, what happens if you use the function DAQmxResetDevice ?

______________
Florian Abry
Inside Sales Engineer, NI Germany
0 Kudos
Message 3 of 11
(4,684 Views)

I saw the thread but I am not doing any signal routing. Reseting the device is not an option for me as its digital ports are driving another device.

 

I am using the following code (ignore syntax):

 

Actually I have 2 problems:

1. I have to keep the task running till I need aFrequency at the ctr1

2. DAQmxTristateOutputTerm throws the error that I mentioed earlier.

 

/* For Starting task. This outputs aFrequency at PFI13 */
aPFIPortName = "Dev2/ctr1";
DAQmxCreateTask("", &g_FreqTaskHandle);
DAQmxCreateCOPulseChanFreq(g_FreqTaskHandle, aPFIPortName,"",DAQmx_Val_Hz, DAQmx_Val_High, 0.0, aFrequency, aDutyCycle);
DAQmxCfgImplicitTiming(g_FreqTaskHandle,DAQmx_Val_ContSamps, 1000);
DAQmxStartTask(g_FreqTaskHandle); 

/* For Stopping task. This stops aFrequency at PFI13 and sets it to DAQmx_Val_High */
if(g_FreqTaskHandle)
{
	DAQmxStopTask(g_FreqTaskHandle);
	DAQmxClearTask(g_FreqTaskHandle);
	g_FreqTaskHandle = 0;
}

/* For setting aPFIPortName in High impedance state */
DAQmxTristateOutputTerm(aPFIPortName);
0 Kudos
Message 4 of 11
(4,674 Views)

Hi RB,

 

I am not sure I understand the goal you are trying to achieve. Waht I understood is that you want to use a PFI port for pulse generation until a time T where the generation should stop and you want to start a measurment task on the same port, this without having to reset the device. Is it correct?

 

bers regards 

______________
Florian Abry
Inside Sales Engineer, NI Germany
Message 5 of 11
(4,651 Views)

Parially correct. I have a test point (a wire) coming out of my device. I can either measure voltage at this test-point(using AI port) or I can input a noise signal at this point (using PFI port). So I have connected my testpoint to PFI port and AI port as well.

 

In one of my test cases, I create noise signal at this port and observe device behaviour. Now I have to run another test case I measure Volts at the test point, without manually disconnecting the test-point from PFI port. For this purpose it is very important for me that PFI port goes into high impedance mode.

0 Kudos
Message 6 of 11
(4,648 Views)
Solution
Accepted by dotNet_to_LabW

I could not find a lot of information on this toppic on our internal DB.

 

However I found a DO property that allow you to set a digital line in Tristate. First question would be:

* What happen if you modify your code that way:

/* For setting aPFIPortName in High impedance state */
aPFIPortName = "Dev1/port2/line5";   // PFI13 and P2.5 are the same line
DAQmxTristateOutputTerm(aPFIPortName);

 as the tristate property are only for digital lines, adressing the port by his line name could maybe help.

 

* The second idea would be to commit a dummy digital task to set the digital out tristate property to TRUE. The syntax is the following:

DAQmxSetChanAttribute (taskHandle, "Dev1/port2/line5", DAQmx_DO_Tristate, 1); 

 

 I hope this is of some help for you.

 

Best regards

______________
Florian Abry
Inside Sales Engineer, NI Germany
Message 7 of 11
(4,639 Views)

Hi,

 

Thanks for replying so soon. I appreciate it.

 

I liked the second idea and implemented it after stopping and clearing my frequency task with the following code. I declared a channel P2.5 as a DI channel in MAX. But I am still not getting the High impedance on the channel after stopping my dummy task. Any idea what I am doing wrong?

DAQmxCreateTask("", &g_TaskHandle); 
DAQmxAddGlobalChansToTask(g_TaskHandle, "TriState"); 
DAQmxSetChanAttribute (g_TaskHandle, "TriState", DAQmx_DO_Tristate, 1);
DAQmxStartTask(g_TaskHandle); 
DAQmxStopTask(g_TaskHandle);
DAQmxClearTask(g_TaskHandle);
g_TaskHandle = 0;    

 

0 Kudos
Message 8 of 11
(4,634 Views)

Sorry, got the error. Was using wrong handle.

 

Many thanks, from my team mates too 🙂

0 Kudos
Message 9 of 11
(4,630 Views)

You're welcome. Good luck for the development.

______________
Florian Abry
Inside Sales Engineer, NI Germany
0 Kudos
Message 10 of 11
(4,622 Views)