Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Can some recommend a good tutorials on how to use timers

I would love a good tutorial on counters to know how they work I am practising using my USB DAQPad-6015, but will implement the solution and would like to get a better understanding before I start
0 Kudos
Message 1 of 11
(10,868 Views)


Dear Mr Nice

There are plenty of tutorials available on our website which cater for different levels of programming experience. I have provided links below to a couple that I would reccomend. Feel free to follow links off these pages to explore other areas of counting/timing behaviour. There is also a good degree of information in the help menu in LabVIEW aswell as some excellent examples which can be found in the example finder, also in the Help menu.

I hope this will provide a solid foundation for you.

Regards


Rob


Links:


Counting edges - http://zone.ni.com/devzone/cda/tut/p/id/2735

10 handy things to Know - http://zone.ni.com/devzone/cda/tut/p/id/2835

Pulse width measurement - http://zone.ni.com/devzone/cda/tut/p/id/2875

Period measurement - http://zone.ni.com/devzone/cda/tut/p/id/2868

Frequency measurements - http://zone.ni.com/devzone/cda/tut/p/id/3619

Pulse Train Generation - http://zone.ni.com/devzone/cda/tut/p/id/2760


Message Edited by Rob L on 05-02-2007 06:52 AM

Rob L

NI Applications Engineer

UK & Ireland


It only takes a click to rate this message 😉
0 Kudos
Message 2 of 11
(10,859 Views)

Thanks Rob L for you reply I hope after all this time I am fairly decent at LabVIEW but what that actually means I have no idea as I have no one I can compare it withSmiley Happy.

Specifically what I want to do is that I have inherited someone elses code for setting up a 6602 timer at work and it is written using the traditional daq drivers. I want to learn about the timers and re-write using daqmx.

I have theorised that the card must be setup via this LabVIEW program which sets up 8 waveforms, the program itself just sets up the channels but has nothing to do with generating the wavform as the card in order to be accurate must work independantly of operating system and software (can you imagine trying ms resolution if Bill Gates decideds to check if the printer it is still ok at the vital moment), The card must wait for a trigger and then just output the wavform. The figure basically shows it is not a pulsetrain I require and that the length of the wavefoem can be a couple of minutes and it is important to accurately turn high or low with resolutions of ms.

Knowledge on how to connect to the card, what the connections do, what do we need to send to the card via LAbVIEW and what those LabVIEW settings actually do is a mystery to me and would be really  useful to understand. why is there no explanation of the underlying principle of the cards on the data sheet. I often wish if NI did data sheets like Microchip then NI Users would be able to develop more efficiently and be able to utilise NI products just so much better.
 
I have some examples for generating pulse trains but as I am unsure what I am actually doing I might as well have a example of table tennis as the change to what I want would be as simple. I know LabVIEW and NI is trying to make it easier for the user by removing this detailled information and making there products a lot more black box'ish but I am an old timer and need to see what the circuit is and what I am setting
 
Hope this doesn't sound like a bit of a moan, I would truely appreciate some help or direction to somewhere I could read up about these principles
 
Nice
 
 
0 Kudos
Message 3 of 11
(10,852 Views)


Nice

I totally understand how it must be frustrating you that our data sheets do not contain the kind of informtaion that Microchip data sheets do. I am familiar with their data sheets and yes they do provide good information on the underlying behaviour of the card. However, our data sheets are specifically that, they provide the hardware specifications and some basic attributes of the device. What we do have however, is an extremely detailed and versatile set of tutorials on our website. We have tried to make it as user friendly as possible and provide information on the core behaviour of our hardware and also programming styles and techniques that will be of use to our customers. NI offers a range of hands on course for our customers also.

Updating the original legacy code into the DAQmx style will take time, but I believe that the versatility that DAQmx offers makes it worthwhile. I would strongly reccomend using the help menus, but I am guessing you have tried these already. I have therefore tried to find specific links for you which will hopefully answer those specific requests in your last post and hope that these will be of more use to you. They include information on hardware timed acquisition as I totally know what you mean about Windows eating resources at critical moments!

http://zone.ni.com/devzone/cda/tut/p/id/5438 - This is an excellent tutorial on the basic principles of programming with DAQmx.

http://zone.ni.com/devzone/cda/tut/p/id/5434 - this page is the main DAQmx page with information on all aspects of DAQmx.

http://zone.ni.com/devzone/cda/tut/p/id/4342 - Good information on the transition from legacy to DAQmx.

http://zone.ni.com/devzone/cda/tut/p/id/4359 - this tutorial provides the core principles of the Hardware architectures etc.

http://zone.ni.com/devzone/cda/tut/p/id/3397 - some basics on the hardware limitations and capabilities that affect the accuracy of your data acquisition.

I hope this information is relavant and will really help you in developing your code. Keep me posted on how you get on.

