02-02-2010 04:10 AM
HI
I am using a shaft encoder which gives a pulse every ½ degree and a pulse every full revolution. On each ½ degree pulse I would like to take 3 simultaneous voltage readings from 3 different volatge sources. It needs to write to file the 3 voltage readings per ½ pulse and a full revolution pulse to a file simulataneously.
I have just done the ni core 1 and 2 course but find starting this hard - i cannot think of how i can accomplish this on a single core machine. The writing to file will be easiest but setting up the simulataneous action i am finding hard.
I tried using 3 multiple while loops which each took a DAQmx start vi for the analogue voltage inputs which were used the counter line (720 pulse) as the source on the individual sample clocks for each while loop - but got a shared resources error of -50103.
Any ideas?
many thanks
Notay
02-02-2010 07:53 AM
02-02-2010 08:11 AM
I forgot to mention for this to work you need to remove the duplicate counter measurements. I used an OpenG VI
In this example I was only interested when the counter changed. You also need to sample faster than what your encoder. This method might not work for really fast applications.
02-02-2010 01:59 PM
Hi ASTDan - thanks for your reply
I am trying to figure out how exactly i would incorporate you idea into my vi - of which i have attached the picture.
The shaft encoder is actually going to be attached to a crank of an engine so we are expecting speed in excess of 5000rpm - a lot of counts! (bearing in mind i will only run the program for at most 5 seconds)
The way i thought it did it was logical to me but will not work in labview because of the shared resource.
On highlight execution i actually get two errors; -200279 @ the DAQmx read in the upper while loop and -50103 @ DAQmx start vi just outside the lower loop. I am guessing the former error is occuring due to the sample rate being low possibly due to the highlight execution being on.
Also I have just noticed that sometime the error of -50103 jumps to the DAQmx start vi for the upper loop on some program starts - i think the reason it is doing this it because there is no order for execution of tasks/data - this is understandable but I would like parallel system
Any suggestions?
Thanks - Notay
02-02-2010 02:39 PM
You can't have 2 instances of Analog input. You need to have only 1 instance of an analog input task and then read N Channels N samples for your analog read. Then index the analog input channels you want. That I beleive is the -50103 error.
The other error can be caused by highlight excution being on. It is basiclly saying your buffer is full. You need to read the data out of the buffer faster. I think you will run into this with highlight excution being off because you are only reading 1 point out of the buffer/while loop interation. I would recomend reading more samples/iteration.
02-02-2010 03:15 PM
Hi
I have change the analogue read to multiple channels - multiple samples - 2d DBL as suggested. I have added an additional 2 physical channels but i do not how to index them into the physical channels input of the daqmx create channel vi.
Thought about using a bundle cluster to bundle them together but then the output of the cluster becomes a string which clearly cannot be wired into the create channels vi.
I have searched the functions pallete for something suitable but have failed. Which vi should i use?
Also would this mean that at the data end of the read vi i would get an array of 3 data sets?
I really appreciate you help. Thank you - Notay
02-02-2010 04:04 PM