Quantcast
Channel: Counter/Timer topics
Viewing all articles
Browse latest Browse all 1271

Setting 6250 counter threshold

$
0
0

I have a power supply that provides a voltage signal that is proportional to the current draw.  I need to detect a short current spike of around 70 amps.  The baseline voltage varies from .2 to around .5 volts and the spike is around around 7 volts.  Is there a way to set the threshold  of the counter to say 4 volts?

These are the two functions I am starting with.

 

INT32 CDAQCounter::StartCounting()
{
   DAQmxErrChk (DAQmxCreateTask("",&m_TaskHandle));
   DAQmxErrChk (DAQmxCreateCICountEdgesChan(m_TaskHandle,m_CardID/*"Dev1/ctr0"*/,"",DAQmx_Val_Rising,0,DAQmx_Val_CountUp));
   DAQmxErrChk (DAQmxSetArmStartTrigType(m_TaskHandle, DAQmx_Val_DigEdge));
   DAQmxErrChk (DAQmxSetDigEdgeArmStartTrigSrc(m_TaskHandle,m_SourceID/* "/Dev1/PFI0"*/));
   DAQmxErrChk (DAQmxSetDigEdgeArmStartTrigEdge(m_TaskHandle, DAQmx_Val_Rising));
   DAQmxErrChk(DAQmxStartTask(m_TaskHandle))
}

 

INT32 CDAQCounter::GetCount()
{
   uInt32 data = 0;
   DAQmxErrChk (DAQmxReadCounterScalarU32(m_TaskHandle,10.0,&data,NULL));
   return (INT32)data;
}

 

I am going to be polling the GetCount() function while I programatically increase an output frequency.  When I get back a value, (I should get back a one), that will be the end of the test.

 


Viewing all articles
Browse latest Browse all 1271

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>