LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Linear Encoder and Configure Logging

Solved!
Go to solution

Hi All,

 

I am currently using a PCI-6280 M-series board with LV2010.

 

I have a Linear Encoder in X4 mode connected to Counter 0 and I was wondering if it is possible to stream the values on the counter as it keeps track of the distance into a TDMS file using "DAQmx Configure Logging" .  I tried this using MAX to configure this, but it does not seem to work, so I'm just wondering if this is even possible as I couldn't seem to find anything online about doing this.

 

Thanks,

 

Lester

0 Kudos
Message 1 of 12
(3,322 Views)

Hi Lester,

 

Yes, you can use DAQmx Configure Logging to log the data in a TDMS file. Just place it in line with your task configuration VIs, before you start the task. It will log the data to the file path you specify. There's a screenshot attached of how it would look for an edge counting task. Does that help?

 

Regards,

 

Daniel H.

0 Kudos
Message 2 of 12
(3,307 Views)

Hi Daniel,

 

Thanks for the reply.  I understand what you are saying and I also made a copy of it in my labview.  However, when I run the vi, an error icon pops up saying that "logging is not supported for non-buffered tasks" or something like that...am I setting it up wrong?  But I don't see how I can....

 

Thanks in advance!

 

Lester

0 Kudos
Message 3 of 12
(3,303 Views)
Solution
Accepted by topic author lestwest49

Hi Lester,

 

My apologies, I tried it out on a different board. It can work with yours, too, though. There is an example of a buffered counter task that should allow you to log the data by adding in the Configure Logging VI like we did before.

 

Open LabVIEW and go to Help >> Find Examples... it will open the Example Finder. In the Example Finder, expand the folders to get to Hardware Input and Output >> DAQmx >> Counter Measurements >> Count Digital Events >> Count Digital Events-Buffered-Countinuous-Ext Clk.vi

 

Put the correct counter channel and PFI channel in the controls, and run the VI to see what it does. Then you can modify the block diagram to add the Configure Logging VI (the same way as before) and run the VI again. You will end up with a TDMS log saved at the path you wire into the Configure Logging VI.

 

I hope that helps.

 

Regards,


Daniel H.

Message 4 of 12
(3,292 Views)

Hi Daniel,

 

Wow thanks!  I kept on forgetting to put the "daqmx_read.vi" in the vi's I have written before, so thats why I never received any samples into my TDMS files. 

 

Thanks!

 

Leste

0 Kudos
Message 5 of 12
(3,281 Views)

Hi Daniel,

 

Sorry for double post, but can configure logging be used for 2 separate tasks into the same channel under the same sample clock source?

 

Lester

0 Kudos
Message 6 of 12
(3,277 Views)

Hi Daniel,

 

I put two counters in there and used a freqout for the sample clock source.  However, it doesn't seem to log BOTH the counters and only one of them, is this normal?

0 Kudos
Message 7 of 12
(3,258 Views)

Hi Lester,

 

Do you mean you're trying to log the data from both tasks into the same file at the same time? That, unfortunately, will not work. I would suggest logging to two separate files and copying the data later. If you don't need to use the logging capability, you could just take the data you are reading from each task in your while loop and combine them into an array and save the array as a txt or TDMS file, so you would be saving data from both tasks into one file. 

 

Also, your CO Pulse Freq task needs to be cleared at the end of your VI. Right now you just start it and then do nothing with it. 

 

Regards,


Daniel H. 

0 Kudos
Message 8 of 12
(3,248 Views)

Hi Daniel,

 

In the above version of the code, I actually log the data into two separate TDMS files.  The freqout is used as the sample clock for the counters.  It seems that even though they log different files, when I run the program, one of the files will have data in it, and the other one would be empty.

 

When I run the counters separately, one at a time, they work independently.  However, when I put them in parallel, only one ends up working.  Is the freqout using one of the counter ports or something? 

 

Also, yes I forgot to clear the freqout task, thanks.

 

Lester

0 Kudos
Message 9 of 12
(3,245 Views)

Hi Lester,

 

If you put indicators from your DAQmx Read VIs, are both tasks displaying data? One potential problem I can see is that PFI4 is the default terminal for the ctr1 gate. If you open Measurement & Automation Explorer, go to Devices and Interfaces, then right-click on your 6280 and select Device Pinouts you will be able to see which PFI channels are default routed to which counter pins. Try changing the PFI channel that you're using in the pulse frequency task to an unused PFI channel, and see if that helps. 

 

Regards,

 

Daniel H.

0 Kudos
Message 10 of 12
(3,230 Views)