Regards

Rob






 



Rob L

NI Applications Engineer

UK & Ireland


It only takes a click to rate this message 😉
0 Kudos
Message 4 of 11
(10,832 Views)
Your information still gives no examples on what a timer is or what it does or how to configure it in any way and I can not find any information on it. I want to be able to set a (start time) time and duration in to a timer so when a specific trigger is sent to the 6602 timer card there is a postive change of state so many seconds (start time)  after the trigger for that duration.
 
I have included the vi I am looking at but as I can find no information on timers on the NI website or literature I have no idea what it does. Hopefully it does what I have mentioned above for a specific timer channel for a specific timer
 
I want to understand this vi and change it to daqmx. I am not expecting any free hand outs I want to understand what the vi does
 
thanks
0 Kudos
Message 5 of 11
(10,778 Views)
Hi
 
I find the following diagram really good for explaining counters:
 
 
Count Register
The count register stores the current count of the counter.  The count register can be queried with software.
Source
The source is an input signal that can change the current count stored in the count register.  The counter looks for either rising or falling edges on the source signal.  Whether a rising or falling edge changes the count is software selectable.  The type of edge (rising or falling) that is selected is referred to as the active edge of the signal.  When an active edge is received on the source signal the count will change.  Whether an active edge increments or decrements the current count is also software selectable.
Gate
The gate is an input signal that decides if an active edge on the source will change the count.  Counting can occur when the gate is high, low, or between various combinations of rising and falling edges.  Gate settings are made in software.  The gate is similar to a line mask in digital I/O, because it allows you to either acknowledge or ignore active edges on the source.
Out
The out is an output signal used to generate pulses or a series of pulses often referred to as a pulse train.  The output signal is TTL compatible.

The Source and Gate signals can be input on any of the PFI lines but there are default pins assigned which are specified in the DAQ assistant when you set up a counter task, you can also find that information on the pinout for the device.

The source and gate can be used in different configurations for multiple applications. I need to have a look at your code but from my initial glance it looks like it's setting up a retriggerable pulse train.

I'll find some more resources and post back with an explanation of how that type of counter application works.

Message Edited by SarahB on 05-17-2007 09:55 AM

Sarah

Applications Engineer | National Instruments | UK & Ireland
Message 6 of 11
(10,752 Views)
I am trying to connect up the timer and not getting very far and wanted to make sure I am getting this right.
 
OK I have connected my Oscillloscope to CTR0 Out  (NI DAQPad-6015 terminal 49) and digital ground (terminal 51)
I have connected an input (250ms 5v waveform pulse) to the gate (terminal 52)
and I have set the source (terminal 50) high by connecting 5v (terminal 47) from the DAQ card to it
 
I hope with the settings as they are that once the rising edge of my 250ms digital trigger the Counter Out waits for 1s then goes high for a second before returning low
 
nothing happens at all though. Am I making the right connections is the ctr ground the same as the digital grounds (they should be)
 
How actually do I connect up a DAQ card to produce a waveform. I want the following thing to happen, I want the timer to wait for this 250ms trigger (where do I plug this external trigger in, gate? source? where do I plug the ground of the trigger coming in dig ground?)  then wait for a setable delay, then go high for a set time before going low again.
 
Any takers
0 Kudos
Message 7 of 11
(10,729 Views)

Hi there,

How are you getting on with this? Here's a picture that indicates the part of a counter you use for pulse generation. The Source uses a time base to generate the signal. You can control when the pulse is generated via the Gate input.

I'm still not sure exactly what you want to achieve but you're looking for either a retriggerable pulse train or a pause triggered application. There are examples in the example finder for both of these. Go to File >> Find Examples in LabVIEW. Then browse to Hardware Input and Output >> DAQmx >> Generating Digital Pulses then check out the pause trigger and retriggerable examples. The VIs will tell you the pins to connect your signal/scope to.

Message Edited by SarahB on 05-25-2007 03:44 AM

Sarah

Applications Engineer | National Instruments | UK & Ireland
0 Kudos
Message 8 of 11
(10,685 Views)

Thanks SarahB, Just had a NI guy turn up and he showed me the right place to look in the examples. The follwoing VI is actually what I needed

 

Thaks for all your help

0 Kudos
Message 9 of 11
(10,678 Views)
No actually this still doesn't do what I want, it gives me the waveform I want, when there is a digital trigger event, it waits for a delay and then goes high for a set time. Unfortuantly it sits waiting for a trigger, stopping the VI from doing other things.I am using a 6602 timer card and I thought the beauty of using these timers were I could just load the setpoints up whenever without worrying about it then do other things with the timer card working indapendantly only producing waveforms when it reaceives a trigger. Do I really need to wait in a loop in order to trigger the waveforms.
0 Kudos
Message 10 of 11
(10,673 Views)