Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

How to seting the countre countreset?

This example can count forward.

//////////////////////////////////////////////////////////

void CCountDigEventsDlg::OnBnClickedStartButton()
{
// This example uses the default source (or gate) terminal for
// the counter of your device. To determine what the default
// counter pins for your device are or to set a different source
// (or gate) pin, refer to the Connecting Counter Signals topic
// in the NI-DAQmx Help (search for "Connecting Counter Signals").

CWaitCursor wait;

CNiString initialCountStr;
CNiString physicalChannel;

m_physicalChannel.GetWindowText(physicalChannel);
m_initialCount.GetWindowText(initialCountStr);

try
{
m_task = std::auto_ptr<CNiDAQmxTask>(new CNiDAQmxTask());

m_task->CIChannels.CreateCountEdgesChannel(physicalChannel,
"Count Edges",
m_edgeEnum,
atoi(initialCountStr),
m_countDirectionEnum);
DAQmxSetChanAttribute (m_task, physicalChannel, CountEdgesCountResetEnable, TRUE);
m_reader = std::auto_ptr<CNiDAQmxCounterReader>(new CNiDAQmxCounterReader(_T(m_task->Stream)));

m_task->Start();
SetTimer(1, 100, 0);

m_startButton.EnableWindow(false);
m_stopButton.EnableWindow(true);
m_stopButton.SetFocus();
}
catch(CNiDAQmxException *e)
{
e->ReportError();
e->Delete();

delete m_task.release();
delete m_reader.release();
}
}

///////////////////////////////////////////////////////////////////////

How to add code ? seting the countre countreset.

0 Kudos
Message 1 of 1
(5,056 Views)