Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

use of Select Signal ND_PFI_2, Convert when pin is disconnected 6030E series

I am converting Traditional NiDaq code to DaqMX. This is not my original code and the original programmer is no longer around.

The following code is used without any wiring connected to pin 43 on 6030E series:

 

Select_Signal(m_sDeviceNumber, ND_PFI_2,ND_IN_CONVERT,ND_HIGH_TO_LOW)

Any idea what this does when no wiring is connected to pin 43 (PFI 2/AI CONV CLK)?

 

and...if you have time, what does each function call in the follwowing code do?

 

if ((nStatus = GPCTR_Control(m_sDeviceNumber,ND_COUNTER_1,
			ND_RESET)) != 0)
		{
			sprintf(szErrorMessage,"AT-MIO-16X GPCTR_Control error, %d.",nStatus);
			AfxMessageBox(szErrorMessage, MB_OK | MB_ICONSTOP ); 
 			return FALSE;
		}

		if ((nStatus = GPCTR_Set_Application(m_sDeviceNumber,ND_COUNTER_1,
			ND_PULSE_TRAIN_GNR)) != 0)
		{
			sprintf(szErrorMessage,"AT-MIO-16X GPCTR_Set_Application error, %d.",nStatus);
			AfxMessageBox(szErrorMessage, MB_OK | MB_ICONSTOP ); 
			return FALSE;
		}

		if ((nStatus = GPCTR_Change_Parameter(m_sDeviceNumber,ND_COUNTER_1,
			ND_COUNT_1,(m_dwCount - m_nNumberChannel))) != 0)
		{
			sprintf(szErrorMessage,"AT-MIO-16X GPCTR_Change_Parameter error, %d.",nStatus);
			AfxMessageBox(szErrorMessage, MB_OK | MB_ICONSTOP ); 
			return FALSE;
		}

		if ((nStatus = GPCTR_Change_Parameter(m_sDeviceNumber,ND_COUNTER_1,
			ND_COUNT_2,m_nNumberChannel)) != 0) 
		{
			sprintf(szErrorMessage,"AT-MIO-16X GPCTR_Change_Parameter error, %d.",nStatus);
			AfxMessageBox(szErrorMessage, MB_OK | MB_ICONSTOP ); 
			return FALSE;
		}
//
		if ((nStatus = GPCTR_Change_Parameter(m_sDeviceNumber,ND_COUNTER_1,
			ND_SOURCE,ND_PFI_2)) != 0)
		{
			sprintf(szErrorMessage,"AT-MIO-16X GPCTR_Change_Parameter error, %d.",nStatus);
			AfxMessageBox(szErrorMessage, MB_OK | MB_ICONSTOP ); 
			return FALSE;
		}

		if ((nStatus = GPCTR_Change_Parameter(m_sDeviceNumber,ND_COUNTER_1,
			ND_OUTPUT_POLARITY,ND_NEGATIVE)) != 0)
		{
			sprintf(szErrorMessage,"AT-MIO-16X GPCTR_Change_Parameter error, %d.",nStatus);
			AfxMessageBox(szErrorMessage, MB_OK | MB_ICONSTOP ); 
			return FALSE;
		}

		if ((nStatus = Select_Signal(m_sDeviceNumber,
			ND_PFI_2,ND_IN_CONVERT,ND_HIGH_TO_LOW)) != 0)
		{
			sprintf(szErrorMessage,"AT-MIO-16X GPCTR_Select_Signal error, %d.",nStatus);
			AfxMessageBox(szErrorMessage, MB_OK | MB_ICONSTOP ); 
			return FALSE;
		}

		if ((nStatus = Select_Signal(m_sDeviceNumber,
			ND_GPCTR1_OUTPUT,ND_GPCTR1_OUTPUT,ND_LOW_TO_HIGH)) != 0)
		{
			sprintf(szErrorMessage,"AT-MIO-16X GPCTR_Select_Signal error, %d.",nStatus);
			AfxMessageBox(szErrorMessage, MB_OK | MB_ICONSTOP ); 
			return FALSE;
		}

		if ((nStatus = GPCTR_Control(m_sDeviceNumber,ND_COUNTER_1,ND_PROGRAM)) != 0)
		{
			sprintf(szErrorMessage,"AT-MIO-16X GPCTR_Control error, %d.",nStatus);
			AfxMessageBox(szErrorMessage, MB_OK | MB_ICONSTOP ); 
			return FALSE;
		}

 

Thanks fro your help

0 Kudos
Message 1 of 3
(4,027 Views)

I would take a look at this forum thread: http://forums.ni.com/t5/Multifunction-DAQ/Porting-strategy-NIDAQ-application-to-NIDAQmx/td-p/699894

 

Tdaq is really old and documentation for it is hard to come by.  I would read over that thread for ideas about how the functions work.  There is usually a 1-1 function in DAQmx so as long as you find the analogous function conversion shouldn't be too bad.

0 Kudos
Message 2 of 3
(4,007 Views)

Thanks for your help.

I have looked over that page before. I will look again with a little more gusto!

0 Kudos
Message 3 of 3
(3,853 Views)