Driver Development Kit (DDK)

Showing results for 
Search instead for 
Did you mean: 

register guide for 6220, 6224

Go to solution
Hi Tom
Thanks for effective feedback.
aiConfigureChannel refer to ai.h  while aiGetScalingCoefficients refer to scale.h.
Consequently only one value (+/- 1V) is different for Ni6220/4.
 //     ai.h                
 // ---------------------------------
 //      +/- 10V   -> 0
 //      +/- 5V    -> 1
 //      +/- 1V    -> 4
 //      +/- 200mV -> 5
 // scale.h for scaling index values
 // ---------------------------------
 // intervalIdx
 //    0 -> +/- 10V
 //    1 -> +/- 5V
 //    2 -> +/- 2V
 //    3 -> +/- 1V
 //    4 -> +/- 500mV
 //    5 -> +/- 200mV
 //    6 -> +/- 100mV
Concerning Single/Difference type, my question is recommand me a proper macro for Single Type selection..
And are they need additional dependency of rest code ?
Just change two macros enough to switch from Differential to Single ?
typedef enum {
kAI_Config_Channel_TypeCalibration = 0,
kAI_Config_Channel_TypeDifferential = 1,
kAI_Config_Channel_TypeNRSE = 2,
kAI_Config_Channel_TypeRSE = 3,
kAI_Config_Channel_TypeAux = 5,
kAI_Config_Channel_TypeGhost = 7,
} tAI_Config_Channel_Type;
[1] Difference type : kAI_Config_PolarityBipolar / kAI_Config_Channel_TypeDifferential
[2] Single type        : kAI_Config_PolarityUnipolar / ???
Alwyas thanks
BR Kevin
0 Kudos
Message 21 of 29

Hi Kevin-

I assume by "single" you are referring to a single-ended input terminal configuration.  In order to make that change, you only need to change to ether kAI_Config_Channel_TypeNRSE or kAI_Config_Channel_TypeRSE.

M Series devices do not support unipolar input ranges, and setting polarity to kAI_Config_PolarityUnipolar may have undefined results.

Tom W
National Instruments
0 Kudos
Message 22 of 29
Thanks Tom.
Let me summary our discussion
[#1] Due to M series does not support unipolar input range, fix "kAI_Config_PolarityBipolar" always..right?
[*] Difference : kAI_Config_PolarityBipolar / kAI_Config_Channel_TypeDifferential
[*] Single      : kAI_Config_PolarityBipolar /
kAI_Config_Channel_TypeNRSE or kAI_Config_Channel_TypeRSE
[#2] What is different (meaning) btw kAI_Config_Channel_TypeNRSE and kAI_Config_Channel_TypeRSE ?
[#3] M series does not synch among Port0,12, AI.
       So it can't be operated as simultaneously.
       M series only working 3 kinds of job (Port0 / Port1.2 / AI) as respective (independent).
       Any combination of follow ex1~ex4 can not compatible.... right?
       ex1) Port0 + Port12  
       ex2) Port0 + AI
       ex3) Port12 + AI
       ex4) Port0 + Port12 + AI
Sincerelly Thanks for your support.
If you need my RTX driver, I can upload it to you.
BR Kevin
0 Kudos
Message 23 of 29

Hi Kevin-


#1- yes.

#2- the difference between NRSE and RSE is the return point (aka COM) for the measurement.  Check out this document, Table 1 for more information.

#3- it is not possible to synchronize port1 or port2 with any clock because they do not feature hardware-timed operation.  It is possible to synchronize AI and port0, or to control port0 by using an external clock.  But this mode is not supported in the MHDDK.  You can use AI, port0, port1, and port2 simultaneously using the methods shown in the MHDDK examples, but it is not possible to synchronize them all to the same clock.

Hopefully this clears everything up.  Good luck with your project-


Tom W
National Instruments
0 Kudos
Message 24 of 29

Hi Tom

Always thank for your support


Let me clear AI configuration dedicated to sampling method.

If user want to define sampling time or period , NI support aiSampleStart(....) ,... right?


Refer to aiex1.cpp just fixed it as "0".


    aiSampleStart (board,


while aiex2.cpp defines as follow


    u32 numberOfSamples     = 100;   
    u32 numberOfChannels    = 1; 
    u32 samplePeriodDivisor = 2000; // timebase/sample rate => 20 MHz / 10 kHz


    aiSampleStart (board,


[#1] what is the difference and is there any dependency other configuration?

[#2] How baout max value of sample and channel?

I'm very very interested in aiSamplingStart() if it is the key for user configutation of sampling.


Anticipate your reply...


BR Kevin

0 Kudos
Message 25 of 29
Accepted by topic author YG.Jeong

Hi Kevin-


Please see the Analog Input timing descriptions in the STC Technical Reference Manual for discussion on the meanings of timing parameters.  Number of samples is limited by the 32-bit sample counter on the board, unless you are in continuous mode in which case the sample count can be infinite.  The number of channels in the scanlist is limited to 4095.

Message Edited by Tom W [DE] on 08-26-2008 05:20 PM
Tom W
National Instruments
0 Kudos
Message 26 of 29

Hi Tom

Recently my driver is under test..DIO block it works well, issue.

But unfortunatly I found Analog Input issue. My RTX driver crash !!!


[#1] Register Init

As you can see my source code, I changed NI reference code as "C".

Within "Rtss_ai.c", you can see two APIs : AI_Config_Start_OnDemand(..) & AI_Config_Start_HwTimedAcq(..).

These are same as Aiex1.cpp & Aiex2.cpp.

But I skip register initialization due to initMite() did it.


Refer to Aiex1.cpp : test()  --> new tMSeries(bar1); --> _initialize(s); --> reset(s).

Above is init chain of NI sample. Is it mandatory procedure?

As I changed all C++ as C, I changed all Class as address based definition.

Please help me what should I do at register initial stage...



[#2] channel number

Rtss_ai.c is combination of Aiex1.cpp + Aiex2.cpp.

My code works till line num 1618 (Rtss_ai.c) but crash after jump in while loop.

Could you tell me important check point when use Aiex1(2).cpp ???

For example), monitor which register value ?

I'm really confused... Because I just followed Aiex1(2).cpp..


Anticipate your reply...


BR Kevin


Download All
0 Kudos
Message 27 of 29

Hi Tom


Refer to Aiex1.cpp, NI comment that "adcReset()" is only for 625X.
So I skip "adcReset()" due to I'm using NI622x.
That means it does not need to access "Static_AI_Control",... right?

"analogTriggerRest()" --declared in common.cpp - - used Gen_PWM as follow.
So I changed above as : 32bit write API.
 Rtx_pci_poked(addr+0x44, 0);
 Rtx_pci_poked(addr+0x44+0x2, 0);

Is it make sence ?


I'm just need your confirm when init register..


BR Kevin

0 Kudos
Message 28 of 29

Hello BR Kevin,

can you give me please the code for Rtx_pci_poke and Rtx_pci_peek. I can not found then anywhere.


Thank you



0 Kudos
Message 29 of 29