Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Continuous buffer with interrupts doesn't refill the buffer

That is very curious. I cannot see how you will have a problem just including a source file in your own project. (you shouldn't use any of the previous files I sent, just that single new .cpp file).

Maybe your vs is misconfigured? Try to create a NON empty console win32 app and see if you can compile it. (I mean without any of my code).

Gil
0 Kudos
Message 11 of 57
(1,827 Views)
Gil,

I can build a simple win32 console app, but if I add your code and link the nidaq32.lib I get the error.  It has something to do wtih spaces being some of the paths.  Can you send me the exe itself.  My device number is 1.  I can run it and verify what you are seeing.

Regards,
Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 12 of 57
(1,821 Views)
Kenn,

I use two cards, a 6602 and a 6533. Do you have access to both? If you send me the dev nums I'll compile one for you.

Also, try to copy the cpp file I sent into the directory in which you created your empty win32 app, and then add the file. Maybe it will work. I still cannot see where the path name is in my code...

Gil
0 Kudos
Message 13 of 57
(1,819 Views)
Gil,

I will make the 6533 be Device 2.  How do you want me to add the file?

Regards,

Message Edited by Kenn N on 11-07-2006 03:54 PM

Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 14 of 57
(1,818 Views)
(1) In visual studio create an empty win32 console application. Call it any name you want. For example we will choose 'ctrtest'.
(2) Copy the single file I send (which I attach to this message again) into the source code directory of the application you've just created.
(3) In VS, right-click the project name in the solution explorer and choose 'add->Existing Item...' and add the file you've just copied into that folder (ctrex.cpp).
(4) Try to compile.

I'll make a an executable as well

Gil

0 Kudos
Message 15 of 57
(1,816 Views)
Hi Kenn,

Here is an executable. 6602 is device 1, 6533 is device 2
I packed it in a zip file because the forum's interface doesn't allow .exe files.


Gil


0 Kudos
Message 16 of 57
(1,811 Views)
Gil,

Did that, and if I go to the project properties to link the nidaq32.lib I get the same error.  Is there another way to link that file?

Regards,

Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 17 of 57
(1,810 Views)
Try to copy the nidaq32.lib to your project directory and link against that instead. You probably have a problem with your path.

(Did you tell VS2005 to look at certain directories for you library files? In the link properties in the project properties you should only put nidaq32.lib, and not the whole path. If you use the whole path, try to put quote marks (or maybe double quote marks) around it)

G

0 Kudos
Message 18 of 57
(1,805 Views)
DIOCallback 1 (tick 1674878)
        cts:
ct 0: 0, 0, 0, 0, 0, 0, 0, 0
   end: 0, 0, 0, 0, 0, 0, 0, 0

DIOCallback 2 (tick 1675038)
        cts:
ct 0: 0, 0, 0, 0, 0, 0, 0, 0
   end: 0, 0, 0, 0, 0, 0, 0, 0

DIOCallback 3 (tick 1675198)
        cts:
ct 0: 0, 0, 0, 0, 0, 0, 0, 0
   end: 0, 0, 0, 0, 0, 0, 0, 0

DIOCallback 4 (tick 1675359)
        cts:
ct 0: 0, 0, 0, 0, 0, 0, 0, 0
   end: 0, 0, 0, 0, 0, 0, 0, 0

DIOCallback 5 (tick 1675519)
        cts:
ct 0: 0, 0, 0, 0, 0, 0, 0, 0
   end: 0, 0, 0, 0, 0, 0, 0, 0

DIOCallback 6 (tick 1675679)
        cts:
ct 0: 0, 0, 0, 0, 0, 0, 0, 0
   end: 0, 0, 0, 0, 0, 0, 0, 0

DIOCallback 7 (tick 1675839)
        cts:
ct 0: 0, 0, 0, 0, 0, 0, 0, 0
   end: 0, 0, 0, 0, 0, 0, 0, 0

DIOCallback 8 (tick 1675999)
        cts:
ct 0: 0, 0, 0, 0, 0, 0, 0, 0
   end: 0, 0, 0, 0, 0, 0, 0, 0

Is this what was expected.

Regards,
Kenn North
Principal Product Manager - Search, Digital Analytics
http://ni.com/search
0 Kudos
Message 19 of 57
(1,790 Views)
hmm. not really. Is this from the executable I sent, or did you manage to compile to code?

Here is the result that I get (i've modified the code a bit to have a better printout). In this output there are two counters, counter 0 is DMA and counter 1 is interrupts.
The program prints out the conents of the beginning and end of each counter's buffer for the first 10 ticks of the DIO callback (to see that the buffer fills up) and then
also at the ticks around the time the buffer is supposed to get filled up (from tick 252). You can see how the DMA buffer refills and the interrupts one doesn't. You can also see that the counters are working properly, since they count the internal 100kHz source at 100Hz, so each tick we expect the counts to increment by 100 exactly (there is a small drift, becuase the clocks are not synchronized). I attach a new executable with two counters.

DIOCallback 1 (tick 174599125)
counter 0 buffer begining: 274, 0, 0, 0, 0, 0, 0, 0
counter 0 buffer      end: 0, 0, 0, 0, 0, 0, 0, 0
counter 1 buffer begining: 270, 0, 0, 0, 0, 0, 0, 0
counter 1 buffer      end: 0, 0, 0, 0, 0, 0, 0, 0

DIOCallback 2 (tick 174599125)
counter 0 buffer begining: 274, 1274, 0, 0, 0, 0, 0, 0
counter 0 buffer      end: 0, 0, 0, 0, 0, 0, 0, 0
counter 1 buffer begining: 270, 1270, 0, 0, 0, 0, 0, 0
counter 1 buffer      end: 0, 0, 0, 0, 0, 0, 0, 0

DIOCallback 3 (tick 174599140)
counter 0 buffer begining: 274, 1274, 2275, 0, 0, 0, 0, 0
counter 0 buffer      end: 0, 0, 0, 0, 0, 0, 0, 0
counter 1 buffer begining: 270, 1270, 2271, 0, 0, 0, 0, 0
counter 1 buffer      end: 0, 0, 0, 0, 0, 0, 0, 0

DIOCallback 4 (tick 174599156)
counter 0 buffer begining: 274, 1274, 2275, 3275, 0, 0, 0, 0
counter 0 buffer      end: 0, 0, 0, 0, 0, 0, 0, 0
counter 1 buffer begining: 270, 1270, 2271, 3271, 0, 0, 0, 0
counter 1 buffer      end: 0, 0, 0, 0, 0, 0, 0, 0

DIOCallback 5 (tick 174599156)
counter 0 buffer begining: 274, 1274, 2275, 3275, 4275, 0, 0, 0
counter 0 buffer      end: 0, 0, 0, 0, 0, 0, 0, 0
counter 1 buffer begining: 270, 1270, 2271, 3271, 4271, 0, 0, 0
counter 1 buffer      end: 0, 0, 0, 0, 0, 0, 0, 0

DIOCallback 6 (tick 174599171)
counter 0 buffer begining: 274, 1274, 2275, 3275, 4275, 5275, 0, 0
counter 0 buffer      end: 0, 0, 0, 0, 0, 0, 0, 0
counter 1 buffer begining: 270, 1270, 2271, 3271, 4271, 5271, 0, 0
counter 1 buffer      end: 0, 0, 0, 0, 0, 0, 0, 0

DIOCallback 7 (tick 174599187)
counter 0 buffer begining: 274, 1274, 2275, 3275, 4275, 5275, 6275, 0
counter 0 buffer      end: 0, 0, 0, 0, 0, 0, 0, 0
counter 1 buffer begining: 270, 1270, 2271, 3271, 4271, 5271, 6271, 0
counter 1 buffer      end: 0, 0, 0, 0, 0, 0, 0, 0

DIOCallback 8 (tick 174599187)
counter 0 buffer begining: 274, 1274, 2275, 3275, 4275, 5275, 6275, 7275
counter 0 buffer      end: 0, 0, 0, 0, 0, 0, 0, 0
counter 1 buffer begining: 270, 1270, 2271, 3271, 4271, 5271, 6271, 7271
counter 1 buffer      end: 0, 0, 0, 0, 0, 0, 0, 0

DIOCallback 9 (tick 174599203)
counter 0 buffer begining: 274, 1274, 2275, 3275, 4275, 5275, 6275, 7275
counter 0 buffer      end: 0, 0, 0, 0, 0, 0, 0, 0
counter 1 buffer begining: 270, 1270, 2271, 3271, 4271, 5271, 6271, 7271
counter 1 buffer      end: 0, 0, 0, 0, 0, 0, 0, 0

DIOCallback 252 (tick 174601625)
counter 0 buffer begining: 274, 1274, 2275, 3275, 4275, 5275, 6275, 7275
counter 0 buffer      end: 248277, 249277, 250277, 251277, 0, 0, 0, 0
counter 1 buffer begining: 270, 1270, 2271, 3271, 4271, 5271, 6271, 7271
counter 1 buffer      end: 248273, 249273, 250273, 251273, 0, 0, 0, 0

DIOCallback 253 (tick 174601640)
counter 0 buffer begining: 274, 1274, 2275, 3275, 4275, 5275, 6275, 7275
counter 0 buffer      end: 248277, 249277, 250277, 251277, 252277, 0, 0, 0
counter 1 buffer begining: 270, 1270, 2271, 3271, 4271, 5271, 6271, 7271
counter 1 buffer      end: 248273, 249273, 250273, 251273, 252273, 0, 0, 0

DIOCallback 254 (tick 174601656)
counter 0 buffer begining: 274, 1274, 2275, 3275, 4275, 5275, 6275, 7275
counter 0 buffer      end: 248277, 249277, 250277, 251277, 252277, 253277, 0, 0
counter 1 buffer begining: 270, 1270, 2271, 3271, 4271, 5271, 6271, 7271
counter 1 buffer      end: 248273, 249273, 250273, 251273, 252273, 253273, 0, 0

DIOCallback 255 (tick 174601656)
counter 0 buffer begining: 274, 1274, 2275, 3275, 4275, 5275, 6275, 7275
counter 0 buffer      end: 248277, 249277, 250277, 251277, 252277, 253277, 254277, 0
counter 1 buffer begining: 270, 1270, 2271, 3271, 4271, 5271, 6271, 7271
counter 1 buffer      end: 248273, 249273, 250273, 251273, 252273, 253273, 254273, 0

DIOCallback 256 (tick 174601671)
counter 0 buffer begining: 274, 1274, 2275, 3275, 4275, 5275, 6275, 7275
counter 0 buffer      end: 248277, 249277, 250277, 251277, 252277, 253277, 254277, 255277
counter 1 buffer begining: 270, 1270, 2271, 3271, 4271, 5271, 6271, 7271
counter 1 buffer      end: 248273, 249273, 250273, 251273, 252273, 253273, 254273, 255273

DIOCallback 257 (tick 174601687)
counter 0 buffer begining: 256277, 1274, 2275, 3275, 4275, 5275, 6275, 7275
counter 0 buffer      end: 248277, 249277, 250277, 251277, 252277, 253277, 254277, 255277
counter 1 buffer begining: 270, 1270, 2271, 3271, 4271, 5271, 6271, 7271
counter 1 buffer      end: 248273, 249273, 250273, 251273, 252273, 253273, 254273, 255273

DIOCallback 258 (tick 174601687)
counter 0 buffer begining: 256277, 257277, 2275, 3275, 4275, 5275, 6275, 7275
counter 0 buffer      end: 248277, 249277, 250277, 251277, 252277, 253277, 254277, 255277
counter 1 buffer begining: 270, 1270, 2271, 3271, 4271, 5271, 6271, 7271
counter 1 buffer      end: 248273, 249273, 250273, 251273, 252273, 253273, 254273, 255273

DIOCallback 259 (tick 174601703)
counter 0 buffer begining: 256277, 257277, 258277, 3275, 4275, 5275, 6275, 7275
counter 0 buffer      end: 248277, 249277, 250277, 251277, 252277, 253277, 254277, 255277
counter 1 buffer begining: 270, 1270, 2271, 3271, 4271, 5271, 6271, 7271
counter 1 buffer      end: 248273, 249273, 250273, 251273, 252273, 253273, 254273, 255273

DIOCallback 260 (tick 174601703)
counter 0 buffer begining: 256277, 257277, 258277, 259277, 4275, 5275, 6275, 7275
counter 0 buffer      end: 248277, 249277, 250277, 251277, 252277, 253277, 254277, 255277
counter 1 buffer begining: 270, 1270, 2271, 3271, 4271, 5271, 6271, 7271
counter 1 buffer      end: 248273, 249273, 250273, 251273, 252273, 253273, 254273, 255273



Gil
0 Kudos
Message 20 of 57
(1,788 Views)