Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Using all 8 counters on the 6602.

Would you necessarily corrupt your data, Kevin? You would still have the actual value of the port after both transitions. It would simply be a matter of checking for this in SW.

Ex:

Port Value                           Counter Value
00000000                            1
00000101                            5

In this case, you would know that lines 0 and 2 transitioned "at the same time," when your reference counter was at position "5," give or take 12.5ns. Or were your suggesting that there would be some other problem? And as always, thanks for your excellent counter advice!
Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
0 Kudos
Message 21 of 41
(2,730 Views)
Ex:

Port Value                           Counter Value
00000000                            1
00000101                            5
 
 
If I were to have data like this, that would be totally acceptable.  I can very easily work with that in excel. 
 
I believe I will be able to obtain a copy of labview now.  Does anyone have some feedback on making a nice user interface?  I would like to display my findings, such as average, min, max of my A high, A low, B high, B low, A->B, B->A, commutator turn on and turn off points, and also calcuate duty cycle, and probably some other things I havent thought up right away, probably some graphs too.  I am new to labview but it looks like I can figure it out, but I welcome any tips. 
0 Kudos
Message 22 of 41
(2,728 Views)
Garrett,

My suggestions would be to start with the built-in shipping exampels in the LabVIEW Example Finder (Help->Find Examples):



These can be of tremendous assistance, exhibiting basic concepts such as loops, graphs, controls, indicators, etc. all the way to more advanced DAQmx applications.  My suggestion would be to download LabVIEW now, along with our NI-DAQmx data acquistion driver and try these examples out today, if you like. You can even simulate devices in DAQmx, so you don't have to wait on your hardware. And once you get your LabVIEW serial number, you can just enter it into LabVIEW and unlock the trial mode. Please let me know if you have any questions!

Regards,

Message Edited by Voltage Viper [DE] on 06-16-2006 01:43 PM

Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
0 Kudos
Message 23 of 41
(2,719 Views)
Would you necessarily corrupt your data, Kevin?
Maybe not.  Perhaps the scenario I imagined isn't actually possible.  My concern was that the port value and encoder count value would get latched on the 1st of 2 near-simultaneous transitions.  The 2nd transition would then be unable to generate a distinct change-detection event, and no sample would be taken to capture the state of that 2nd bit.
 
Is the actual behavior to latch the *latest* transition within a 12.5 nsec window rather than the earliest?
 
-Kevin P., just curious
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 24 of 41
(2,715 Views)
Kevin,

Page 6-8 (97) of the M Series User Manual shows a block diagram of the change detection circuitry. The data is buffered after the synchronization with the 80MHz timebase, preventing the behavior you are worried about.

Doing what I can,
Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
0 Kudos
Message 25 of 41
(2,713 Views)

Thanks for the link -- it helped a lot, though I'm still feeling just a little thick-headed.  I'm intrigued enough now that I want to be sure I *really* understand it.  I think the key sentence for me is: "The DAQ devices synchronize each DI signal to 80MHzTimebase, and then sends the signal to the change detectors."  Here's what I *think* it means -- could you correct me where I'm wrong?

1. The "Sync" block passes its input (P0.0 or whatever other bit) through to its output on each active edge of the 80 MHz internal timebase.  Any input-side changes that happen in between active edges are not passed through.  Only the state at the instant of the active edge.

2. The result of all edge detectors are OR'ed together.  (Only enabled edge detectors can produce a True output.)

3. ???  The "change detection" output becomes True.  But for how long?  Won't it stay True for at least a full 12.5 nanosecond period?  Will it then need to go False for 12.5 nsec before it can go True again?

In other words, does the "change detection" output need to generate edges for edge-sensitive circuitry?  Or does it just need to generate a state which will be latched/sampled by some other internal signal (such as perhaps the 80 MHz timebase)? 

I'm really curious about this stuff because one of my prior apps involved creating a bunch of simulated digital logic subvi's (latches, timers, edge-detectors, one-shots, etc., most with separate inputs for Signal, Enable, Reset, and Trigger).  Some of the customers' requirements led to some really tricky implementation issues.  For example: the logic vi's must have a reset input.  The reset input must be rising edge sensitive NOT high state-senstive.  The reset functionality must be able to be tripped on consecutive clock cycles.   Well, riddle me this: how do you create 2 consecutive rising edges with no falling edge between them? 

