Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Software action on TC without polling

Hi.

I am acquiring data at set distances (mobile system) an want to take a software action when a certain distance has been measured ( sample distance=10cm, measurement distance=5 meters) It is a buffered acquisition and I am using a counter to count down from 50 to 0. At 0 i want to start some external DLL's to get and use the acquired data. (the acquisition process wil continue) I do not want to continuously poll the counter for the TC. More like an interrupt driven software action.

Has anyone solved this or a similar problem?
0 Kudos
Message 1 of 6
(3,651 Views)
Walter,

This is an interesting situation. I have an idea. First of all, to accomplish this task you will need to configure your counter to output a pulse when it reaches TC. Generating a software callback when this pulse is generated will require a DAQ Event and another functional component of your device (analog input or analog output). For example, if you route the output of your counter to the update clock for your analog output channels, you could use DAQ Event 1 (Every n scans) to generate a callback each time TC is reached. I have included a tutorial concerning DAQ Events below:

An Overview of DAQ Events and Occurrences

Good luck with y
our application.

Spencer S.
0 Kudos
Message 2 of 6
(3,651 Views)
Spencer,

Your proposed solution sounds promising. I'll surely try this approach. Thanks!

Walter
0 Kudos
Message 3 of 6
(3,651 Views)
I have tried your suggestion, but I am unable to get it to work because of the following.

I use the TC pulse to do an AI-scan. The AI scan is done by directly calling the NI-DAQ functions because I need the pointer to the data in the buffer. However, I can use NI-DAQ's Config_DAQ_Event_Message function to define an occurrence, but then I am unable to "catch" the occurrence in Labview since there are no "wires" to attach to the action-on-occurrence VI's. LabView uses - as ever - the lvdaq.dll to setup the occurrence and produces a taskID and an occurrence which then can be wired. But since there is no manual on lvdaq.dll, I can't create them myself. I'm stuck yet again.

Any suggestions?
0 Kudos
Message 4 of 6
(3,651 Views)
Walter,

I agree that this will not be possible with the current structure of your program. You indicated that you need to use NI-DAQ function calls because you need the pointer to the data in the buffer. Why do you need this pointer? If your analog input operation was implemented with LV VIs, everything would be good-to-go. Let me know.

Spencer S.
0 Kudos
Message 5 of 6
(3,651 Views)
Hi Spencer,

I'll tell you a little more about the application and hopefully things will become somewhat clearer.

We are measuring road characteristics on a mobile system (a van fitted with a number of sensors, which are sampled on a distance-base. There a two sample distances: 1 mm for a laser-based system (16 or 32 bits), and 1cm or 10 cm (for a maximum of 8 analog channels). The maximum measuring speed will be around 110 km/h.

The sensors are mounted on different positions on the vehicle. Some at the front, and some on a trailer behind the vehicle. This means that a point on the road is not measured by all sensors at the same moment. The maximum distance between sensors can be almost 18 meters. Our data format corrects for these distances, but we therefore need/use a buffer which contains all the data for say 20 meters. The software picks the correct blocks of data (so that the data all correspond to the same 5-meter section of road, 5 meter being our standard processed block of data) and saves them to disk. As we have a lot of software that uses this data format, we do not want to deviate from this approach/format.

Now, If we used the LabView VI's for this, we would have the data-acquisition buffer in memory, PLUS an extra buffer to hold the required 20 meters of data. We would use double-buffering of course, so in case of the lasers, the acquisition buffer would be at least 10m of 1mm sampled 32 bits data, which is 40 kilobytes. This data would them simply be copied to another piece of memory - into another cirular buffer (the 20-meter buffer, so to say). Every 5 meters a DLL would be started which picks the right segments of data (of the laser, but also from the analog channels and a few counters) and save them to disk.

Why create our own circular buffer (which takes memory and processor time to make sure everything is copied correctly, remember write and read positions, etc.) when LabView already has done this: the acquisition buffer. If we make the acquisition buffer the right size (20 meters) and if we know the location in memory of this buffer, we can directly access the data. If we create the data-acquistion using the NIDAQ commands, we have the pointer to the array/buffer. No copying data, no self created and controlled buffers, no unneccesary CPU overhead.

- bare with me, I'm almost there -

The data-acquisition is hardware controlled. We have a mm pulse and a cm-puls which we use to trigger the laser and the analog channels respectively. Every 5 meters, we need to start the DLL which accesses the data and saves the correct results (with some calculations). The samplepulses are also fed to counters, so we can keep track on how many samples are acquired an also as an odometer. With an analog sampledistance of say 10 cm, I use a third counter counting down from 50 (5 meters), and at TC I wish to start the DLL. This is the basis for my original question in this thread.

Thats it! (pant, pant)

If things are still unclear, please let me know.

Thanks

Walter
0 Kudos
Message 6 of 6
(3,651 Views)