Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

NI USB-6229 BNC multiple tasks

Solved!
Go to solution

Hi all,

 

Sorry if this has already been covered elsewhere but Im a fairly new to labview and have a few very specific questions id like to ask.

 

Ive been working with labview on and off at work over the last few months and have tied down the basics, I am currently working on a project that requires me too......

 

Collect and display data in real time from 16 Analog inputs. (not all channels are displayed)

Ouput an adjustable analog voltage

Measure the time period between pulses coming from an encoder using a counter to then calculate rpm.

 

I am using a NI USB-6229 BNC board with a standard USB 6229 also available without BNCs 

 

I have managed to achieve all of the above, but I have a few questions.......

 

Im currently running this in one while loop as I want to be able to stop everything at once, but Is there a more efficient way of setting this out as I feel that the processing of the whole vi could be better?

 

Im having problems with the counter as I would like it to display 0 rpm when there is no pulses coming from the encoder but the programme waits at the counter vi until a pulse is detected, this also means that it will usually time out if it doesnt receive a pulse when i would just like it to run through displaying 0 rpm.

 

Finally, because i have 2 of these boards available to me, should I split the inputs onto one and the output/counter on the other?

 

I will try and upload a copy of the vi soon.

 

Thanks

 

Harry

0 Kudos
Message 1 of 9
(3,925 Views)

Hi Harry,

 

I will try and answer these questions you have regarding the use of the USB-6229 BNC device. It sounds like you have taught yourself the basic concepts well and glad you have been able to get your essential tasks up and running.

 

The use of a single while loop is probably not the best way to structure your code. A alternative option would be to have a series of while loops which run the code in a parallel manor. You can still have the ability to stop the loops simultaneously through the use of a  local variable. Local variables are great for passing data between while loops in a single VI. Please follow this link for information on how to create local variables. If you want the ability to stop multiple VIs you can use a shared variable which can be created in your project explorer.

 

The problem you are having with the encoder sounds like it is an issue with how you are triggering the acquisition. Are you using a DAQmx triggering VI. If you are then removing this VI will allow the acquisition to start instantly.

 

I don't see any reason why you would want to split your outputs onto one board and your inputs onto another, the USB 6229 is able to handle the multi-tasking demands you require.

 

Hope this clears up a few question you had. Please let me know if you require any more information.

 

Many thanks,

Aaron. E
Product Performance Engineer
Dyson
0 Kudos
Message 2 of 9
(3,916 Views)

Hi Aaron,

 

Thank you for getting back to me so quickly.

 

I have since split my vi into multiple loops as you suggested and used local variables to stop everything at once, this has definately improved performance.

 

However I still cannot resolve the issue I am having with the counter, I am collecting the data through an DAQmx express input vi with a high freqency counter measuring pulse period. The data then goes through an eqation which gives me the rpm of the shaft. The issue still remains however that when the shaft isn't turning and there are no pulses being output, the counte will not output any value, it simply waits until there is pulses from the encoder.

 

I have got round this by putting the counter in a case structure where the case is true if there is a voltage entering the motor driving the shaft and so the counter turns off before there is 0 rpm. But this is a pain as ideally I would just like to have the counter running all the time with the real time display.

 

Thanks for all your help so far!

 

Harry

0 Kudos
Message 3 of 9
(3,902 Views)

Hi Harry.

 

I'm glad you were successfully able to utilise separate while loops with local variables to improve the performance of your code.

 

In order to help you further with this issue it would be really useful to see your code. From this I will have a better understanding of the type of counter you are using, (ie, HW SW based). A possible solution would be to use a tick count function and basic mathematical nodes to calculate the time between pulses.

 

Many Thanks,

 

Aaron. E
Product Performance Engineer
Dyson
0 Kudos
Message 4 of 9
(3,891 Views)

Hi Aaron,

 

I have attached my main vi that contains a subvi im using to create a ramp in the rpm of the shaft. Unfortunately I have not got round to commenting it yet so i hope you can make some sense of it. I have labelled the counter. As I said in my initial post I have not been using labview for very long and I would really appreciate any further advice on how I could improve my layout/functionality of the vi.

 

If you need me to make comments to explaion what I am doing in the VI then I can give you a commented version, but I am busy over the next few days with other tasks so there may be a delay.

 

Thank you very much again for your continuing support!

 

Harry

Download All
0 Kudos
Message 5 of 9
(3,878 Views)
Solution
Accepted by hcook

Hi Harry,

 

Thanks for providing me with your code and sorry for my delayed response. 

 

I think the issue with your implementation is that you are using a frequency measurement express VI. Using lower level functions allows us to have more control over how the frequency is measured. There is a good example which illustrates how we can use DAQmx controls to calculate how many pulses there has been in a specific time period. This would be a much better way to measure the frequency of your pulses and allow the program to detect if it has received zero pulses (ie. zero rpm).

 

Software-Timed Frequency Measurement Using Edge Counter

 

Please have a look at the example and let me know if this would provide a suitable implementation.

 

On another note regarding the layout / functionality of your code, I don’t think you need the outer while loop. Also this loop doesn't have a control / local variable attached to its conditional terminal so will carry on running after you have stopped your code.

 

I hope you find the example useful and look forward to hearing how you get on,

 

Many Thanks,

Aaron. E
Product Performance Engineer
Dyson
0 Kudos
Message 6 of 9
(3,859 Views)

Hi Aaron,

 

At this time I am working on another project, but hope to return to the one you have been helping me with soon.

I will post an update once I have had a chance to implement to the changes and have a play about with it again.

 

Thanks again!

 

Harry

0 Kudos
Message 7 of 9
(3,822 Views)

Hi Harry,

 

Thanks for the update.

Aaron. E
Product Performance Engineer
Dyson
0 Kudos
Message 8 of 9
(3,805 Views)

Hi Aaron,

 

The timed frequency counter worked a treat, thank you very much!

 

As im looking to give a constant display of the rpm I have set the time over which it counts to a second, I realise however that this impacts on the accuracy of the counter somewhat and it is calculating the rpm slightly lower that the true rpm.

 

But this is acceptable given that the rpm from any data collected is processed looking at the time between pulses.

 

Thank you very much for all your help!

 

Harry

 

0 Kudos
Message 9 of 9
(3,780 Views)