Anyway, I was never able to effectively convince the customer that in many cases the edge-detection was not only unnecessary but actually a huge complication and detriment.  The fact that the software must iterate in a loop and that the blocks execute in a sequence determined by dataflow made many of these digital states INHERENTLY synchronous.  An additional level of edge-detection was not needed for synchronization, and actually produced many confounding dilemmas, such as the consecutive rising edge issue above. 

But if the customer insists and the customer pays, well, what're ya gonna do?  In the end, I was able to make the required behaviors possible though frankly, the complexity got so high it was quite difficult to wire several different "chips" together and predict exactly how it would all behave with some unusual input sequences.  Even the stinkin' edge-detector wound up having: a Signal input, an Enable input, a Reset input (which was internally treated as edge-sensitive, not state-sensitive), an initial state input (defining the assumed "prior state" of the Signal input) and a boolean input controlling whether to use the initial state input on a reset.  Internally, there was also a First Call primitive that acted like a forced reset but which always used the initial state input.  And the logic made it possible to produce a True edge-detect output on the very first call, or on the same call that a reset was occurring, or the first call with Enable true after having been reset while Enable was False, and so on.

It's exhausting just thinking back on all the scenarios.  And that's just for an edge-detector that I'd normally do in about 30 seconds with a single shift register.  Maybe a couple minutes to add a "First Call?" primitive and make a text icon.  But that's why I'm intrigued by the exact details of the change-detection behavior on the M-series boards.  Knowing exactly which parts of the circuit are edge-sensitive and which parts are state-sensitive can sometimes matter.

-Kevin P.

-Kevin P.

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 26 of 41
(2,710 Views)

Wow guys, thanks for all this feedback. I am slowly figuring it all out. Ordered a PCI-6220 today, as well as a bundle of cables and a terminal board. Labview should be arriving shortly too.

I just read this in the M series manual...

"You also can use the output of the DIO change detection circuitry to trigger a DI or counter acquisition on the logical OR of several digital signals."

Is this not going to work as I hoped? I wanted to use the change detection to do both a counter acquisition and read the digital states at the same time. Is there some other way do what I want?

 

Thanks

Garrett

0 Kudos
Message 27 of 41
(2,697 Views)

It's my understanding, and if I recall correctly also my experience, that the change detection event can be used as a sampling clock for:

Digital Input  and/or  Digital Output  and/or  Counter Input  and/or  Analog Input  and/or  Analog Output

simultaneously.  I believe that where the manual says "trigger a DI or Counter acquisition", the "OR" should be considered an inclusive OR rather than an exclusive OR.  Plus the use of the term "trigger" is perhaps a bit unfortunate as the signal can be used as a sampling clock also and/or instead.

It seems that many people use the term "trigger" in a generic way to indicate any type of hw-level edge-sensitive synchronization, including sampling clocks.  I've seen that ambiguity on these forums quite a bit as well.  But once you get down to DAQmx programming, there is a clear distinction between triggers and sampling clocks.  (Frankly, I'm not a fan of the term "pause trigger" that DAQmx introduced.  It's the only use I know of that assigns the term "trigger" to a level-sensitive behavior.)

-Kevin P.

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 28 of 41
(2,693 Views)
Thank you, Kevin, that is very reassuring.  I was getting worried I just purchased software and hardware that wouldn't work for me.  I hope to be getting everything in very soon so I can start playing around with the software (I still dont have that yet...NI must have forgot to send or its lost in the mail), then hopefully I can understand and apply all the great help you guys here have provided.
0 Kudos
Message 29 of 41
(2,691 Views)
I have a setup question for my tasks.
 
To refresh, at a state change on any of my 6 digital inputs, I want to a acquire a counter value, and be able to know which digital input changed and what its new state is.
 
Should I set up my change detection on a port (looking at P0) or individual on each pin (each for P0.0, P0.1,...)?
 
If I set up change detection on the port, my data would look like this:
 
P0             Counter
----             ----------
000101      400
000100      800
000110      1200
 
And data like this is okay, but I am not sure what it would look like if I did it for each pin individually.  Would it look the same, or would it look like this:
 
P0.0     P0.1    . . . .    P0.5     Counter
------     ------               ------     -----------
0           0                    1           1000
0           1                    1           2000
0           0                    0           5000
 
I would think this second example of data would be much easier to work with, so if I can get this I would much prefer it.
 
 
Edit:  I guess what I meant to ask was not just how I should configure my change detection, but how to create the tasks, either one pin at a time, or reading in the whole port.
 
Thanks all!

Message Edited by gkaste on 06-22-2006 08:27 AM

0 Kudos
Message 30 of 41
(2,673 Views)