Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting Traditional Daq code to DAQmx

Hi,

 

I am trying to convert the following code to DAQmx and have a question. I am using the DAQmxCreateCIAngEncoderChan(taskHandle,"Dev1/ctr5","",DAQmx_Val_X4,0,0.0,DAQmx_Val_AHighBHigh,DAQmx_Val_Degrees,1,0.0,""));

function call and everything seems to work, except the range of values is different than the previous code. If I change the pulsesPerRev value I can get it to be closer to what the previous code was like. Is this correct, or should I be using a different function call?

 

 

--Previous Code--

GPCTR_Control(handle, COUNTER_X, ND_RESET);Set_DAQ_Device_Info(handle, SensorData[i].DataXfer, ND_INTERRUPTS);

 

GPCTR_Set_Application(handle, COUNTER_X, ND_BUFFERED_POSITION_MSR); 

 

GPCTR_Change_Parameter(handle, COUNTER_X, ND_ENCODER_TYPE,ND_QUADRATURE_ENCODER_X4);

 

GPCTR_Change_Parameter(handle, COUNTER_X, ND_Z_INDEX_ACTIVE, ND_NO);

 

GPCTR_Change_Parameter(handle, COUNTER_X, ND_BUFFER_MODE, ND_SINGLE);

 

GPCTR_Config_Buffer(handle, COUNTER_X, 0, ulNumPtsToRead, DataPoints_buffer);

 

GPCTR_Change_Parameter(handle, COUNTER_X, ND_GATE, ND_RTSI_0);

 

 

 

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

Hi Sledstorm25,

 

Is this C, C++, or C# code? If so have you tried looking at the NI-DAQmx C Reference help. You can find it by going to Start>All Programs>National Instruments>NI-DAQ>Text-Based Code Support>NI DAQmx C Reference help. This resource can be very useful and list the various parameters for functions such as DAQmxCreateCIAngEncoderChan. Let me know if this helps.

 

Regards,

 

Josh Brown

Applications Engineer
National Instruments
0 Kudos
Message 2 of 3
(2,740 Views)

Thanks for the reply Josh. It is C++ code. I have been using the NI-DAQmx C Reference help which is pretty useful. I think I may have figured out the problem. Instead of using DAQmx_Val_Degrees, I switched it to DAQmx_Val_Ticks. Now the results seem to match what the previous code

gave me.

 

Thanks again for your help.

0 Kudos
Message 3 of 3
(2,669 Views)