12-17-2009 07:52 AM
Hi every one, I started this project thinking that it would be easy, but as this is my first application, it´s been more complicated that I thought it would be...
My project idea: I have a laser device that measures distances. I take a lot of measures, and all I need is the mean distance, and then calculate some other things, but the main problem is to acquire this measurements.
Basically I have the "menu principal" all I need here is to measure each one of this three positions (I measure three different points, calculate the mean distance and then operate between this three numbers) what I tried to do here is, wit the measure distance 1, call the example 2.1.1.vi.... The first problem is that it start running, but I can not see it nor set the parameters unless I go to the block program and open it....
The second problem is that it should work like this, when I push measure distance1 should open the example 2.1.1.vi, set the parameters, then if I push "detectar trigger" wait for the F3 signal, run the application, and stop when the second F3 signal arrives, I have the hardest time with this, because the start an stop button or cap is the same..Finally when it finishes take the mean distance into the mean distance 1...
Should I have one example 2.1.1.vi for each "measure distance x"? I´m I doing it more complicated than it really is? Can anyone help me with this?
Thanks so much!
Cheers!!
12-17-2009 08:02 AM
You forgot somes files (the project is empty)...
Jean-Marc
12-17-2009 08:39 AM
My bad...here whe go again...
12-17-2009 11:50 AM
I made some modifications, it is a starting point...
Jean-Marc
12-17-2009 05:00 PM
Thank´s for your reply Jean Marc, it´s seems you know a lot...Ii had a problem to run the program though..The example 2.vi have this error:
These cannot be wired together because their data types (numeric, string, array, cluster, etc.) do not match. Show the Context Help window to see what data type is required.
The type of the source is typedef 'Action.ctl'
cluster of 2 elements.
The type of the sink is typedef 'Action.ctl'
unsigned word [16-bit integer (0 to 65535)] enum {Wait, Read, Update, Wait before measurement, Stop} [numFlags=0x6C6C00].
What does the "action" supposed to do? mime type and program path? I printed in pdf and I´m studding it, but I don´t quite get it..Ii´m sorry, as I said, is my first project and I have a lot to learn yet...
Could you please explain me?
Thank´s a lot, I needed someone to help me with this...
12-17-2009 06:25 PM
« Action” is a customize (wright click – advanced - customize) enum. You could open the type def (wright click – open type def).
When this VI starts, the value “wait” is stock in the “shift register”. The default value of DETECTAR TRIGGER is false and the VI do nothing, except waiting 100 msec at each iteration. When DETECTAR TRIGGER is switch to true then, at the next iteration of the while loop, the case structure will be switch to “Read”.
If the Boolean read is false then the VI do nothing except waiting 100 msec.
When the boolean Read is turn to true, then "one read" is done at the serial port and at the next iteration the case will be “update”.
The VI do some calculations and the next step is “wait before measurement”.
The VI waits “time between loops (ms)" and the next step is "read" and so on until the boolean “Stop 2” is switch to true,
Jean-Marc
12-18-2009 05:48 PM
Thank´s JM!!! It´s been so useful!!! I´ll try with this during the weekend and see what happens, I´ll let you know how it´s working....have a nice weekend!!
Later...
12-21-2009 10:36 AM
Hi J-! I´ve been working the during the week end in the project, and I wanted to say thanks, since your advice helped me to do what I needed.
The only question I have, is the next, as I checked the vi, I found that it seems to "slow down" as the vi runs...i mean, the first measures goes as fast as 58 measures per second, 30 seconds later it runs at 32 measures per second (this is with time between loops 0 ms-the fastest to measure-, delay before read 10 ms. At first I thought it may be a problem with the cases you added, but then o checked the original project and it has the same problem....
May I ask you two more questions?
1. What may be causing this problem? Is it the cases? The buffer? The shift register? The VISA close function? I don´t really know if this can make a vi slower..i tried deleting one of this at the time, and even though with come combinations runed faster, the problem remains...
2. Is it any way to run the vi faster? With 9600 bauds y should be able to collect +-180 measures per second..Instead I can only take +-60 measures per second....what should I consider when I´m programming, so a can take all the measures I can?
12-21-2009 11:04 AM
Post your latest version. I will take a look at the end of the day or tomorrow.
Jean-Marc
12-21-2009 04:46 PM
j-m, i really appreciate your help, i´ve been working in the big formula to put everything together and in the laser as well...
regards!