09-06-2011 01:44 PM
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);
09-08-2011 03:15 PM
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
09-09-2011 08:06 AM
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.