LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

is this the correct way?

I have to measure the position of motor with labview via Rs232. I want to plot the last position ( or the first..) of motor in each min. So I draw the way to program. IS it correct way?
0 Kudos
Message 1 of 8
(3,262 Views)
Basically, yes.

You read input from the serial device inside the while loop. But you only need one while loop. You should use a control button to stop the loop. You can use a timer to control when to read from the device. What version of LabVIEW are you using? What is the make and model of the motor?

B-)


Message Edited by LabViewGuruWannabe on 11-20-2007 08:49 AM
0 Kudos
Message 2 of 8
(3,249 Views)
Hi ha noi,

your "design" looks ok - but how should we decide if it is correct?
We don't know your requirements... Maybe 1 measurement per 1min is not enough? Atleast I suspect it's very inaccurate Smiley Wink
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 8
(3,242 Views)
For a basic idea how to implement it, look at the attached picture. If you are using VISA you will need to set up your specific settings. Inside the seqence structure is where you would put your position reading. Once you do that, you dont need the sequence structure (I just used it to show you where to put your code). Also replace the 0 constant with your found position.
 


Message Edited by jrpe on 11-20-2007 10:05 AM
Jeff


Using Labview 7 Express
0 Kudos
Message 4 of 8
(3,232 Views)
This is the ciruit i made! I tried make array with 10 index. After array update 10 elements ( 10 measurements , motor position ), array will be clear to update new 10 elements.But it's seem not good, coz the graph i draw in the main while loop, it's update very slow.
Exp: with value of motor position 1 ( always  take the last elements of array 1) , i  plot at x=1,
       with value of motor position 2 ( always  take the last elements of array 1) , i  plot at x=2
      .............
       with value of motor position n ( always  take the last elements of array 1) , i  plot at x=n
But when x=n, the graph update with value of motor potition n-1 and draw at x= n-1 => it's slow. I hope u understand.
0 Kudos
Message 5 of 8
(3,217 Views)
First of all a couple comments about your code,
 
1)As much as possible you should avoid having dataflow (wires) from right to left, it is quite confusing. You do this with your read string, and you dont need to, you could compress the top half towards the left and compress the bottom half to the right. You do it again with the output of your shift register.
 
2)Since you preinitialized your array with a constant (I assume of size 10) (btw you could have used initialize array to make it clearer, and easier if you ever have to initialize a much larger array), you shouldnt use build array, you should use replace array subset, and replace at the index of i, otherwise you lose all benefit of preinitializing. In addition this will eliminate the need for your array subset. You start with an array of size 10, since you use build array instead of replace array subset, you end with an array of size 20 (which is why you use array subset). Eliminate build array and the subset.
 
3) What is the big loop doing?? If you are using it like you did in your original diagram, it isnt really achieving anything.
 
4) I assume that your graph is off in another loop (presumably the one that your double is heading too). That is why it is updating so slowly, because the other loop wont start until this loop completes. Move the graph into THIS loop, it will update every iteration (Although if you have a wait time of 1 minute... it will still update very slowly).
 
Implement that and it should clear up your code a lot and solve your problems.
 
Jeff


Using Labview 7 Express
0 Kudos
Message 6 of 8
(3,195 Views)
To move the graph into the same loop, look at the first example I posted to this thread.
Jeff


Using Labview 7 Express
0 Kudos
Message 7 of 8
(3,194 Views)
Here is what I was describing
 

As i attached that I realized a flaw, you need to change the break statement from =10 to =9 so that you have 10 iterations instead of 11, I just dont want to remake it all. As it is shown, you will be replacing a position that doesnt exist.

Message Edited by jrpe on 11-20-2007 12:08 PM
Jeff


Using Labview 7 Express
0 Kudos
Message 8 of 8
(3,175 Views)