08-04-2008 10:28 PM
// 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
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;
08-07-2008 04:31 PM
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.
08-07-2008 09:38 PM
[*] Difference : kAI_Config_PolarityBipolar / kAI_Config_Channel_TypeDifferential
[*] Single : kAI_Config_PolarityBipolar / kAI_Config_Channel_TypeNRSE or kAI_Config_Channel_TypeRSE
ex1) Port0 + Port12ex2) Port0 + AIex3) Port12 + AIex4) Port0 + Port12 + AI
08-11-2008 04:56 PM
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-
08-26-2008 01:16 AM
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,
0,
0,
tMSeries::tAI_START_STOP_Select::kAI_START_SelectPulse,
tMSeries::tAI_START_STOP_Select::kAI_START_PolarityRising_Edge);
while aiex2.cpp defines as follow
u32 numberOfSamples = 100;
u32 numberOfChannels = 1;
u32 samplePeriodDivisor = 2000; // timebase/sample rate => 20 MHz / 10 kHz
aiSampleStart (board,
samplePeriodDivisor,
3,
tMSeries::tAI_START_STOP_Select::kAI_START_SelectSI_TC,
tMSeries::tAI_START_STOP_Select::kAI_START_PolarityRising_Edge);
[#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
08-26-2008 05:18 PM - edited 08-26-2008 05:20 PM
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.
10-30-2008 08:52 AM
Hi Tom
Recently my driver is under test..DIO block it works well,...no 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
10-31-2008 03:17 AM
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.
board->Gen_PWM[0].writeRegister(0);
board->Gen_PWM[1].writeRegister(0);
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
07-08-2018 09:22 AM
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
Xie