03-10-2011 01:55 PM
Hello,
My group is trying to trigger NI Card PCIe 1429 to trigger a line scan camera (SU-LDH) using Visual C++ 2008. We have been able to trigger the card using a Stanford DS345m function generator, however, we have been unable to do so with our program. Here is what we have:
// Initialization 1a: set up WFM output channels and create a task
double dClockRate = 1000000;
double dMinimum = -10.0;
double dMaximum = +10.0;
int nNumberDepthProfiles = pInfo->m_pnOCTParameters->m_nNumberDepthProfiles;
std::auto_ptr<CNiDAQmxTask> nitWFM;
nitWFM = std::auto_ptr<CNiDAQmxTask>(new CNiDAQmxTask());
nitWFM->AOChannels.CreateVoltageChannel("Dev1/ao0", _T(""), dMinimum, dMaximum, DAQmxAOVoltageUnitsVolts);
nitWFM->AOChannels.CreateVoltageChannel("Dev1/ao1", _T(""), dMinimum, dMaximum, DAQmxAOVoltageUnitsVolts);
nitWFM->AOChannels.CreateVoltageChannel("Dev1/ao2", _T(""), dMinimum, dMaximum, DAQmxAOVoltageUnitsVolts);
nitWFM->AOChannels.CreateVoltageChannel("Dev1/ao3", _T(""), dMinimum, dMaximum, DAQmxAOVoltageUnitsVolts);
// sprintf_s(pcChannel, 256, "%s/ao0","Dev1"); m_tFastWFM->AOChannels.CreateVoltageChannel(pcChannel,_T(""),dMinimum,dMaximum,DAQmxAOVoltageUnitsVolts);
nitWFM->Control(DAQmxTaskVerify);
CNiReal64Matrix ppdWFM(4, nNumberDepthProfiles);
nitWFM->Timing.ConfigureSampleClock(_T(""), dClockRate, DAQmxSampleClockActiveEdgeRising, DAQmxSampleQuantityModeFiniteSamples, nNumberDepthProfiles);
CNiDAQmxAnalogMultiChannelWriter writer(nitWFM->Stream);
Here is how our waveform is calculated:
// WFM calculation
int nTrack = 0;
int nNumberGalvoSteps = 1;
double nLTVmax = 5.0;
double nPMVmax = 5.0;
CnOCTParameters *m_pOCTParameters = pInfo->m_pnOCTParameters;
int nLinePeriodinClk = (1/m_pOCTParameters->m_fDepthProfileRate) * m_pOCTParameters->m_fWFMSamplingRate;
double nDutyCycleLineTrigger = 0.2;
int nLTPulseWidth = (int) nLinePeriodinClk * nDutyCycleLineTrigger;
// nNumberDepthProfiles = pInfo->m_pnOCTParameters->m_nNumberDepthProfiles;
int nWFMLength = (m_pOCTParameters->m_nNumberDepthProfiles / m_pOCTParameters->m_fDepthProfileRate) * m_pOCTParameters->m_fWFMSamplingRate;
fprintf(fpLog, "\tnNumberDepthProfiles = %d. Length = %d, nPulseWidth = %d, nLinePeriodinClk = %d\n", nNumberDepthProfiles, nWFMLength, nLTPulseWidth, nLinePeriodinClk);
for (int nLine = 0; nLine < nWFMLength; nLine++){
pNode->m_pdLineTrigger[nLine] = 0 ;
}
for (int nLine = 0; nLine < nNumberDepthProfiles; nLine++){
for (int nPoint = 0; nPoint < nLTPulseWidth; nPoint++){
pNode->m_pdLineTrigger[nLine*nLinePeriodinClk+nPoint] = 10;
}
}
One difference we noticed between our program's output and that of the function generator is that the function generator gives a continuous signal, while ours has periodic gaps. Could this be what is causing the problem? If so, what is a potential solution (asynchronus function? Not allowing regeneration?)? Your responses are much appreciated.
03-11-2011 01:28 PM
Hello masterron1,
How are your configuring the trigger at the hardware level and what DAQ device are you using as a trigger? Can you confirm that your program produces a signal output? It is possible that you need a continuous signal, although I have not been able to find this detail in our documentation. I would recommend trying a continous pulse train to see if you are still unable to trigger.
Best Regards,
Lynn
03-11-2011 02:03 PM
Hello Lynn. Thank you for your response.
From the computer the signal is going through NI 6259 , which is connected through a BNC board 2110. From there we are using a cc1 (Camera Control) External Trigger for the cards. This setting is controlled in the Measurement and Automation Explorer (MAX). We tried triggering both the card and the camera separately, but we had the same result. Is there a specific function we could put into the for loop to make our signal continuous? Thanks.
03-11-2011 04:29 PM
Additionally, we confirmed with an oscilloscope that there is, in fact, a signal output. That is how we observed that there were periodic gaps in the signal.
03-14-2011 11:32 PM
It shouldn't matter if there are longer delays between pulses. Once the camera is configured to have each line acquisition triggered by a pulse, it won't matter the spacing as long as it is not reaching the timeout value. I would look closely to compare the 6259 output signal to the function generator output signal. When you are viewing these signals on the oscilloscope, do they seem to follow TTL spec?
03-14-2011 11:35 PM
...also, it is unclear what you mean when you say you haven't gotten it to work using the 6259. Do you get any triggered behavior at all when using the 6259? In other words, is the 1429 receiving any of the pulses? Is it grabbing a line after each pulse it does receive?