03-20-2012 10:31 AM
I have been reviewing the XSeries MHDDK documentation and examples as I figure out how I can use the X series PCIe-6351 to replace
the M series PCIe-6251 in our in-house control application. As a start, I use the example aiex2 for anaalog input test. Now the problem is:
After armed the AI subsystem
aiHelper.getInTimerHelper(status).armTiming(timingConfig, status);
It can't get the following condition met
if (device.AI.AI_Timer.Status_2_Register.readSC_Q_St(&status) == nInTimer::kSC_Counting)
The device.AI.AI_Timer.Status_2_Register.readSC_Q_St(&status) returns 1 and nInTimer::kSC_Counting is 5
Therefore the measurement can't be started.
Any ideas?
Thanks,
Larry
03-21-2012 10:12 AM
LarryL wrote:
The device.AI.AI_Timer.Status_2_Register.readSC_Q_St(&status) returns 1 and nInTimer::kSC_Counting is 5
It looks like the start trigger signal is not being detected.
tInTimerValues.h
typedef enum {
kSC_Idle = 0,
kSC_WaitforStart1 = 1,
kSC_PreCounting = 2,
kSC_PreWait = 3,
kSC_WaitForStartOfSample = 4,
kSC_Counting = 5,
} tInTimer_SC_Q_St_t
Joe Friedchicken
NI Configuration Based Software Get with your fellow OS users
[ Linux ] [ macOS ]Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
03-21-2012 10:57 AM
Hi Joe,
That's where my problem is. I went through the aiex2.cpp code line by line and couldn't find why the start trigger signal is not detected. The following is some of the code, can you see any problem???
aiHelper.reset(status);
device.AI.AI_Timer.Reset_Register.writeConfiguration_Start(kTrue, &status);
aiHelper.programExternalGate(
nAI::kGate_Disabled,// No external pause signal
nAI::kActive_High_Or_Rising_Edge,// Don't care
status);
aiHelper.programStart1(
startTrigger,// Set the PFI line
startTrigPolarity,// Make line active on...
kTrue,// ...edge (not level)
status);
aiHelper.programStart(
nAI::kStartCnv_InternalTiming,// Drive the clock line from internal oscillator
nAI::kActive_High_Or_Rising_Edge,// Make the line active on rising...
kTrue,// ...edge (not high level)
status);
if(deviceInfo->isSimultaneous)
{
// Program the convert to be the same as START
aiHelper.programConvert(
nAI::kStartCnv_InternalTiming,
nAI::kActive_High_Or_Rising_Edge,
status);
printf ("isSimultaneous\n");
}
else
{
// Program the convert clock to start on the sample clock
aiHelper.programConvert(
nAI::kStartCnv_InternalTiming,// Drive the clock line from internal sample clock
nAI::kActive_Low_Or_Falling_Edge,// Convert on falling edge
status);
printf ("convert clock to start on sample clock\n");
}
// Program the sample and convert clock timing specifications
timingConfig.setAcqLevelTimingMode(nNISTC3::kInTimerPostTrigger, status);// This is a finite measurement with samples after the trigger (eg post-trigger samples)
timingConfig.setUseSICounter(kTrue, status);// Use SI for internal sample clocking
timingConfig.setSamplePeriod(samplePeriod, status);
timingConfig.setSampleDelay(sampleDelay, status);
timingConfig.setNumberOfSamples(sampsPerChan, status);
timingConfig.setRetriggerRecord(kTrue, status);// Set the measurement to be retriggerable
if(!deviceInfo->isSimultaneous)
{
timingConfig.setUseSI2Counter(kTrue, status);// Use SI2 for internal convert clocking
timingConfig.setConvertPeriod(convertPeriod, status);
timingConfig.setConvertDelay(convertDelay, status);
printf("not simultaneou timing configuration\n");
}
aiHelper.getInTimerHelper(status).programTiming(timingConfig, status);
aiHelper.programFIFOWidth(nAI::kTwoByteFifo, status);
aiHelper.getInTimerHelper(status).clearConfigurationMemory(status);
for(u16 i=0; i<numberOfChannels; ++i)
{
// Set channel parameters
chanConfig[i].isLastChannel = (i == numberOfChannels-1) ? kTrue : kFalse;// Last channel?
chanConfig[i].enableDither = nAI::kEnabled;// Dithering helps increase ADC accuracy
chanConfig[i].gain = gain;// Set the gain (used by the hardware)
chanConfig[i].channelType = termConfig;// Set the terminal configuration
chanConfig[i].bank = nAI::kBank0;// AI channels 0..15 are on bank0
chanConfig[i].channel = i%maxChannel;// aiN where N = i%maxChannel
chanConfig[i].range = range;// Set the range (used by the scaler)// Push the channel configuration to the device
aiHelper.programChannel(chanConfig[i], status);
}
aiHelper.getInTimerHelper(status).primeConfigFifo(status);
device.AI.AI_Timer.Reset_Register.writeConfiguration_End(kTrue, &status);
aiHelper.getInTimerHelper(status).armTiming(timingConfig, status);
device.AI.AI_Timer.Status_2_Register.readSC_Q_St(&status);
printf("device.AI.AI_Timer.Status_2_Register.readSC_Q_St is: %x\n", device.AI.AI_Timer.Status_2_Register.readSC_Q_St(&status));
printf("nInTimer::kSC_Counting %x\n", nInTimer::kSC_Counting);
Thanks,
Larry
03-21-2012 11:37 AM
LarryL wrote:That's where my problem is. I went through the aiex2.cpp code line by line and couldn't find why the start trigger signal is not detected. The following is some of the code, can you see any problem?
I think what you're looking for is in the comment at the top 😉
Joe Friedchicken
NI Configuration Based Software Get with your fellow OS users
[ Linux ] [ macOS ]Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
03-21-2012 12:23 PM
Hi Joe,
Can you be more sepcific where it is? If I can find, I wouldn't ask for help.
Thanks,
Larry
03-21-2012 12:51 PM
Sure, aiex2 uses an external start trigger as described in the synopsis at the top and "External Connections" subsection. The default behavior is to trigger on PFI0. If you want to use a different the terminal, you can change line 85:
const nAI::tAI_START1_Select_t startTrigger = nAI::kStart1_PFI0;
If you are already providing an external signal, verify that it is securely connected and has the proper electrical characteristics according to the specifications.
Joe Friedchicken
NI Configuration Based Software Get with your fellow OS users
[ Linux ] [ macOS ]Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
03-21-2012 01:29 PM
10-26-2012 03:20 PM
Hi All:
I have made the X series board driver working. However, I got some strange results. The driver I made is working very well on desktop PC and it is not working well with industrial PCs. We have tested it on 3 different PC hardware and got 3 different results (see attached screenshots). Does anyone has some ideas/suggestions?
The first two following figures are from two indutrial PCs and the third one from desktop PC. The X series cards and driver used were all same for three PCs
Thanks,
Larry
10-28-2012 08:26 PM
LarryL wrote:
I have made the X series board driver working. However, I got some strange results. The driver I made is working very well on desktop PC and it is not working well with industrial PCs. We have tested it on 3 different PC hardware and got 3 different results (see attached screenshots). Does anyone has some ideas/suggestions?
Hi Larry,
I have a few questions:
Joe Friedchicken
NI Configuration Based Software Get with your fellow OS users
[ Linux ] [ macOS ]Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
10-29-2012 12:11 PM
Hi Joe,
Thanks for the response.
Here are the answers for your questions:
1. the unit on graph is micron for X axis and sample point (time) for Y axis
2. the data plotted is actually the following error. we did test on one of our control system and got all data. we also had reference and actual moving data. But the following data shown better.
3. all the data is from encoders. the problem wasn't coming from actuator encoder. it was actually from reference. our control reference signal is generated from encoder inputs. the glitch you saw on the graph is where the reference had glitch.
4. the industrial PC was in same place and we switched the processor boards. the desktop PC was next to industrial pc.
5. all the connections were the same to 3 set up pcs.
Thanks,
Larry