Can DAQmxRegisterEveryNSamplesEvent function be used for the Counter Input Channels

Hi, All,
I have an application to count the digitial pulse number. I want to know the time of the coming pulses which start from 1 and increased 4 later, like 1, 5, 9, 13..... The time interval between each pulse is not a fixed value. So I tried to use  DAQmxRegisterEveryNSamplesEvent and DAQmxCreateCICountEdgesChan functions. But afterI called the DAQmxStartTask function, it always failed.  The board I used is the NI-PCIe-6320. Here is part of my code.
DAQmxErrChk (DAQmxCreateTask("",&m_taskhandle));
DAQmxErrChk (DAQmxCreateCICountEdgesChan(m_taskhandle,"Dev1/ctr0","",DAQmx_Val_Rising, 0, DAQmx_Val_CountUp));
DAQmxErrChk(DAQmxRegisterEveryNSamplesEvent(m_taskhandle, DAQmx_Val_Acquired_Into_Buffer, 4, 0, EveryNSamplesCallback, this) );
DAQmxErrChk (DAQmxStartTask(m_taskhandle));
I don't know the reason. Can Anyone give me some help. Thanks.
Yang
Solved!
Go to Solution.

Hi, John,
What's I what to do is that I have an external digital signal, when the signal goes from low to high, I need do some operations. So I just want to know the time when the digital signal goes from low to high.  The frequency of the digital signal is from 0 - 20000Hz. My first plan is to use a counter to count the pulse rising edges. When the number of edge increases one, I do the designed operations. In this method, I can't guarantee I can catch each pulse rising point. Because sometimes the counter will increase more than one in the on-demand mode. For example, the previous content of the counter is xxxx4, but the next reading the content may become xxxx6.
After I learned some ANSI C  codes, I found that the ChangeDetectionEvent can help me found time when the signal goes from low to high. So I wrote the following code: (I set the digital signal to P0.0)
DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
DAQmxErrChk (DAQmxCreateDIChan(taskHandle,"Dev1/port0/line0","",DAQmx_Val_ChanPerLine));
DAQmxErrChk (DAQmxCfgChangeDetectionTiming(taskHandle,"Dev1/port0/line0","",DAQmx_Val_ContSamps, 1));
DAQmxErrChk (DAQmxRegisterSignalEvent (taskHandle, DAQmx_Val_ChangeDetectionEvent, 0, Callback , dialog));
DAQmxErrChk (DAQmxStartTask(taskHandle));
int32 CVICALLBACK Callback (TaskHandle taskHandle, int32 signalID, void *callbackData){
CNIPCIE6320Dlg* dialog = static_cast<CNIPCIE6320Dlg*>(callbackData);
dialog->m_event_num++;  // Here is to calculate how many events has been triggered
return 0;
Yesterday I used this method to get the pulse rising time. I found the m_event_num is close to the ground truth (In the simulation, I know how may rising pulse I generated).  In one two hours test, the offset is almost 400 pulses. But today I did the same tests again. I found the m_event_num got a big difference from the ground truth. The voltage of the whole system today maybe smaller than yesterday, because today the power is from an invertor while yesterday the power is from the electricity supply. So will the lower voltage supply will causing some event missing. Or if PC system became busy will ignore some callings of the event callback function? That's two possible reason will affact the final result. I am not sure. Do you have any experience about this problem.  Or do you have some better suggestion to get the pulse rising time. Thanks again.
Regards,
Yang 

Similar Messages

  • Can bind variable be used for the table in an explicit cursor

    I have an application that accesses a table on several different servers. I created a ref cursor variable for the cursor and a varchar2 variable to define my query. variable i_server is an parameter of my procedure. Is it possible to rewrite the v_query using bind variables for the table/server? I have include v_query below.
    v_query := 'SELECT rp.usr_id, rp.sun_sft_cat, rp.sun_start, rp.sun_hrs,' ||
    ' rp.mon_sft_cat, rp.mon_start, rp.mon_hrs,' ||
    ' rp.tue_sft_cat, rp.tue_start, rp.tue_hrs,' ||
    ' rp.wed_sft_cat, rp.wed_start, rp.wed_hrs,' ||
    ' rp.thu_sft_cat, rp.thu_start, rp.thu_hrs,' ||
    ' rp.fri_sft_cat, rp.fri_start, rp.fri_hrs,' ||
    ' rp.sat_sft_cat, rp.sat_start, rp.sat_hrs,' ||
    ' rp.sun_sft, rp.mon_sft, rp.tue_sft, rp.wed_sft,' ||
    ' rp.thu_sft, rp.fri_sft, rp.sat_sft, nvl(ei.wip_permanent_sched_seq, 0)' ||
    ' FROM ' || i_server || ' rp, wip_emp_information ei,' ||
    ' wip_emp_status wes, wip_emp_status_type west ' ||
    ' WHERE rp.usr_id = ei.employee_id' ||
    ' AND wes.employee_id = ei.employee_id' ||
    ' AND wes.status_type = west.status_type' ||
    ' AND west.description = ''WAREHOUSE EMPLOYEE''' ||
    ' AND wes.effective_date = (SELECT MAX(wes2.effective_date)' ||
    ' FROM wip_emp_status wes2' ||
    ' WHERE wes2.status_type = wes.status_type' ||
    ' AND wes2.employee_id = wes.employee_id' ||
    ' AND wes2.effective_date <= trunc(SYSDATE))' ||
    ' AND wes.status = ''Y'' AND rp.wk = 1'; -- wk = 1 is next week's schedule
    OPEN rp_sched_cursor FOR v_query;

    If your intention is to do this:
    v_query := 'SELECT rp.usr_id, rp.sun_sft_cat, rp.sun_start, rp.sun_hrs,' ||
    ' rp.mon_sft_cat, rp.mon_start, rp.mon_hrs,' ||
    ' rp.tue_sft_cat, rp.tue_start, rp.tue_hrs,' ||
    ' rp.wed_sft_cat, rp.wed_start, rp.wed_hrs,' ||
    ' rp.thu_sft_cat, rp.thu_start, rp.thu_hrs,' ||
    ' rp.fri_sft_cat, rp.fri_start, rp.fri_hrs,' ||
    ' rp.sat_sft_cat, rp.sat_start, rp.sat_hrs,' ||
    ' rp.sun_sft, rp.mon_sft, rp.tue_sft, rp.wed_sft,' ||
    ' rp.thu_sft, rp.fri_sft, rp.sat_sft, nvl(ei.wip_permanent_sched_seq, 0)' ||
    ' FROM ' || :b0 || ' rp, wip_emp_information ei,' ||      --- Note the bindvariable...
    ' wip_emp_status wes, wip_emp_status_type west ' ||
    ' WHERE rp.usr_id = ei.employee_id' ||
    ' AND wes.employee_id = ei.employee_id' ||
    ' AND wes.status_type = west.status_type' ||
    ' AND west.description = ''WAREHOUSE EMPLOYEE''' ||
    ' AND wes.effective_date = (SELECT MAX(wes2.effective_date)' ||
    ' FROM wip_emp_status wes2' ||
    ' WHERE wes2.status_type = wes.status_type' ||
    ' AND wes2.employee_id = wes.employee_id' ||
    ' AND wes2.effective_date <= trunc(SYSDATE))' ||
    ' AND wes.status = ''Y'' AND rp.wk = 1'; -- wk = 1 is next week's schedule
    OPEN rp_sched_cursor FOR v_query USING i_server;Then the answer is: no, you cannot do that.
    But my question then would be: why would you want to do that?
    I assume you don't have that many "different servers". One cursor per server won't hurt you.

  • How to find function module's and tables used for the particulat screen or TCODE?

    Hello Nation,
    I would like to know how to find the  function modules and tables used for the particular screen or TCODE or program.
    Example : I would like know the function module used in the program RDBGFT?
                     How can i find that?
    Thanks in advance ,Awaiting your reply.

    Make use of Find function  with the keyword "CALL FUNCTION".
    Make use of the same find function with the keyword "Select" to know the database tables used.
    Regards,
    Philip.

  • HT201250 I am having trouble setting up my time capsule.  the amber light is flashing.  i have a Verizon FIOS network that i use for the internet (WiFi) and do not want to configure the Time Capsule to do that function.  I just want the Time Capsule to ba

    I am having trouble setting up my time capsule.  the amber light is flashing.  i have a Verizon FIOS network that i use for the internet (WiFi) and do not want to configure the Time Capsule to do that function.  I just want the Time Capsule to back up.

    Simple.. bridge the TC.. in the apple utility in the NAT and DHCP area.
    Plug it into the FIOS router.. you can turn off wireless in the TC if you want.. or use it.. it can work faster if you are nearby and can select 5ghz.. but up to you.

  • My Snow Leopard 10.6.3 has Safari 4.0.4 but this cannot be used for the new features of iTune.  I tried upgrading to Safari 5.1.7 but it needs Snow Leopard 10.6.8.  Where can I get a version of Safari 5.1 that is compatible with Snow Leopard 10.6.3?

    My Snow Leopard 10.6.3 has Safari 4.0.4 but this cannot be used for the new features of iTunes.  I tried upgrading to Safari 5.1.7 but it needs Snow Leopard 10.6.8.  Where can I get a version of Safari 5.1 that is compatible with Snow Leopard 10.6.3?

    Hi..
    here can I get a version of Safari 5.1 that is compatible with Snow Leopard 10.6.3?
    Not possible. You need to update to v10.6.8
    Click your Apple menu > Software Update
    Or update using the this download > Mac OS X 10.6.8 Update Combo
    Then restart your Mac.

  • In addition to my iMac, I have a Power Mac G4 (10.4.11 Tiger) which of course is pre-Intel.  I can boot up and use for about 5 minutes before the mouse freezes.  I believe something is   overheating.  What would that be - so I can have repairs done?  The

    In addition to my iMac, I have a Power Mac G4 (10.4.11 Tiger) which of course is pre-Intel.  I can boot up and use for about 5 minutes before the mouse freezes.  I believe something is
    overheating.  What would that be - so I can have repairs done?  The machine is the Digital Audio version, M7627LL/A and Serial Number XB******KXQ.
    <Edited By Host>

    Hello USME,
    'Tis a common problem on old Macs.
    Do as Allan says: open the door and blow out all the dust bunnies. Canned air from Wal-Mart or Radio Shack can be handy (though sort of expensive) especially for blowing through the back of the power supply. A cool Mac is a happy Mac.
    Be sure your Mac can breathe. The air intake is on the bottom of the case, so be sure a deep pile rug or too many papers on your desk are not blocking the air supply.
    Feel the power supply and the processor with your hand. They should be warm but not hot; if you have to move your hand away, that's too hot!
    Check the fan on the power supply, and on the processor if it has one. Take a flashlight and peer in the back of the (Mac) case through  the grille; make sure the fan is turning. If it's not, the power supply won't work for long.
    Fans are not considered serviceable, though they will succumb to mechanics of determination. A CPU fan is easy and straightforward.
    A fan replacement will not cure an already damaged power supply; the PS may already be done for. Used power supplies for a DA are hard to come by, and not especially cheap when found (c.$50). An entire  working DA or Quicksilver may often be found for under $100 on eBay, and swapping in your HD is easy and simple... this might be cheaper and more expeditious than repairing an expired DA. Replacing a power supply is fairly easy, but it's a nuisance and requires a 2mm Allen head wrench in addition to the usual #2 Phillips head screwdriver.
    In my experience, power supplies and CPUs are about equally likely to fail. There are a few other possibilities, but they are not nearly so common.
    Good luck!... Jon

  • Currently, I have 5 iPads used for the same purpose. Since similar data /application is shared among all of them, is it alright for me "Backup" only 1 iPad. And in which case, if anything happens to any of the other iPads I can still recover the data

    Currently, I have 5 iPads used for the same purpose. Since the same data /application is shared among all of these iPads, is it alright for me "Backup" only 1 iPad instead of all 5?  And if anything happens to any my iPads which I have not backed up, I can restore it from the iPad where I have save the Backup. I am hoping by doing so, I will also be able to save some icloud storage space. Let me know if my question is still not so clear to you guys.  Thanks.

    Hello PeachY1234,
    If I understand correctly you'd like to save iCloud storage space by only backing up 1 of the 5 iPads to your account since they are all going to have very similar data and usage. You certainly can do that, but I do have to warn you that any unique data between them would be lost if you had to restore from that one backup made on another iPad so just keep that in mind. If you do need to restore in the future you can use this article to restore that iCloud backup:
    iCloud: Restore or set up your iOS device from iCloud
    Thank you for using Apple Support Communities.
    Cheers,
    Sterling

  • My phone was stolen, I have moved it in lost mode,but I can see that whoever has it,is changing phone name and can use it until I activate lost mode again.Can I do it permanently? How can I cancel ICloud back for the stolen phone,it blocks Cloud memory?

    My phone was stolen, I have moved it in lost mode,but I can see that whoever has it,is changing phone name and can use it until I activate lost mode again.Can I do it permanently? How can I cancel ICloud back for the stolen phone, as I cannot delete the stolen phone backup (says that backup is being in use) and this is keeping memory occupied in the Cloud and I cannot back-up the other devices.

    http://support.apple.com/kb/ht2526

  • I can't download anything on the Mac App store. It says This Apple ID cannot be used for the Mac App Store.

    I can't download anything on the Mac App store. It says This Apple ID cannot be used for the Mac App Store.

    I went into settings, iTunes & App Store and tapped on my appleID, then signed out. I went back into the App Store on my phone and tried to download the app and then signed in again, and it worked!

  • HT4718 No 1.    I can not activate Filevault : FileVault can't be turned on for the disk "Macintosh HD". Some disk formats don't support the recovery partition required by encryption. To use encryption, reinstall this version of Mac OS X on a reformatted

    I have TWO PROBLEMS
    No 1.  I can not activate FileVault. It displyas as follows :
    FileVault can’t be turned on for the disk “Macintosh HD”.
    Some disk formats don’t support the recovery partition required by encryption. To use encryption, reinstall this version of Mac OS X on a reformatted disk.
    No 2. I can not activate Find My Mac service. It displays as follows :
    Find My Mac requires a recovery partition
    Some configurations, such as software or hardware RAID, do not support a recovery partition and can't be used with find my mac

    Restart holding down the option/alt key and see if you have a Recovery Volume.
    Recovery Partition – Recreate Without Reinstalling
    Recovery Partition – Recreate Without Reinstalling (Requires Installer)
    Recovery Drive – Restore Missing
    Recovery Disk Assistant

  • Can Adobe Collage be used for images smaller than the standard 1200 by 789?

    Can Adobe Collage be used for images smaller than the standard 1200 by 789?

    Hi,
    * Photoshop Touch does have very good text capabilites.
    * For opening the Collage as an Artwork (Merged layer) in Photoshop Touch, you just need to upload the Collage file to Creative cloud and import it directly into Photoshop Touch.
    But if you are looking to preserve all the layers of the Collage file, you should download the Collage file as PSD from Creative Clould and import it in Photoshop Touch as layers.
    * Collage does have canvas scalability, you can extend up the canvas on all the four directions. But i think in you case you are looking for having specific custom sizes of the canvas, which is not currently available in Collage. Currently you cannot shrink the canvas below the default canvas size.
    Hope this is helpful. Please do revert back if you have more queries.
    -Subbi

  • HT204053 can two different apple ids be used for the same imatch

    can two different apple ids be used for the same imatch homesharing for music

    Welcome to the Apple Community.
    No.

  • Can we know buffers used for a particular program?(not for the instance)

    Can we know buffers used for a particular program?(not for the instance)

    You can do a runtime trace using ST01 but you won´t find out how much buffer a program "uses" since the buffer is shared for all workprocesses.
    Markus

  • I can not activate my iphone to be used for the first time, it is blocked. how do i unlock. can someone help me

    I can not activate my iphone to be used for the first time, it is blocked. how do i unlock. can someone help me

    dis the activation server is not available try again later or contact tech support.
    has no sim card installed more already tried with the sim card still not of.
    bought in china.

  • How can I obtain my licenses if another email address was used for the purchase?

    How can I obtain my licenses if another email address was used for the purchase?

    Hi 79bison,
    Welcome to Adobe Forum,
    You will have to log in with to www.adobe.comfor retail purchase or licensing.adobe.com if Volume licenses with the E-mail with which it is registered
    Then you can retrieve the serial number, you can opt for transfer of license to get it registered with your Email, if applicable & eligible.
    You can contact Adobe Support for further assistance at http://adobe.ly/yxj0t6.
    Hope it helps you.
    Rajshree

Maybe you are looking for

  • Accessing shared windows CD/DVD drive on Mac

    I can access shared CD's on my Windows XP (home) laptop via my Mac over a network connection. However, I cannot seem to access Audio CDs, I can see the contents of the CD but cannot play the CD...... is this possible? What I'd like to do is import a

  • Delivery date in Purchase Order Header

    Hi all, In which table is Delivery date in Purchase Order Header stored. the screen field name is eeind. Thanks

  • Macbook Pro not accepting discs

    Hi all! I have a problem today with my Macbook Pro... It will not accept any discs. I can push the disc in almost all the way and it doesn't grab them as it should. I can hear a series of very faint clicks - but that's it! I tried resetting SMC - and

  • Is there a way to sort the PRs in the PO in SRM?

    Hi Experts, After adopting the details of the 2 PRs (Shopping Carts) to PO in SRM the line number has been changed in ERP. The PR line items were alternately arranged and suppliers might also get confused. Current Behavior of PR to PO PR No. --- Line

  • Getting Safari To Work/OS X Tiger

    Hi, I use a Mac G4; run MacOS 9.2.2 and Tiger 10.4.9. I liked the way Internet Explorer 5.1.7 worked whenever you wanted to download files. I liked the contexual menu in IE 5.1.7, that allowed you to 'Download Link To Disk,' and 'Download Image to Di