angelmcdoggie
2008-05-21 04:10:08 UTC
Dear All,
I have several questions about the change detection event callback based from the VC++ shipping example, ReadDigChan_ChangeDetection_Events.
1. What is the rate of the configure change detection timing? It's not defined in the argument.
m_task->Timing. ConfigureChangeDetection(
risingEdgeLines,
fallingEdgeLines,
DAQmxSampleQuantityModeContinuousSamples, sampleSize);
2. Is the callback single-threaded or multi-threaded?
3.
void CReadDigChan_ChangeDetection_EventsDlg::OnDigitalChangeDetection( void* userData)
{
int value;
CNiComInitialize com( CNiComInitialize::Apartment);
if ( m_taskRunning) {
y
{
//read sample
m_reader->ReadSingleSampleMultiLine( m_data);
for ( unsigned int i = 0 ; i < m_data. GetSize(); i ++)
{
// Add plots if they don't exist
if ( m_graph. Plots. Count < ( short) i + 1 )
{
m_graph. Plots. Add();
}
// Converts boolean to integer
value = ( int) m_data[ i ];
// Graph it
m_graph. Plots. Item( i + 1 ).ChartY( i + 0.75 * value - 0.375);
TRACE( "[OnDigitalChangeDetection] : value[%i] = %i.\n", i , value);
}
//m_dSampleCtr++;
//TRACE("[OnDigitalChangeDetection] : sample # = %g.\n", m_dSampleCtr);
}
catch( CNiDAQmxException * e )
{
e ->ReportError();
e ->Delete();
m_taskRunning = false;
m_start. EnableWindow( true);
m_stop. EnableWindow( false);
}
}
}
I have several questions about the change detection event callback based from the VC++ shipping example, ReadDigChan_ChangeDetection_Events.
1. What is the rate of the configure change detection timing? It's not defined in the argument.
m_task->Timing. ConfigureChangeDetection(
risingEdgeLines,
fallingEdgeLines,
DAQmxSampleQuantityModeContinuousSamples, sampleSize);
2. Is the callback single-threaded or multi-threaded?
3.
void CReadDigChan_ChangeDetection_EventsDlg::OnDigitalChangeDetection( void* userData)
{
int value;
CNiComInitialize com( CNiComInitialize::Apartment);
if ( m_taskRunning) {
y
{
//read sample
m_reader->ReadSingleSampleMultiLine( m_data);
for ( unsigned int i = 0 ; i < m_data. GetSize(); i ++)
{
// Add plots if they don't exist
if ( m_graph. Plots. Count < ( short) i + 1 )
{
m_graph. Plots. Add();
}
// Converts boolean to integer
value = ( int) m_data[ i ];
// Graph it
m_graph. Plots. Item( i + 1 ).ChartY( i + 0.75 * value - 0.375);
TRACE( "[OnDigitalChangeDetection] : value[%i] = %i.\n", i , value);
}
//m_dSampleCtr++;
//TRACE("[OnDigitalChangeDetection] : sample # = %g.\n", m_dSampleCtr);
}
catch( CNiDAQmxException * e )
{
e ->ReportError();
e ->Delete();
m_taskRunning = false;
m_start. EnableWindow( true);
m_stop. EnableWindow( false);
}
}
}