08-08-2007 11:30 AM
08-08-2007 01:40 PM
Maybe this finishes it?
Restructured AfterPulse.vi by nesting the pulse sequence inside the counter sequence, in the same pane as the counter read. This vi behaves like I want it to. The high transition digital output vi has to happen before the low transition, because of the inner sequence. Therefore, there are 3 possible sequences involving the transition vi's and the read vi. The read can happen before them, or between them, or after them. Yet, when I add error wiring to force any of these orders, the timeout happens on the first cycle. This explanation does not address the role of the time delays, but the read timeout is many times larger than the time delays, so I don't think that can be it either.
Therefore, it looks like the pulse has to happen *during* the execution of the read vi. That is, the read vi starts, then the pulse has to start and finish, and finally the read vi finishes. Does this make sense???
08-09-2007 09:21 AM
08-09-2007 10:05 AM
08-09-2007 11:28 AM
First, I've done dozens of buffered ("strobed") counter tasks and they work well and sensibly. Not sure yet what the specific problem is in your case, but this kind of thing is generally pretty straightforward. You shouldn't need to revert to older hardware, etc.
Meanwhile sorry for the non-working code. I'm away from my LV box now and can't re-examine it but from what I remember, there isn't much to it. There really aren't many candidate places for trouble. A pulse is generated with DIO, then a single sample is read from each counter. A timeout means either that the pulse isn't generated or that the counter tasks don't receive it.
Have you run with the little execution highlighting lightbulb on? Have you verified that the digital pulse happens using a scope? Are there any errors asserted? Are you sure that the digital pulse can be seen by the counter task?
Wait! I think that's it! If I recall correctly, you're generating the digital pulse on port0/line0 while you've specified that the counters should look for that signal at PFI0. Is that right? I didn't catch this earlier because that combination would be exactly right for a 6602 counter timer board. However, it is NOT right for an M-series board. On a 6259, the lines of port 0 are only for correlated DIO and do not map to PFI. Ports 1 and 2 *do* map to PFI's. So one example of a working combo is port1/line0 and PFI0.
-Kevin P.
08-09-2007 02:11 PM
08-09-2007 02:17 PM
08-09-2007 02:24 PM
And here's a screenshot of AfterPulse.vi so you don't need a LV box to see it.
BTW, is there a way to export a graphic of the block diagram directly, so the image size isn't limited by what you can fit on the screen at one time?
08-10-2007 07:26 AM
For troubleshooting, I made a couple very small mods and had no trouble at all on an M-series board. I changed the DO strobe to go to port1/line0 because it already maps to the same pin as PFI0. (My terminal blocks aren't easily accessible and this helped me avoid screwdriver work.) Then I told explicitly directed both counter tasks to count edges from the internal 100 kHz timebase. (I also temporarily changed the device name from 'Laplace' to my device's name, but I *think* I got it changed back in all the necessary places. Better double check that though.)
No extra delays or sequence structures or anything complicated. I can strobe as fast as I can click my mouse or I can wait a long time. The counters always read reasonable counts immediately and I don't get any timeout errors. After the first strobe, the difference between the 2 counter differences was always 0, as it should be. (I also tried it with the 80 MHz timebase and would occasionally get +/- 1 for the difference of the differences. Not unexpected -- this is typically related to signal propagation times within the board.)
Try this one and see what you get.
-Kevin P.
08-10-2007 08:14 AM
Kevin, thanks!
I tried your vi and it dies with a counter timeout on the first Strobe Now.
Then I cut the error lines that order the two counters after the digital line pulse, and it runs, and behaves as you describe: zero difference except on the very first try, and reasonable counts, whether using long or short waits. I conclude you did change from your device name to Laplace correctly. I did not make any other changes than deleting one segment of each of the two error wires and hitting Ctrl-b to tidy up.
I attached the version with the cut error lines, even though it's a very minor change, just so you could see for certain. Does this version work for you?
I am going to change this cut error wire version so that it keeps strobing itself, so I can see how many times it works before a timeout. My NestedSequences vi died at 5000, and in real life it is going to cost us maybe $1000 every time a block of 1,000,000 cycles includes a timeout, so cut-wire versions that work in casual testing are still not close to useable even if the casual testing says the numbers are correct and I elect to ignore my doubts.